CVE-2023-32233: Linux 内核中的安全漏洞
The instructions below were tested under Ubuntu 23.04 (Lunar Lobster).
Run the following command to install the build dependencies:
sudo apt install gcc libmnl-dev libnftnl-devRun the following command to build the PoC binary:
gcc -Wall -o exploit exploit.c -lmnl -lnftnlBuilt-in profile contains parameters specific to the Linux kernel distributed in binary form as the following packages from Ubuntu 23.04 (Lunar Lobster):
The built-in profile looks like this:
…Optional steps to override the built-in profile when testing with other Linux kernels:
modprobe nf_tables
egrep ' (nft_counter_ops|nft_counter_destroy|free_percpu|modprobe_path)(\s|$)' /proc/kallsyms > profileIn order to find the kernel base we examine the nf_tables.ko image in the
kernel memory. And specifically, we analyse the machine code of
nft_counter_destroy() subroutine. This means that our method is sensitive to
the compiler as well as the compilation options. However, all the usual cases
can be handled by overriding the built-in profile.
For example, the machine code of nft_counter_destroy() subroutine may look like this:
000000000001e310 :
1e310: f3 0f 1e fa endbr64
1e314: 48 8b 7e 08 mov rdi,QWORD PTR [rsi+0x8]
1e318: e9 00 00 00 00 jmp
1e31d: 0f 1f 00 nop DWORD PTR [rax]In the above case we can specify a few parameters by appending the three lines below to the configuration file "profile".
First, we redefine the offset of the dword preceding the free_percpu
displacement:
5 nft_counter_destroy_call_offset # hexwhere the value 5 was computed using the expression (1e31d - 1e310) - 8.
As a sanity check, we then validate the dword at the above offset using the following mask:
ffffffff nft_counter_destroy_call_mask # hexexpecting the following value:
e9087e8b nft_counter_destroy_call_check # hexExploiting the vulnerability requires winning a race with background worker thread from the Linux kernel. The built-in profile has been tuned to maximise the chance of winning that race on a broad range of Intel microprocessors including mobile Sandy Bridge and desktop Comet Lake. However, some microprocessors require additional tuning. For example, we observed increased latency to switch tasks under Alder Lake in certain setups, where it may be necessary to append the following line to "profile":
400 race_lead_sleepWe measured probability of 80% or better to successfully exploit the vulnerability in our tests that used idle bare-metal systems.
Once the PoC is started on a vulnerable system, it may leave that system in an unstable state with corrupted kernel memory. We strongly recommend to test the PoC on a dedicated system to avoid potential data corruptions.
暂无开放 Issues,或尚未同步最近议题。