3.3.1.13 Ensure net.ipv4.conf.default.rp_filter is configured

Information

net.ipv4.conf.default.rp_filter controls reverse path filtering for IPv4 traffic on newly added network interfaces.

Reverse path filtering is a security mechanism in Linux that helps prevent IP spoofing and other network attacks. When enabled, it checks if the source IP address of an incoming packet is reachable through the same network interface it was received on. If the packet's source address is not reachable through the interface it arrived on, the packet is dropped.

More information about the kernel parameter configuration files, their location, and load preference is available in the "Configure Network Kernel Parameters" section overview.

Note: If this system is a router, and uses asymmetrical routing, this recommendation is not applicable.

Setting net.ipv4.conf.default.rp_filter to 1 is a good way to deter attackers from sending your system bogus packets that cannot be responded to. One instance where this feature breaks down is if asymmetrical routing is employed. This would occur when using dynamic routing protocols (bgp, ospf, etc) on your system. If you are using asymmetrical routing on your system, you will not be able to enable this feature without breaking the routing.

Solution

- Run the following command to comment out net.ipv4.conf.default.rp_filter lines returned by the audit procedure that are not net.ipv4.conf.default.rp_filter = 1 :

# sed -ri '^\s*net.ipv4.conf.default.rp_filter\s*=\s*[0,2,3]/s/^/#/g' "path/to/file/in/audit/filename"

Example:

# sed -ri '/^\s*net.ipv4.conf.default.rp_filter\s*=\s*[0,2,3]/s/^/#/g' /etc/sysctl.d/99-sysctl.conf
- Create or edit a file in the /etc/sysctl.d/ directory ending in .conf and edit or add the following line:

net.ipv4.conf.default.rp_filter = 1

Example:

# [ ! -d "/etc/sysctl.d/" ] && mkdir -p /etc/sysctl.d/
# printf '%s\n' "" "net.ipv4.conf.default.rp_filter = 1" >> /etc/sysctl.d/60-ipv4_sysctl.conf
- Run the following command to load all sysctl configuration files:

# sysctl --system

Impact:

If you are using asymmetrical routing on your system, you will not be able to enable this feature without breaking the routing.

See Also

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

Item Details

Category: CONFIGURATION MANAGEMENT

References: 800-53|CM-6b., CCI|CCI-000366, CSCv7|9.2, Rule-ID|SV-257965r991589_rule, Rule-ID|SV-269255r1050137_rule, Rule-ID|SV-271871r1092325_rule

Plugin: Unix

Control ID: ddf4370f2929eb5628860a10846cf273979e9ae8b0930acb1fc64fdc2a6273b1