Description
Combining IpProtocol: "-1" with 0.0.0.0/0 allows every protocol to all IPv4 destinations. The equivalent IPv6 destination is ::/0.
Potential impact
Where a route exists, the workload can send data to an unapproved destination. Blocking a required destination can interrupt updates, log delivery or application calls.
Remediation
Allow the destinations, protocols and ports the workload uses. Review egress across all attached groups, including any default allow-all rule added when a new group omits egress. Use a proxy, firewall or VPC endpoint where appropriate, then test the required services. Stateful tracking permits replies to allowed inbound requests.
Examples
Both snippets omit VpcId and require a default VPC in the Region. The SSH group description creates no inbound rule.
Before
Resources:
InstanceSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Enable SSH access via port 22
SecurityGroupEgress:
- IpProtocol: "-1"
CidrIp: 0.0.0.0/0
The first rule covers every IPv4 destination.
After
Resources:
InstanceSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Enable SSH access via port 22
SecurityGroupEgress:
- IpProtocol: tcp
FromPort: 443
ToPort: 443
CidrIp: 10.0.0.0/8
The second limits egress to TCP 443 but includes the entire private range 10.0.0.0/8. Narrow the destination and verify TLS and authentication on the service.