Check provider logo

Security group does not have any port open to a specific public IP address

ec2_securitygroup_allow_ingress_from_internet_to_any_port_from_ip

Severitymedium
Serviceec2
by Prowler

EC2 security groups with inbound rules allowing traffic from specific globally routable IP addresses to any port or protocol. Wildcard CIDRs (0.0.0.0/0 and ::/0) are excluded as they are covered by the related checks. This targets cases where developers add personal or third-party IPs directly to security groups.

Risk

Ingress rules with specific public IPs can become stale when personnel change or access requirements expire. An attacker with compromised AWS credentials could also add narrow IP rules to gain access on any port, bypassing checks that only look for 0.0.0.0/0 or ::/0.

Run this check with Prowler CLI

prowler aws --checks ec2_securitygroup_allow_ingress_from_internet_to_any_port_from_ip

Recommendation

Review all security group rules with specific public IP sources. Remove stale entries for former employees or expired access. Use VPN, AWS Systems Manager Session Manager, or AWS Client VPN instead of direct IP-based access. For third-party integrations, use VPC endpoints or AWS PrivateLink where possible.

Remediation

Native IaC
Terraform
Other
  1. In the AWS Console, go to EC2 > Security Groups
  2. Select the affected security group
  3. Open the Inbound rules tab and click Edit inbound rules
  4. Remove or restrict any rule with a Source that is a public IP address
  5. Click Save rules

Source Code

Resource Type

AwsEc2SecurityGroup

References

Related To

  • ec2_securitygroup_allow_ingress_from_internet_to_all_ports
  • ec2_securitygroup_allow_ingress_from_internet_to_any_port