{"description": "To set the runtime status of the <code>net.core.bpf_jit_harden</code> kernel parameter, run the following command: <pre>$ sudo sysctl -w net.core.bpf_jit_harden=2</pre>\nTo make sure that the setting is persistent, add the following line to a file in the directory <tt>/etc/sysctl.d</tt>: <pre>net.core.bpf_jit_harden = 2</pre>", "rationale": "When hardened, the extended Berkeley Packet Filter just-in-time compiler\nwill randomize any kernel addresses in the BPF programs and maps,\nand will not expose the JIT addresses in <tt>/proc/kallsyms</tt>.", "severity": "medium", "references": {"nist": ["CM-6", "SC-7(10)"], "srg": ["SRG-OS-000480-GPOS-00227"], "anssi": ["R12"], "ism": ["1409"]}, "control_references": {"anssi": ["R12"], "ism": ["1409"]}, "components": [], "identifiers": {}, "ocil_clause": "the correct value is not returned", "ocil": "The runtime status of the <code>net.core.bpf_jit_harden</code> kernel parameter can be queried\nby running the following command:\n<pre>$ sysctl net.core.bpf_jit_harden</pre>\n<code>2</code>.\n", "oval_external_content": null, "fixtext": "Configure Ubuntu 22.04  to enable hardening for the BPF JIT compiler.\nAdd or edit the following line in a system configuration file in the \"/etc/sysctl.d/\" directory:\nnet.core.bpf_jit_harden = 2\n\nLoad settings from all system configuration files with the following command:\n\n$ sudo sysctl --system", "checktext": "", "vuldiscussion": "", "srg_requirement": "Ubuntu 22.04 must enable hardening for the Berkeley Packet Filter Just-in-time compiler.", "warnings": [], "conflicts": [], "requires": [], "policy_specific_content": {"stig": {"srg_requirement": "Ubuntu 22.04 must enable hardening for the Berkeley Packet Filter just-in-time compiler.", "vuldiscussion": "When hardened, the extended Berkeley Packet Filter (BPF) just-in-time (JIT) compiler will randomize any kernel addresses in the BPF programs and maps, and will not expose the JIT addresses in \"/proc/kallsyms\".", "checktext": "Verify Ubuntu 22.04 enables hardening for the BPF JIT with the following commands:\n\n$ sudo sysctl net.core.bpf_jit_harden\n\nnet.core.bpf_jit_harden = 2\n\nIf the returned line does not have a value of \"2\", or a line is not returned, this is a finding.\n\nCheck that the configuration files are present to enable this kernel parameter.\n\n$ sudo /usr/lib/systemd/systemd-sysctl --cat-config | egrep -v '^(#|;)' | grep -F net.core.bpf_jit_harden | tail -1\n\nnet.core.bpf_jit_harden = 2\n\nIf the network parameter \"net.core.bpf_jit_harden\" is not equal to \"2\" or nothing is returned, this is a finding.", "fixtext": "Configure Ubuntu 22.04 to enable hardening for the BPF JIT compiler by adding the following line to a file, in the \"/etc/sysctl.d\" directory:\n\nnet.core.bpf_jit_harden = 2\n\nThe system configuration files need to be reloaded for the changes to take effect. To reload the contents of the files, run the following command:\n\n$ sudo sysctl --system"}}, "platform": "system_with_kernel", "platforms": ["system_with_kernel"], "sce_metadata": {"check-import": "stdout", "platform": ["multi_platform_all"], "environment": "any", "filename": "sysctl_net_core_bpf_jit_harden.sh", "relative_path": "ubuntu2204/checks/sce/sysctl_net_core_bpf_jit_harden.sh"}, "inherited_platforms": [], "cpe_platform_names": ["system_with_kernel"], "inherited_cpe_platform_names": [], "bash_conditional": null, "fixes": {}, "title": "Harden the operation of the BPF just-in-time compiler", "definition_location": "/aptdata/openscap/scap-security-guide/linux_os/guide/system/permissions/restrictions/sysctl_net_core_bpf_jit_harden/rule.yml", "template": {"name": "sysctl", "vars": {"sysctlvar": "net.core.bpf_jit_harden", "sysctlval": "2", "datatype": "int"}, "backends": {}}}