Overview
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.
Rationale
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.
Remediation guidance
Using Console
- Go to the
Compute Engine - Go to
VM Instances - Select the
VM Instance. - Click
Deletebutton.
**Via CLI gcloud **
gcloud compute instances delete ``
As you can only set the canIpForward field at instance creation time. After an instance is created, the field becomes read-only. Therefore delete the VM instance where canIpForward is set to true.
And create a new VM Instance with IP forwarding is set to Off
- Go to
Compute Engine - Click the
Create instancebutton. - Click Management, disk, networking, SSH keys.
- Click
Networking. - Click on the specific
Network interfaces - Ensure
IP forwardingis set tooff. - Specify any other instance parameters you desire.
- Click Create.
Impact
Deleting instance(s) acting as routers/packet forwarders may break the network connectivity.
References
- https://cloud.google.com/compute/docs/networking#canipforward
Notes
You can only set the canIpForward field at instance creation time. After an instance is created, the field becomes read-only.
Service-wide remediation
Recommended when many resources are affected: fix the platform baseline first so new resources inherit the secure setting, then remediate the existing flagged resources in batches.
Google Cloud
Use organization or folder policies where available, shared project templates, logs and alerting baselines, and IaC modules so new resources inherit the secure setting.
Operational rollout
- Fix the baseline first at the account, subscription, project, cluster, or tenant scope that owns this control.
- Remediate the currently affected resources in batches, starting with internet-exposed and production assets.
- Re-scan and track approved exceptions with an owner and expiry date.
Query logic
These are the stored checks tied to this control.
IP forwarding is not enabled on Instances
Connectors
Covered asset types
Expected check: eq []
vms(where:{canIPForward:true}){...AssetFragment}
Google Cloud