Description
Check who needs TCP 80. A public website or HTTPS redirect may need it. Restrict internal APIs and administration pages to the clients that use them.
Potential impact
External clients can reach a listener when public addressing and routing permit it. Any information sent over HTTP travels in plaintext, including the first request before a redirect.
Remediation
Send sensitive requests directly over HTTPS and verify application authentication and authorization. Use a load balancer or WAF where appropriate. Review broad port ranges in all attached groups and test user and management access separately.
Examples
Supply the actual VPC ID. The tasks create different groups, web-open and web-internal.
Before
- name: Create the public web security group
amazon.aws.ec2_group:
name: web-open
description: open web security group
vpc_id: vpc-12345
rules:
- proto: tcp
ports: 80
cidr_ip: 0.0.0.0/0
web-open allows TCP 80 from every IPv4 source.
After
- name: Create the internal web security group
amazon.aws.ec2_group:
name: web-internal
description: restricted web security group
vpc_id: vpc-12345
rules:
- proto: tcp
ports: 80
cidr_ip: 10.0.0.0/16
Replace 10.0.0.0/16 in web-internal with the necessary client range. Attach the new group to the service, remove the earlier broad permission and verify connectivity.