Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Rule: EC2 Instances Should Not Have a Public IP Address

This rule ensures EC2 instances do not have a public IP address to enhance security measures.

RuleEC2 instances should not have a public IP address
FrameworkNIST 800-53 Revision 5
Severity
High

Rule Description:

The rule requires that EC2 instances do not have a public IP address. This is in accordance with NIST 800-53 Revision 5 guidelines for securing EC2 instances to minimize the attack surface and potential exposure to external threats.

Public IP addresses assigned to EC2 instances can make them vulnerable to unauthorized access or exploitation by malicious actors. By removing the public IP address, the instances will only be accessible within the private network or via authorized network connections, thereby reducing the potential attack vectors.

Troubleshooting Steps:

If you find EC2 instances with public IP addresses, follow these troubleshooting steps:

  1. 1.

    Identify EC2 instances with public IP addresses:

    • Open the EC2 Management Console.
    • Navigate to "Instances" in the left-hand menu.
    • In the list of instances, check the "Public IP" column to identify instances with public IP addresses.
  2. 2.

    Determine the source of the public IP assignment:

    • Check if the instances were launched with a public IP address.
    • Examine security groups and network access control lists (ACLs) associated with the instances.
    • Review auto-assign IP settings within the subnet configuration.
  3. 3.

    Verify the need for a public IP address:

    • Consult with owners and administrators of the EC2 instances to determine the necessity of public IP addresses for their intended use cases.
    • Evaluate whether alternative solutions, such as using a NAT gateway or a VPN connection, can meet the requirements without exposing the instances directly to the public internet.
  4. 4.

    Remove public IP addresses:

    • If it is determined that the instances do not require public IP addresses, follow the steps below to remove them.

Remediation:

To remove public IP addresses from EC2 instances:

  1. 1.
    Open the EC2 Management Console.
  2. 2.
    Navigate to "Instances" in the left-hand menu.
  3. 3.
    Select the instance that you want to modify.
  4. 4.
    Click on the "Actions" button and choose "Networking" > "Manage IP addresses."
  5. 5.
    In the "IPv4 Public IP" section, select "Disable."
  6. 6.
    Click "Save" to apply the changes.

Alternatively, you can use the AWS Command Line Interface (CLI) with the following command:

aws ec2 modify-address-attribute --public-ip <public_ip_address> --no-allow-reassociation

Replace

<public_ip_address>
with the public IP address of the instance you want to modify.

Note: Disabling a public IP address may interrupt the network connectivity for instances that rely on it. Ensure that any necessary alternative network configurations are in place before making the change.

Additional Considerations:

  1. 1.

    Use Elastic Load Balancers (ELBs): If public access is required for applications hosted on the EC2 instances, consider using an Elastic Load Balancer to expose the service rather than exposing individual instances directly.

  2. 2.

    Network Address Translation (NAT) Gateway: If instances require internet access for updates or outbound traffic, configure a NAT gateway to provide controlled access instead of using public IP addresses.

  3. 3.

    Security Groups and Network ACLs: Review and adjust the inbound and outbound rules in security groups and network ACLs to restrict access to EC2 instances and better control network traffic.

  4. 4.

    Monitoring and Logging: Implement logging and monitoring solutions to detect any attempts to access or exploit EC2 instances. This will help identify and respond to any potential security incidents promptly.

Ensure you follow your organization's change management process and notify the affected owners and administrators before making any modifications to EC2 instances.

Is your System Free of Underlying Vulnerabilities?
Find Out Now