Review ELB inbound access rules

Permit only required client access to the ELB and verify its inbound path.

Description

Check that the ELB’s security groups allow approved clients to reach its listener port. Rules in any attached group, including standalone ingress rules, contribute to access.

Potential impact

Without a matching allow, new requests are blocked. Opening every source can also admit unintended clients.

Remediation

Allow the required sources and ports. For a standalone AWS::EC2::SecurityGroupIngress, check that GroupId identifies the ELB’s group. Verify the target instance rules, routing, listener and application authentication, then test a request.

Examples

The excerpts omit the listener and ELB subnets. Omitting VpcId on the group requires a default VPC in the Region.

Before

yaml
Resources:
  LoadBalancerSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: ELB security group

  MyLoadBalancer:
    Type: AWS::ElasticLoadBalancing::LoadBalancer
    Properties:
      SecurityGroups:
        - !GetAtt LoadBalancerSecurityGroup.GroupId

After

yaml
Resources:
  LoadBalancerSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: ELB security group
      SecurityGroupIngress:
        - IpProtocol: tcp
          FromPort: 443
          ToPort: 443
          CidrIp: 0.0.0.0/0

  MyLoadBalancer:
    Type: AWS::ElasticLoadBalancing::LoadBalancer
    Properties:
      SecurityGroups:
        - !GetAtt LoadBalancerSecurityGroup.GroupId

The second excerpt allows TCP 443 from every IPv4 source. Limit the sources for an internal service. To serve HTTPS, configure the listener and certificate.

References