
Module PowerShell de réponse à l'incident CVE-2025-59287 — WSUS Remote Code Execution (RCE)
Versão: 1.0.1
Autor: RZA / IT Operations
Licença: MIT
O módulo WSUSResponder fornece um conjunto de ferramentas PowerShell para responder rapidamente à vulnerabilidade crítica CVE-2025-59287, uma falha de execução remota de código (RCE) que afeta o Windows Server Update Services (WSUS).
Ele permite:
| Módulo | Função | Instalação |
|---|
| ActiveDirectory | Descoberta automática de servidores via AD | Add-WindowsCapability -Online -Name 'Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0' |
| ImportExcel | Geração de relatórios Excel (.xlsx) | Install-Module ImportExcel -Scope CurrentUser |
Enable-PSRemoting)WSUSResponder em um dos seus diretórios de módulos PowerShell:
$Path = "$env:USERPROFILE\Documents\WindowsPowerShell\Modules\WSUSResponder"
New-Item -ItemType Directory -Path $Path -Force
WSUSResponder.psm1WSUSResponder.psd1Import-Module WSUSResponder
Get-Command -Module WSUSResponder
Get-Module WSUSResponder -ListAvailable
| Função | Descrição |
|---|---|
Get-WSUSCveStatus | Escaneia os servidores para detectar a presença do papel WSUS e dos patches OOB. |
Set-WSUSCveWorkaround | Aplica o workaround (regras de firewall bloqueando as portas 8530/8531). |
Remove-WSUSCveWorkaround | Remove as regras de firewall criadas pelo workaround. |
Export-WSUSCveReport | Exporta os resultados do scan em vários formatos (CSV, JSON, XLSX, TXT). |
$ReportPath = "C:\Temp\WSUS_Audit_$(Get-Date -Format yyyyMMdd)"
Get-WSUSCveStatus -FromAD -UsePS7Parallel | Export-WSUSCveReport -ExportPath $ReportPath
$scanResults = Get-WSUSCveStatus -FromAD -UsePS7Parallel
$vulnerable = $scanResults | Where-Object { $_.IsWSUS -and -not $_.IsPatched -and $_.Reachable }
$vulnerable | Set-WSUSCveWorkaround -PassThru
$scanResults | Export-WSUSCveReport -ExportPath "C:\Temp\WSUS_Mitig_$(Get-Date -Format yyyyMMdd)"
Remove-WSUSCveWorkaround -ComputerName 'srv-wsus-01','srv-wsus-02'
Os relatórios são salvos na pasta definida por -ExportPath:
| Arquivo | Formato | Conteúdo |
|---|---|---|
WSUS_CVE59287_Report.csv | CSV | Resultados completos do scan |
WSUS_CVE59287_Report.json | JSON | Exportação estruturada para API/automação |
WSUS_CVE59287_Report.xlsx | XLSX | Relatório formatado com filtros automáticos |
Vulnerable_Hosts.txt | TXT | Lista simples dos hosts vulneráveis |
Invoke-Command e WinRM para execução remotaForEach-Object -Parallel) para acelerar os pré-testes-OperationTimeoutSecSe a sua política de execução for AllSigned, você pode assinar o módulo:
New-SelfSignedCertificate -Type CodeSigning -Subject "CN=IT Operations" -CertStoreLocation Cert:\CurrentUser\My
$cert = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert | Select-Object -First 1
Set-AuthenticodeSignature -FilePath "C:\Modules\WSUSResponder\WSUSResponder.psm1" -Certificate $cert
Set-AuthenticodeSignature -FilePath "C:\Modules\WSUSResponder\WSUSResponder.psd1" -Certificate $cert
-UsePS7Parallel)Distribuído sob licença MIT.
© 2025 RZA / IT Operations – Todos os direitos reservados.