CVE-2025-21420 — Windows Disk Cleanup Tool Elevation of Privilege Vulnerability
Executive Summary
None
Overview
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C
EPSS Score
Affected Products
| Product | KB Article | Severity | Impact | Restart Required |
|---|---|---|---|---|
| Windows 10 for 32-bit Systems | 5052040 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 for x64-based Systems | 5052040 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 1607 for 32-bit Systems | 5052006 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 1607 for x64-based Systems | 5052006 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 1809 for 32-bit Systems | 5052000 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 1809 for x64-based Systems | 5052000 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 21H2 for 32-bit Systems | 5051974 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 21H2 for ARM64-based Systems | 5051974 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 21H2 for x64-based Systems | 5051974 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 22H2 for 32-bit Systems | 5051974 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 22H2 for ARM64-based Systems | 5051974 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 22H2 for x64-based Systems | 5051974 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 Version 22H2 for ARM64-based Systems | 5051989 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 Version 22H2 for x64-based Systems | 5051989 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 Version 23H2 for ARM64-based Systems | 5051989 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 Version 23H2 for x64-based Systems | 5051989 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 Version 24H2 for ARM64-based Systems 5051987 (Security Update) 5052105 (SecurityHotpatchUpdate) Important Elevation of Privilege 5050009 Base: 7.8 Temporal: 6.8 Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 10.0.26100.3194 10.0.26100.3107 Yes None Windows 11 Version 24H2 for x64-based Systems 5051987 (Security Update) 5052105 (SecurityHotpatchUpdate) Important Elevation of Privilege 5050009 Base: 7.8 Temporal: 6.8 Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 10.0.26100.3194 10.0.26100.3107 Yes None Windows Server 2012 | 5052020 (Monthly Rollup) |
Important | Elevation of Privilege | Yes |
| Windows Server 2012 (Server Core installation) | 5052020 (Monthly Rollup) |
Important | Elevation of Privilege | Yes |
| Windows Server 2012 R2 | 5052042 (Monthly Rollup) |
Important | Elevation of Privilege | Yes |
| Windows Server 2012 R2 (Server Core installation) | 5052042 (Monthly Rollup) |
Important | Elevation of Privilege | Yes |
| Windows Server 2016 | 5052006 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2016 (Server Core installation) | 5052006 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2019 | 5052000 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2019 (Server Core installation) | 5052000 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2022 5051979 (Security Update) 5052106 (SecurityHotpatchUpdate) Important Elevation of Privilege 5049983 Base: 7.8 Temporal: 6.8 Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 10.0.20348.3207 10.0.20348.3148 Yes None Windows Server 2022 (Server Core installation) 5051979 (Security Update) 5052106 (SecurityHotpatchUpdate) Important Elevation of Privilege 5049983 Base: 7.8 Temporal: 6.8 Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 10.0.20348.3207 10.0.20348.3148 Yes None Windows Server 2022, 23H2 Edition (Server Core installation) | 5051980 (Security Update) |
Important | Elevation of Privilege | Yes |
Patches
| Article | Type | Restart |
|---|---|---|
5052040 |
Security Update | Yes |
5052006 |
Security Update | Yes |
5052000 |
Security Update | Yes |
5051974 |
Security Update | Yes |
5051989 |
Security Update | Yes |
5052020 |
Monthly Rollup | Yes |
5052042 |
Monthly Rollup | Yes |
5051980 |
Security Update | Yes |
Patch Diff
cleanmgr.exe (run by the privileged SilentCleanup task) gains a SetProcessMitigationPolicy(ProcessRedirectionTrustPolicy=0x10) call in WinMainT, enabling Redirection Guard so the kernel refuses to follow attacker-planted junctions during cleanup. This severs the arbitrary folder-contents-delete -> C:\Config.msi -> SYSTEM EoP primitive (CWE-59 link following). Gated behind WIL CFR Feature_3318489400; the call hard-fails the process if the policy cannot be applied. The import itself is absent from the vulnerable 1882 build.
| Function | Address | Change | Note |
|---|---|---|---|
__GSHandlerCheck |
1400122e4 -> 140016034 |
refcount, address | similarity 1.0 |
wil::details::unique_storage<struct_wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::CloseHandle(void*___ptr64),struct_wistd::integral_constant<unsigned___int64,0>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>::~unique_storage<struct_wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::CloseHandle(void*___ptr64),struct_wistd::integral_constant<unsigned___int64,0>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_> |
1400038d8 -> 140003a44 |
refcount, address, calling | similarity 1.0 |
wil::details_abi::SemaphoreValue::CreateFromValueInternal |
140003c1c -> 140003d4c |
refcount, address, calling, called | similarity 0.98 |
wil::details::WilFailureNotifyWatchers |
140005afc -> 140005c7c |
code, length, address | similarity 0.89 |
wil::details::unique_storage<struct_wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::CloseHandle(void*___ptr64),struct_wistd::integral_constant<unsigned___int64,0>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>::reset |
140005c78 -> 140005e00 |
refcount, address, calling | similarity 1.0 |
wil::mutex_t<class_wil::details::unique_storage<struct_wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::CloseHandle(void*___ptr64),struct_wistd::integral_constant<unsigned___int64,0>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>,struct_wil::err_returncode_policy>::acquire |
140005ba0 -> 140005d28 |
refcount, address, calling | similarity 1.0 |
wil::details::GetLastErrorFailHr |
1400042b8 -> 140004428 |
refcount, address, calling | similarity 1.0 |
operator_delete |
140005dc4 -> 140006620 |
refcount, address, calling | similarity 1.0 |
wil::details::in1diag3::FailFast_Unexpected |
140003d44 -> 140003e9c |
code, length, address | similarity 0.86 |
wil::last_error_context::last_error_context |
140003738 -> 140003834 |
refcount, address, calling | similarity 1.0 |
MSVCRT.DLL::memcpy_s |
EXTERNAL:00000028 -> EXTERNAL:0000002b |
refcount, address, calling | similarity 1.0 |
API-MS-WIN-CORE-SYNCH-L1-1-0.DLL::AcquireSRWLockExclusive |
EXTERNAL:00000074 -> EXTERNAL:00000070 |
refcount, address, calling | similarity 1.0 |
atexit |
140002920 -> 140002a20 |
refcount, address, calling | similarity 1.0 |
API-MS-WIN-CORE-HEAP-L1-1-0.DLL::HeapFree |
EXTERNAL:0000005c -> EXTERNAL:0000005d |
refcount, address, calling | similarity 1.0 |
wil::TraceLoggingProvider::Initialize |
140008890 -> 14000a020 |
refcount, address | similarity 1.0 |
StringCchPrintfW |
14000570c -> 14000581c |
refcount, address, calling | similarity 1.0 |
API-MS-WIN-CORE-PROCESSTHREADS-L1-1-0.DLL::GetCurrentProcessId |
EXTERNAL:00000058 -> EXTERNAL:00000056 |
refcount, address, calling | similarity 1.0 |
wil::details::in1diag3::Return_Hr |
140005358 -> 140005418 |
refcount, address, calling | similarity 1.0 |
wil::details_abi::ProcessLocalStorage<struct_wil::details_abi::ProcessLocalData>::~ProcessLocalStorage<struct_wil::details_abi::ProcessLocalData> |
140003764 -> 140003860 |
code, length, address, called | similarity 0.2 |
_purecall |
1400071c0 -> 14000a660 |
refcount, address | similarity 1.0 |
API-MS-WIN-CORE-HEAP-L1-1-0.DLL::GetProcessHeap |
EXTERNAL:0000005a -> EXTERNAL:0000005e |
refcount, address, calling | similarity 1.0 |
WinMainT |
140006614 -> 14000955c |
code, length, address, called | similarity 0.25 |
wil::details_abi::ProcessLocalStorageData<struct_wil::details_abi::ProcessLocalData>::Acquire |
140003964 -> 140003ad0 |
code, length, address, called | similarity 0.63 |
wil::details::FreeProcessHeap |
140003dc0 -> 140003f30 |
refcount, address, calling | similarity 0.9 |
wil::details::ProcessHeapAlloc |
140004f78 -> 1400050e8 |
refcount, address, calling | similarity 1.0 |
wil::details_abi::SemaphoreValue::~SemaphoreValue |
140003918 -> 140003a84 |
refcount, address, calling | similarity 1.0 |
wil::details::unique_storage<struct_wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::ReleaseMutex(void*___ptr64),struct_wistd::integral_constant<unsigned___int64,2>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_>::~unique_storage<struct_wil::details::resource_policy<void*___ptr64,void_(__cdecl*)(void*___ptr64)_noexcept,&void___cdecl_wil::details::ReleaseMutex(void*___ptr64),struct_wistd::integral_constant<unsigned___int64,2>,void*___ptr64,void*___ptr64,0,std::nullptr_t>_> |
1400038f8 -> 140003a64 |
refcount, address, calling | similarity 1.0 |
USER32.DLL::LoadIconW |
EXTERNAL:00000016 |
refcount, calling | similarity 1.0 |
wil::details::ReportFailure_Hr<3> |
1400032f8 -> 1400033f8 |
code, refcount, length, address, calling | similarity 0.84 |
wil_details_GetNtDllProcedureAddress |
140005d60 -> 140005f44 |
refcount, address, calling | similarity 0.91 |
wil::last_error_context::~last_error_context |
140003940 -> 140003aac |
refcount, address, calling | similarity 1.0 |
__security_check_cookie |
1400123c0 -> 140016110 |
refcount, address, calling | similarity 1.0 |
wil::details::`dynamic_initializer_for_'g_header_init_WilInitialize_ResultMacros_DesktopOrSystem'' |
1400024d0 |
code, length | similarity 0.95 |
memset |
140012376 -> 1400160d2 |
refcount, address, calling | similarity 0.89 |
API-MS-WIN-CORE-SYNCH-L1-1-0.DLL::CreateMutexExW |
EXTERNAL:00000077 -> EXTERNAL:0000007b |
refcount, address, calling | similarity 1.0 |
wil::details::unique_storage<struct_wil::details::resource_policy<struct__RTL_SRWLOCK*___ptr64,void_(__cdecl*)(struct__RTL_SRWLOCK*___ptr64),&void___cdecl_ReleaseSRWLockExclusive(struct__RTL_SRWLOCK*___ptr64),struct_wistd::integral_constant<unsigned___int64,1>,struct__RTL_SRWLOCK*___ptr64,struct__RTL_SRWLOCK*___ptr64,0,std::nullptr_t>_>::~unique_storage<struct_wil::details::resource_policy<struct__RTL_SRWLOCK*___ptr64,void_(__cdecl*)(struct__RTL_SRWLOCK*___ptr64),&void___cdecl_ReleaseSRWLockExclusive(struct__RTL_SRWLOCK*___ptr64),struct_wistd::integral_constant<unsigned___int64,1>,struct__RTL_SRWLOCK*___ptr64,struct__RTL_SRWLOCK*___ptr64,0,std::nullptr_t>_> |
140009a20 -> 14000635c |
refcount, address, calling | similarity 1.0 |
__chkstk |
140012480 -> 1400161d0 |
refcount, address, calling | similarity 1.0 |
_guard_dispatch_icall$thunk$10345483385596137414 |
140013010 -> 140017010 |
refcount, address, calling | similarity 0.89 |
wil_details_GetKernelBaseProcAddress |
140005ccc -> 140005ea8 |
code, refcount, length, address, calling | similarity 0.94 |
wistd::__throw_bad_function_call |
140005b74 -> 140005cfc |
name, fullname, refcount, sig, address, calling, parent | similarity 1.0 |
wil::details_abi::SemaphoreValue::TryGetPointer |
140005818 -> 140005928 |
code, name, fullname, refcount, length, sig, address, calling, called | similarity 0.15 |
wil::details::FeatureImpl<struct___WilFeatureTraits_Feature_3318489400>::__private_IsEnabled |
1400071e8 -> 140009fe4 |
code, name, fullname, refcount, length, sig, address, calling, called, parent | similarity 0.29 |
Root Cause Analysis
CVE-2025-21420 — Windows Disk Cleanup Tool (cleanmgr.exe) EoP via Junction Abuse (Missing Redirection Guard)
Summary
| Product | Microsoft Windows — cleanmgr.exe (Disk Cleanup) |
|---|---|
| Vendor | Microsoft Corporation |
| Severity | Important (CVSS 7.8) |
| Affected Versions | Windows 10 21H2+, Windows 11 22H2/23H2/24H2, Windows Server 2022+ |
| Tested Version | Windows 10.0.26100.1882 (pre-patch) vs 10.0.26100.3194 (post-patch) |
| Impact | Elevation of Privilege — Arbitrary file/folder deletion as SYSTEM |
| CVE ID | CVE-2025-21420 |
| CWE | CWE-59: Improper Link Resolution Before File Access (‘Link Following’) |
| PoC Available | Yes (trigger PoC — demonstrates the junction-following behavior) |
| Exploit Available | Public exploitation techniques known for SilentCleanup abuse |
| Patch Available | Yes |
| Patch Date | February 2025 — KB5051987 |
| Exploitation Maturity | Exploitation More Likely |
CVSS 3.1 Scoring
Base Score: 7.8 (HIGH)
Vector String: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
| Metric | Value | Rationale |
|---|---|---|
| Attack Vector (AV) | Local | Requires local authenticated session |
| Attack Complexity (AC) | Low | Standard junction creation; no race conditions |
| Privileges Required (PR) | Low | Standard user account; no admin rights needed |
| User Interaction (UI) | None | SilentCleanup runs automatically or can be triggered |
| Confidentiality (C) | High | Can delete security-critical files |
| Integrity (I) | High | Arbitrary file/folder deletion as SYSTEM |
| Availability (A) | High | Can delete critical system files causing instability |
Product Description
cleanmgr.exe is the Windows Disk Cleanup utility. It is invoked by the SilentCleanup scheduled task, which runs with highest available privileges (SYSTEM when triggered by the Task Scheduler). The SilentCleanup task is designed to run automatically and can also be triggered by any standard user via schtasks /run /tn "\Microsoft\Windows\DiskCleanup\SilentCleanup".
When cleanmgr.exe runs elevated, it enumerates cleanup clients (registered COM objects that implement IEmptyVolumeCache), each of which specifies directories to clean. The purgeClients function iterates these clients and calls their Purge method, which performs file deletion operations on the specified directories.
The critical issue: the pre-patch cleanmgr.exe does not enable Redirection Guard (ProcessRedirectionTrustPolicy), a Windows kernel mitigation that prevents a process from following filesystem junctions (reparse points) created by lower-integrity processes. Without this protection, an attacker can plant a junction in a user-writable cleanup target directory that redirects to a protected system location. When cleanmgr.exe (running as SYSTEM) follows the junction, it deletes files in the attacker-chosen target directory.
Prerequisites and Constraints
- Local authenticated session (standard user; no administrative rights required)
- The SilentCleanup scheduled task must be available (present on all desktop Windows editions)
- Attacker needs write access to a directory that is a cleanup target (e.g.,
%TEMP%,C:\Users\<user>\AppData\Local\Temp) - Junction creation requires
mklink /Jor equivalent API — no special privileges needed - The attack is a delete primitive only — it cannot write or read arbitrary files
- Can be chained with
C:\Config.Msijunction abuse for full SYSTEM EoP via MSI rollback - Timing window exists between directory enumeration and deletion
Vulnerability Details
Call Chain (Ghidra MCP–Verified)
The complete call chain from userspace to the vulnerable deletion, verified via Ghidra MCP decompilation against the pre-patch binary (cleanmgr.exe, 10.0.26100.1882):
User mode (attacker):
mklink /J "%TEMP%\cleanup_target" "C:\Windows\System32\target"
schtasks /run /tn "\Microsoft\Windows\DiskCleanup\SilentCleanup"
↓
cleanmgr.exe (SYSTEM):
WinMainT() [entry point — NO SetProcessMitigationPolicy call]
→ ParseCommandLine() [parses /SAGERUN, /AUTOCLEAN, etc.]
→ CleanupMgrInfo::CleanupMgrInfo() [initializes cleanup state]
→ CleanupMgrInfo::purgeClients() [*** iterates cleanup clients ***]
→ IEmptyVolumeCache::Purge() [COM cleanup client — deletes files]
→ follows junction → deletes files in attacker-chosen directory
WinMainT (Pre-Patch — VULNERABLE)
The pre-patch WinMainT at 0x140006614 (Ghidra decompilation from cleanmgr.exe 10.0.26100.1882):
// Pre-patch WinMainT @ 0x140006614 — NO SetProcessMitigationPolicy
int WinMainT(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
// Standard initialization
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
// Single-instance check
HANDLE hEvent = CreateEventW(NULL, FALSE, FALSE, L"Local\\Cleanmgr: Instance event");
if (hEvent && GetLastError() == ERROR_ALREADY_EXISTS) {
_SwitchToAnotherInstanceOfCleanMgrAlreadyRunning(hInstance);
return 0;
}
g_hInstance = hInstance;
InitCommonControls();
SHCoInitialize();
// *** NO SetProcessMitigationPolicy call ***
// *** NO Feature_3318489400 check ***
// *** NO Redirection Guard ***
ParseCommandLine(lpCmdLine, &flags, &driveNum);
// ... cleanup logic, eventually calls purgeClients() ...
}
The bug: WinMainT never calls SetProcessMitigationPolicy to enable ProcessRedirectionTrustPolicy. The SetProcessMitigationPolicy API is not even in the import table of the pre-patch binary. This means the kernel allows cleanmgr.exe to follow junctions planted by any user, including low-integrity processes.
WinMainT (Post-Patch — FIXED)
The post-patch WinMainT (similarity 0.25 — major restructure) adds:
// Post-patch WinMainT — with Redirection Guard
int WinMainT(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
// *** NEW: Enable Redirection Guard (behind Feature_3318489400) ***
if (Feature_3318489400__private_IsEnabled()) {
PROCESS_MITIGATION_REDIRECTION_TRUST_POLICY policy = {0};
policy.Flags = 0x10; // EnableRedirectionTrust
BOOL ok = SetProcessMitigationPolicy(
ProcessRedirectionTrustPolicy, // policy class 0xd (13)
&policy, sizeof(policy));
if (!ok) {
// Hard-fail: if Redirection Guard can't be set, abort
FailFast();
}
}
// ... rest of initialization ...
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
// ... same cleanup flow ...
}
With ProcessRedirectionTrustPolicy enabled, the kernel checks the creator of any junction/reparse point before following it. If the junction was created by a lower-integrity process than cleanmgr.exe (SYSTEM), the kernel refuses to follow it — returning STATUS_REPARSE_POINT_NOT_RESOLVED.
purgeClients (Performs the Deletion)
// CleanupMgrInfo::purgeClients @ 0x14000fa68 (simplified)
int CleanupMgrInfo::purgeClients(CleanupMgrInfo *this)
{
// Calculate space to purge
calculateSpaceToPurge(this);
// Iterate cleanup clients
for (int i = 0; i < *(int*)(this + 0x6c8); i++) {
// Get client COM object
IEmptyVolumeCache *client = *(IEmptyVolumeCache **)(clientData + 0x18);
if (client != NULL && *(longlong*)(this + 0x6d8) != 0) {
// Call Purge — this does the actual file deletion
// The client deletes files in its registered directory
// If the directory contains a junction, the delete follows it
HRESULT hr = client->Purge(spaceToFree, callback);
if (FAILED(hr)) {
*(int*)(this + 0x65c) = 2; // error state
}
}
}
return status;
}
ReLaunchDiskCleanupElevated (Elevation Path)
// ReLaunchDiskCleanupElevated @ 0x1400064b4
long ReLaunchDiskCleanupElevated(HWND hwnd, LPWSTR cmdLine, int nCmdShow)
{
WCHAR exePath[MAX_PATH];
GetModuleFileNameW(NULL, exePath, MAX_PATH);
SHELLEXECUTEINFOW sei = {0};
sei.cbSize = sizeof(sei);
sei.lpVerb = L"runas"; // UAC elevation
sei.lpFile = exePath; // re-launches self
sei.lpParameters = cmdLine;
sei.nShow = nCmdShow;
if (ShellExecuteExW(&sei))
return S_OK;
return ResultFromLastError();
}
Exploitation Scenario
Step 1 — Create Junction in Cleanup Target Directory
REM Standard user — create junction in %TEMP%
mkdir "%TEMP%\exploit_dir"
REM Put some content so the cleanup client registers it
echo x > "%TEMP%\exploit_dir\dummy.txt"
REM Create junction pointing to a protected directory
mklink /J "%TEMP%\exploit_dir\target" "C:\Config.Msi"
Step 2 — Trigger SilentCleanup
REM Any standard user can trigger SilentCleanup
schtasks /run /tn "\Microsoft\Windows\DiskCleanup\SilentCleanup"
Step 3 — cleanmgr.exe Follows the Junction
When cleanmgr.exe (running as SYSTEM) processes the Temp cleanup client, it enumerates %TEMP%\exploit_dir\ and finds target\. Without Redirection Guard, the kernel follows the junction to C:\Config.Msi and deletes its contents with SYSTEM privileges.
Step 4 — Chain for Full EoP
The C:\Config.Msi deletion primitive can be chained with the Windows Installer rollback mechanism:
- Start an MSI installation that creates rollback scripts in
C:\Config.Msi\ - Delete
C:\Config.Msi\via the cleanmgr junction abuse - Replace
C:\Config.Msi\with a junction to a system directory - Trigger MSI rollback — the installer writes rollback scripts to the junction target
- The attacker-controlled script executes as SYSTEM during rollback
Impact
Arbitrary file/folder deletion as SYSTEM, chainable to full EoP. The SilentCleanup task is present on all desktop Windows editions and can be triggered by any standard user.
Patch Analysis
Mechanism
The patch adds a single critical call to SetProcessMitigationPolicy with ProcessRedirectionTrustPolicy at the very start of WinMainT, before any file operations occur. This enables the kernel’s Redirection Guard mitigation, which:
- Tags all filesystem junctions/reparse points with the creator’s security context
- When a process tries to follow a junction, the kernel compares the junction creator’s integrity level with the process’s integrity level
- If the junction was created by a lower-integrity process, the kernel returns
STATUS_REPARSE_POINT_NOT_RESOLVEDinstead of following it - This prevents standard-user-created junctions from being followed by SYSTEM-level cleanmgr.exe
Feature Gating
The fix is gated behind WIL CFR flag Feature_3318489400. The process hard-fails if the policy cannot be applied — it calls FailFast_Unexpected rather than continuing without protection.
Files Changed
| Function | Change |
|---|---|
WinMainT |
+SetProcessMitigationPolicy(ProcessRedirectionTrustPolicy) call; object grows significantly (similarity 0.25) |
wil::details::FeatureImpl<Feature_3318489400>::__private_IsEnabled |
New WIL CFR feature flag accessor |
| Multiple WIL infrastructure functions | Standard WIL CFR plumbing |
Trigger PoC
A proof-of-concept is available at poc/poc_cve_2025_21420.c. It demonstrates the junction-following behavior by:
- Creating a temporary directory in
%TEMP% - Populating it with dummy files so cleanup clients process it
- Creating a junction from the temp directory to a test target directory
- Triggering the SilentCleanup scheduled task
- Checking whether files in the test target were deleted (proving junction was followed)
On a pre-patch system, the PoC will show that cleanmgr.exe followed the junction and deleted files in the target directory. On a post-patch system, Redirection Guard prevents the junction from being followed and the target directory remains intact.
Note: This PoC is a trigger/detector only. It targets a benign test directory, not system files. It does NOT include the MSI rollback chain for full EoP. It is designed for blue teams to validate detection rules.
Detection Rules
YARA Rule — Detecting PoC/Exploit Binaries
rule CVE_2025_21420_CleanMgr_Junction_Exploit {
meta:
description = "Detects tools exploiting CVE-2025-21420 cleanmgr.exe junction abuse"
author = "OnlyFm252"
date = "2026-07-17"
cve = "CVE-2025-21420"
severity = "high"
tlp = "white"
strings:
$task1 = "SilentCleanup" ascii wide
$task2 = "DiskCleanup" ascii wide
$cmd1 = "schtasks" ascii wide
$cmd2 = "mklink" ascii wide
$cmd3 = "/J" ascii wide
$api1 = "CreateSymbolicLink" ascii wide
$api2 = "DeviceIoControl" ascii wide
$reparse = "REPARSE" ascii wide
$config_msi = "Config.Msi" ascii wide nocase
$cleanmgr = "cleanmgr" ascii wide nocase
condition:
uint16(0) == 0x5A4D and
filesize < 500KB and
($task1 or $task2) and
($cmd2 or $api1 or $reparse) and
($config_msi or $cleanmgr)
}
YARA Rule — Detecting Vulnerable cleanmgr.exe (Pre-Patch)
rule CVE_2025_21420_Vulnerable_CleanMgr {
meta:
description = "Detects pre-patch cleanmgr.exe without Redirection Guard"
author = "OnlyFm252"
date = "2026-07-17"
cve = "CVE-2025-21420"
strings:
$cleanmgr = "cleanmgr" wide nocase
$mitigation = "SetProcessMitigationPolicy" ascii
$purge = "purgeClients" ascii
condition:
uint16(0) == 0x5A4D and
$cleanmgr and
$purge and
not $mitigation
}
Sigma Rule — SilentCleanup Task Abuse
title: SilentCleanup Scheduled Task Triggered by Non-System Process (CVE-2025-21420)
id: a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d
status: experimental
description: >
Detects manual triggering of the SilentCleanup scheduled task,
which may indicate exploitation of CVE-2025-21420. The SilentCleanup
task runs cleanmgr.exe as SYSTEM, and a standard user can trigger it
to abuse junction-following for arbitrary file deletion.
author: OnlyFm252
date: 2026/07/17
references:
- https://msrc.microsoft.com/update-guide/vulnerability/CVE-2025-21420
- https://onlyfm252.starlabs.sg/patch-tuesday/2025-02/cve-2025-21420/
logsource:
category: process_creation
product: windows
detection:
selection_schtasks:
Image|endswith: '\schtasks.exe'
CommandLine|contains:
- 'SilentCleanup'
- 'DiskCleanup'
CommandLine|contains:
- '/run'
- '/Run'
filter_system:
User|contains:
- 'SYSTEM'
- 'NT AUTHORITY'
condition: selection_schtasks and not filter_system
falsepositives:
- Administrative disk cleanup scheduling
- IT management scripts
level: high
tags:
- attack.privilege_escalation
- attack.t1053.005
- attack.t1068
- cve.2025.21420
Sigma Rule — Junction Creation in Temp Directories
title: Junction Creation in User Temp Directory (CVE-2025-21420)
id: b2c3d4e5-6f7a-8b9c-0d1e-2f3a4b5c6d7e
status: experimental
description: >
Detects creation of NTFS junctions (reparse points) in user temp
directories, which may indicate preparation for CVE-2025-21420
exploitation. Legitimate applications rarely create junctions in
temp directories.
author: OnlyFm252
date: 2026/07/17
logsource:
category: process_creation
product: windows
detection:
selection_mklink:
Image|endswith:
- '\cmd.exe'
- '\powershell.exe'
- '\pwsh.exe'
CommandLine|contains|all:
- 'mklink'
- '/J'
CommandLine|contains:
- '\Temp\'
- '\AppData\Local\Temp'
- '%TEMP%'
selection_api:
Image|endswith: '.exe'
CommandLine|contains:
- 'IO_REPARSE_TAG_MOUNT_POINT'
- 'FSCTL_SET_REPARSE_POINT'
condition: selection_mklink or selection_api
falsepositives:
- Development tools creating junction links
- Build systems using junction points
level: medium
tags:
- attack.privilege_escalation
- attack.t1053.005
- cve.2025.21420
Sysmon Configuration
<!-- Sysmon config addition for CVE-2025-21420 detection -->
<RuleGroup name="CVE-2025-21420" groupRelation="or">
<!-- ProcessCreate: schtasks triggering SilentCleanup -->
<ProcessCreate onmatch="include">
<Rule name="SilentCleanup_Trigger" groupRelation="and">
<Image condition="end with">schtasks.exe</Image>
<CommandLine condition="contains">SilentCleanup</CommandLine>
</Rule>
</ProcessCreate>
<!-- ProcessCreate: cleanmgr.exe launched with suspicious flags -->
<ProcessCreate onmatch="include">
<Rule name="CleanMgr_Elevated" groupRelation="and">
<Image condition="end with">cleanmgr.exe</Image>
<IntegrityLevel condition="is">System</IntegrityLevel>
<ParentImage condition="excludes">C:\Windows\System32\svchost.exe</ParentImage>
</Rule>
</ProcessCreate>
<!-- FileCreate: Junction creation in user-writable directories -->
<FileCreate onmatch="include">
<Rule name="Junction_In_Temp" groupRelation="and">
<TargetFilename condition="contains">\Temp\</TargetFilename>
<TargetFilename condition="contains">IO_REPARSE_TAG</TargetFilename>
</Rule>
</FileCreate>
<!-- FileDelete: cleanmgr.exe deleting files outside expected paths -->
<FileDelete onmatch="include">
<Rule name="CleanMgr_Unexpected_Delete" groupRelation="and">
<Image condition="end with">cleanmgr.exe</Image>
<TargetFilename condition="excludes">\Temp\</TargetFilename>
<TargetFilename condition="excludes">\Temporary Internet Files\</TargetFilename>
<TargetFilename condition="excludes">\Windows\Logs\</TargetFilename>
</Rule>
</FileDelete>
</RuleGroup>
Remediation
- Apply KB5051987 (February 2025 cumulative update) immediately
- Verify patch: Check
cleanmgr.exeversion is ≥ 10.0.26100.3194 - Monitor: Deploy the Sysmon and Sigma rules above to detect exploitation attempts
- Restrict: Disable the SilentCleanup scheduled task on sensitive systems if not needed
- Audit: Review for unexpected junction/symlink creation in user temp directories
- Hunt: Check for evidence of
C:\Config.Msimanipulation or unexpected MSI rollback activity
Timeline
| Date | Event |
|---|---|
| 2025-02-11 | Microsoft releases February 2025 Patch Tuesday (KB5051987) |
| 2026-07-17 | This Ghidra MCP–verified analysis published |
References
- Microsoft Security Response Center — CVE-2025-21420
- Windows Redirection Guard Documentation
- OnlyFm252 Diff Report
Attack Path
Arbitrary file deletion as SYSTEM by pointing a Disk Cleanup target at a junction
Derived from the patch delta: the checks added by the vendor identify which fields crossed a trust boundary unvalidated. Reachability and privilege are taken from the call chain in the RCA report.
Exploits & PoC
2 public PoCsUnverified third-party code
Public proof-of-concept repositories aggregated from PoC-in-GitHub. They are not reviewed and may be incomplete, non-functional, or malicious — inspect the code before running anything.
| Repository | Stars | Published | Description |
|---|---|---|---|
| moiz-2x/CVE-2025-21420_POC | 56 | 2025-06-12 | Proof of Concept CVE-2025-21420 (Windows Disk Cleanup Tool EoP) |
| Dmitri131313/CVE-2025-21420-PoC | 1 | 2025-02-17 | We found a way to DLL sideload with cleanmgr.exe |
Detection Rules
Acknowledgments
None