Linux kernels from 5.7-rc1 prior to 5.13-rc4, 5.12.4, 5.11.21, and 5.10.37 are vulnerable to a bug in the eBPF verifier's verification of ALU32 operations in the scalar32_min_max_and function when performing AND operations, whereby under certain conditions the bounds of a 32 bit register would not be properly updated. This can be abused by attackers to conduct an out of bounds read and write in the Linux kernel and therefore achieve arbitrary code execution as the root user. The target system must be compiled with eBPF support and not have kernel.unprivileged_bpf_disabled set, which prevents unprivileged users from loading eBPF programs into the kernel. Note that if kernel.unprivileged_bpf_disabled is enabled this module can still be utilized to bypass protections such as SELinux, however the user must already be logged as a privileged user such as root.
Linux
x86, x64
To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':
msf > use exploit/linux/local/cve_2021_3490_ebpf_alu32_bounds_check_lpe
msf exploit(cve_2021_3490_ebpf_alu32_bounds_check_lpe) > show targets
...targets...
msf exploit(cve_2021_3490_ebpf_alu32_bounds_check_lpe) > set TARGET < target-id >
msf exploit(cve_2021_3490_ebpf_alu32_bounds_check_lpe) > show options
...show and set options...
msf exploit(cve_2021_3490_ebpf_alu32_bounds_check_lpe) > exploit
Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.
– Jim O’Gorman | President, Offensive Security