4.6 Ensure That IP Forwarding Is Not Enabled on Instances

Information

Compute Engine instance cannot forward a packet unless the source IP address of the packet matches the IP address of the instance. Similarly, GCP won't deliver a packet whose destination IP address is different than the IP address of the instance receiving the packet. However, both capabilities are required if you want to use instances to help route packets.

Forwarding of data packets should be disabled to prevent data loss or information disclosure.

Compute Engine instance cannot forward a packet unless the source IP address of the packet matches the IP address of the instance. Similarly, GCP won't deliver a packet whose destination IP address is different than the IP address of the instance receiving the packet. However, both capabilities are required if you want to use instances to help route packets.To enable this source and destination IP check, disable the canIpForward field, which allows an instance to send and receive packets with non-matching destination or source IPs.

Solution

You only edit the canIpForward setting at instance creation or using CLI.

From Google Cloud CLI

- Use the instances export command to export the existing instance properties:

gcloud compute instances export <INSTANCE_NAME> \\
--project <PROJECT_ID> \\
--zone <ZONE> \\
--destination=<FILE_PATH>

Note Replace the following:

INSTANCE_NAME the name for the instance that you want to export.

PROJECT_ID: the project ID for this request.

ZONE: the zone for this instance.

FILE_PATH: the output path where you want to save the instance configuration file on your local workstation.

<xhtml:ol start="2"> - Use a text editor to modify this file

Replace

canIpForward: true

with

canIpForward: false

<xhtml:ol start="3"> - Run this command to import the file you just modified

gcloud compute instances update-from-file INSTANCE_NAME \\
--project PROJECT_ID \\
--zone ZONE \\
--source=FILE_PATH \\
--most-disruptive-allowed-action=REFRESH

If the update request is valid and the required resources are available, the instance update process begins. You can monitor the status of this operation by viewing the audit logs.

This update requires only a REFRESH not a full restart.

See Also

https://workbench.cisecurity.org/benchmarks/17308

Item Details

Category: SECURITY ASSESSMENT AND AUTHORIZATION, SYSTEM AND COMMUNICATIONS PROTECTION

References: 800-53|CA-9, 800-53|SC-7, 800-53|SC-7(5), CSCv7|11.1, CSCv7|11.2

Plugin: GCP

Control ID: 8f216b265a24b39e1117b360813e01665bb2276972a9c7b0339ebb9638386410