1.5.21 Ensure the operating system prevents privilege escalation through the kernel by disabling access to the bpf syscall

Information

The operating system must disable access to network bpf syscall from unprivileged processes.

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.

Solution

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

- kernel.unprivileged_bpf_disabled = 1

Example:

# printf '\n%s' "kernel.unprivileged_bpf_disabled = 1" >> /etc/sysctl.d/60-kernel_sysctl.conf

Run the following command to set the active kernel parameter:

# sysctl -w kernel.unprivileged_bpf_disabled=1

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