0x00 介绍
DirtyPipe (CVE-2022-0847) 是自 5.8 以来 Linux 内核中的一个漏洞,它允许覆盖任意只读文件中的数据。
其要求内核是5.8以上的才能利用
相关链接:
原文地址:https://dirtypipe.cm4all.com/
准备
创建一个低权限用户
我的环境是docker里面
uname -a
Linux ae801d08733b 5.10.76-linuxkit #1 SMP Mon Nov 8 10:21:19 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
0x02 复现
https://github.com/Arinerron/CVE-2022-0847-DirtyPipe-Exploit.git
gcc exploit.c -o exp -std=c99
./exp
编译报错如下图,要加上上 std=c99
gcc exploit.c -o exp -std=c99
备份密码文件
cp /etc/passwd /tmp/passwd