Zum Hauptinhalt springen
LIVE Intel Feed
"Not a Pentest" Notice: Remediation guide for your own Windows infrastructure only.
Academy · CVE FeedHIGH · CVSS 7.8 · EXPLOITATION LIKELY

CVE-2025-21420

Windows Disk Cleanup — DLL Planting → Local Privilege Escalation to SYSTEM

Impact: DLL search order hijacking in Windows Disk Cleanup (cleanmgr.exe) enables a local low-privilege attacker to execute arbitrary code as SYSTEM when Disk Cleanup runs with elevated privileges (scheduled task or manual admin execution). Fix: February 2025 Patch Tuesday (KB5051987 / KB5051974).

7.8
CVSS Score
HIGH
Severity
SYSTEM
Privilege gain
KB5051987
Fix KB

Step-by-Step Fix Runbook

1
Verify current patch status — check for February 2025 Patch Tuesday
# Check if February 2025 security update is installed
Get-HotFix | Where-Object {$_.HotFixID -in @("KB5051987","KB5051974","KB5051979")} |
  Select-Object HotFixID, InstalledOn

# Check Windows version:
[System.Environment]::OSVersion.Version
winver

# Affected versions:
# Windows 10 (all supported versions)
# Windows 11 (all supported versions)
# Windows Server 2019, 2022, 2025

# Check Windows Update history for February 2025 cumulative update:
Get-WinEvent -FilterHashtable @{LogName='System'; Id=19} |
  Where-Object {$_.Message -like "*2025-02*"} |
  Select-Object TimeCreated, Message | Select-Object -First 5
2
Apply February 2025 Patch Tuesday update
# Method 1: Windows Update GUI
# Settings > Windows Update > Check for updates

# Method 2: PowerShell with PSWindowsUpdate
Install-Module PSWindowsUpdate -Force -Scope CurrentUser
Get-WindowsUpdate -AcceptAll -Install -AutoReboot

# Method 3: Microsoft Update Catalog
# Download from: https://catalog.update.microsoft.com
# Search KB5051987 (Windows 11 22H2/23H2) or KB5051974 (Windows 10 22H2)

# Method 4: WSUS/SCCM (enterprise)
# Approve February 2025 Patch Tuesday bundle across all affected OS versions

# Verify after restart:
Get-HotFix -Id KB5051987   # Windows 11
# Or:
Get-HotFix -Id KB5051974   # Windows 10 22H2
3
Detect potential DLL planting in Disk Cleanup temp directories
# Check for suspicious DLLs in Disk Cleanup working directories
# Disk Cleanup (cleanmgr.exe) loads DLLs from several locations during elevated execution

# Check for unexpected DLLs in user-writable paths that cleanmgr may search:
$suspiciousPaths = @(
    "$env:TEMP",
    "$env:USERPROFILE",
    "C:\Users\$env:USERNAME",
    "$env:LOCALAPPDATA\Temp"
)

foreach ($path in $suspiciousPaths) {
    Get-ChildItem -Path $path -Filter "*.dll" -ErrorAction SilentlyContinue |
        Where-Object {$_.LastWriteTime -gt (Get-Date).AddDays(-30)} |
        Select-Object FullName, LastWriteTime, Length
}

# Check for DLLs with names matching known Windows system DLLs in non-system paths:
$systemDlls = @("shell32.dll","ole32.dll","comctl32.dll","advapi32.dll")
foreach ($dll in $systemDlls) {
    Get-ChildItem -Path $env:TEMP -Filter $dll -ErrorAction SilentlyContinue |
        Select-Object FullName, LastWriteTime
}
4
Restrict Disk Cleanup execution and temp directory permissions
# Harden: restrict write access to directories cleanmgr.exe searches during elevation
# Note: patch is the primary fix — these are defense-in-depth measures

# Monitor cleanmgr.exe execution for suspicious behavior:
# Enable Process Creation auditing:
auditpol /set /subcategory:"Process Creation" /success:enable /failure:enable

# Create AppLocker/WDAC rule to log (not block) cleanmgr.exe child process creation:
# Policy: alert if cleanmgr.exe spawns any process other than sageset/sagerun helpers

# Check if any scheduled tasks run Disk Cleanup in elevated context:
Get-ScheduledTask | Where-Object {$_.Actions.Execute -like "*cleanmgr*"} |
  Select-Object TaskName, TaskPath

# Disable Disk Cleanup scheduled task if not needed (reduces attack surface):
Get-ScheduledTask -TaskName "StartComponentCleanup" -ErrorAction SilentlyContinue |
  Disable-ScheduledTask
5
Monitor for privilege escalation indicators post-exploitation
# Detect SYSTEM token acquisition by processes spawned from Disk Cleanup context
Get-WinEvent -FilterHashtable @{
    LogName = 'Security'
    Id = 4688              # Process creation
    StartTime = (Get-Date).AddDays(-7)
} | Where-Object {
    $_.Message -match "cleanmgr.exe" -and
    $_.Message -match "S-1-5-18"    # SYSTEM SID
} | Select-Object TimeCreated, Message | Format-List

# Check Security log for privilege escalation (token manipulation):
Get-WinEvent -FilterHashtable @{
    LogName = 'Security'
    Id = 4672              # Special privileges assigned to new logon
    StartTime = (Get-Date).AddDays(-7)
} | Where-Object {
    $_.Message -match "SeTcbPrivilege"  # OS-level privilege — indicates SYSTEM
} | Select-Object TimeCreated, Message | Select-Object -First 20

Frequently Asked Questions

What is DLL search order hijacking and how does it relate to Disk Cleanup?

DLL search order hijacking exploits how Windows searches for DLL files when an executable loads them. Windows searches directories in this order: 1) Directory of the executable itself. 2) System directory (C:\Windows\System32). 3) Windows directory (C:\Windows). 4) Current working directory. 5) Directories in the PATH environment variable. The vulnerability: Disk Cleanup (cleanmgr.exe) runs with elevated privileges (SYSTEM) as part of its cleanup functionality. If an attacker can place a malicious DLL with the right name in a directory that cleanmgr.exe searches before the legitimate DLL location — and that directory is writable by a low-privilege user — the malicious DLL executes with SYSTEM privileges. CVE-2025-21420 represents a specific instance where this pattern was present and exploitable in the Disk Cleanup component.

Does this affect all Windows installations or only specific configurations?

CVE-2025-21420 affects all supported Windows versions (Windows 10, Windows 11, Windows Server 2019/2022/2025) prior to the February 2025 Patch Tuesday update. The attack requires: 1) Local access — the attacker must already have a foothold as a low-privilege user on the system. 2) Triggering Disk Cleanup with elevated privileges — this can happen via the scheduled task 'StartComponentCleanup' or when an admin runs Disk Cleanup manually. Environments at higher risk: multi-user Windows systems (Terminal Services, RDS, shared workstations), systems where the Disk Cleanup scheduled task is active, organizations that haven't deployed the February 2025 cumulative update.

Is this vulnerability being actively exploited?

As of April 2026, Microsoft classified CVE-2025-21420 as 'Exploitation More Likely' in the February 2025 advisory — not 'Exploitation Detected' (unlike CVE-2025-29824 which had confirmed exploitation). DLL planting vulnerabilities in Windows components are attractive targets for: post-exploitation privilege escalation (after gaining initial foothold), persistence mechanisms (planting the DLL persists across reboots as long as cleanmgr.exe is triggered), fileless-adjacent attacks (DLL is the only artifact — process is legitimate Windows binary). The relatively low complexity of DLL planting exploits means weaponization by threat actors is expected. Patching remains the definitive remediation.

How do I check if Disk Cleanup is running as SYSTEM on my systems?

Check scheduled tasks that run Disk Cleanup with elevated privileges: Get-ScheduledTask | Where-Object {$_.Actions.Execute -like '*cleanmgr*'} — look at the 'RunAs' field. The 'StartComponentCleanup' task under \Microsoft\Windows\Servicing runs as SYSTEM. Additionally, check if any of your management tools, scripts, or GPOs trigger Disk Cleanup with elevated privileges. Detection via Sysmon: EventID 1 (Process Create) with Image=cleanmgr.exe, User=SYSTEM or IntegrityLevel=System. If cleanmgr.exe runs as SYSTEM and loads a DLL from a user-writable directory, the vulnerability is exploitable. Patching eliminates the vulnerable DLL loading behavior.

Further Resources

🔒 Quantum-Resistant Mycelium Architecture
🛡️ Kuratierte Runbooks – EU-gehostet in Frankfurt
🌐 Zero Known Breaches – Powered by Living Intelligence
🏛️ DSGVO Art. 25 & 32 • SOC 2 & ISO 27001 in Vorbereitung
⚡ Real-Time Global Mycelium Network – 347 Bedrohungen in 60 Minuten
🧬 Trusted by SecOps Leaders worldwide