1.5.8 Ensure the operating system enables hardening for the BPF JIT

Information

The operating system must enable hardening for the Berkeley Packet Filter Just-in-time compiler.

It is detrimental for operating systems to provide, or install by default, functionality exceeding requirements or mission objectives. These unnecessary capabilities or services are often overlooked and therefore may remain unsecured. They increase the risk to the platform by providing additional attack vectors.

Enabling hardening for the Berkeley Packet Filter (BPF) Just-in-time (JIT) compiler aids in mitigating JIT spraying attacks. Setting the value to "2" enables JIT hardening for all users.

Solution

Set the following parameter in /etc/sysctl.conf or a file in /etc/sysctl.d/ ending in .conf :

- net.core.bpf_jit_harden = 2

Example:

# printf "%s\n" "net.core.bpf_jit_harden = 2" >> /etc/sysctl.d/60-net_core_sysctl.conf

Run the following command to set the active kernel parameter:

# sysctl -w net.core.bpf_jit_harden=2

Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten

See Also

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