Description
Check both cidr_blocks and ipv6_cidr_blocks. Allowing TCP 80 from 0.0.0.0/0 and ::/0 lets any IPv4 or IPv6 client with a route reach the listener.
Potential impact
HTTP sends requests and responses in plaintext. The initial request has already been sent when the service redirects it to HTTPS.
Remediation
Configure HTTPS on the application or load balancer and remove unnecessary TCP 80 access. If HTTP is needed, supply the approved source ranges in both variables and test client connectivity.
Examples
Both examples name the group allow_tls, but neither configures TLS. To narrow only the rules on an existing group, keep its group-level description. Changing that field makes Terraform replace the group.
Before
hcl
resource "aws_security_group" "example" {
name = "allow_tls"
description = "HTTP port open"
ingress {
description = "HTTP port open"
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
ipv6_cidr_blocks = ["::/0"]
}
}
After
hcl
resource "aws_security_group" "example" {
name = "allow_tls"
description = "sample"
ingress {
description = "sample"
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = var.approved_ipv4_cidrs
ipv6_cidr_blocks = var.approved_ipv6_cidrs
}
}