Security group rule allows all IPv4 addresses

A security group rule allowing every IPv4 address can permit unwanted connection attempts to reachable resources.

Description

In a Crossplane SecurityGroup, ipRanges.cidrIp: 0.0.0.0/0 lets any IPv4 source use the specified port and protocol. Actual internet access depends on the attached resource, its public addressing and its routes.

Potential impact

On a reachable database, unwanted clients can attempt to log in. Exposed credentials or a vulnerable service can lead to data disclosure or changes. Database authentication still applies.

Remediation

  • Set the database port and protocol, and limit ingress to approved client CIDRs or supported source security groups. Check all groups attached to the database.
  • If the rule comes from a Composition, correct its defaults and verify the rules on existing resources. Test that approved clients connect and other sources are blocked.

Examples

These excerpts use different resource names. Update the original group, or attach the replacement and remove the old permission. Creating ec2-rule1 alone leaves ec2-rule2 in place.

Before

yaml
apiVersion: ec2.aws.crossplane.io/v1beta1
kind: SecurityGroup
metadata:
  name: ec2-rule2
spec:
  forProvider:
    region: us-east-1
    ingress:
      - fromPort: 5432
        toPort: 5432
        ipProtocol: tcp
        ipRanges:
          - cidrIp: 0.0.0.0/0
            description: Everywhere

ec2-rule2 allows TCP 5432 from every IPv4 address.

After

yaml
apiVersion: ec2.aws.crossplane.io/v1beta1
kind: SecurityGroup
metadata:
  name: ec2-rule1
spec:
  forProvider:
    region: us-east-1
    ingress:
      - fromPort: 5432
        toPort: 5432
        ipProtocol: tcp
        ipRanges:
          - cidrIp: 10.0.0.0/8
            description: Internal network

ec2-rule1 allows TCP 5432 from all of 10.0.0.0/8. Narrow this private range to the clients that need it.

References