
Exploit PoC de LPE para CLFS do Windows para pesquisa de segurança
CVE-2025-60709 é uma vulnerabilidade de escalação de privilégios locais (LPE) no driver CLFS.sys (Common Log File System) do Windows. Permite que um atacante com execução de código local escale de usuário padrão para NT AUTHORITY\SYSTEM através de um buffer overflow na análise de contêineres CLFS, obtendo uma primitiva de escrita arbitrária na memória do kernel.
Este repositório contém duas implementações:
| Campo | Detalhe |
|---|---|
| CVE ID | CVE-2025-60709 |
| Tipo | Local Privilege Escalation (LPE) |
| Componente | CLFS.sys (driver Common Log File System) |
| Sistema alvo | Windows 11 24H2 (build 26100.3485+) |
| Arquitetura | x64 apenas |
| Vetor | Buffer overflow na análise de contêiner CLFS |
| Impacto | Escalação para NT AUTHORITY\SYSTEM |
| Pré-requisitos | Execução local de código (usuário padrão) |
CVE-2025-60709/
├── CVE-2025-60709.c (5.3 KB, 157 linhas) — Exploit C original
├── CVE-2025-60709.go (9.2 KB, 285 linhas) — Port Go (demo educativa)
└── README.txt (4.2 KB, 132 linhas) — Documentação original
┌─────────────────────────────────────────────────────────────┐
│ CVE-2025-60709 LPE │
└─────────────────────────────────────────────────────────────┘
[1] EVASÃO DE DEFESAS
├─ KillETW() → Aplica patch no EtwEventWrite na ntdll com RET (0xC3)
└─ KillAMSI() → Aplica patch no AmsiScanBuffer na amsi.dll com RET (0xC3)
[2] HEAP GROOMING (preparação de memória)
└─ GroomLookaside()
├─ Cria 4096 arquivos: C:\Windows\Temp\groom_00000.blf
├─ Chama CreateLogFile() + AddLogContainer() para cada um
└─ Esgota lookaside lists → garante layout de heap previsível
[3] PRIMITIVA DE ESCRITA ARBITRÁRIA — ClfsArbWrite(Address, Value)
├─ Constrói buffer CLFS malformado (0x102010 bytes)
│ ├─ Assinatura CLFS válida em +0x00: 0x0201
│ ├─ Sector size shift em +0x14: 2
│ ├─ First client region em +0x28: 0x100
│ ├─ cbRecord SUPERDIMENSIONADO em +0x100: 0xFF00 (64 KB > dados reais)
│ ├─ Marcador shadow zone em +0x9A8: 0x13371337
│ └─ CClfsContainerContext falso no offset (0xFF00 + 0x100):
│ ├─ pContainer = TargetAddress - 0x10
│ └─ cbContainer = Value (dado a escrever)
├─ Calcula checksum CLFS correto (driver valida)
├─ Escreve contêiner malformado → C:\Windows\Temp\evil.blf
├─ Cria log apontando para evil.blf
├─ Chama ClfsReadRestartArea() → dispara análise no kernel
└─ Driver estoura buffer → escreve Value em Address ✓
[4] ROUBO DE TOKEN SYSTEM
├─ Lê EPROCESS do processo SYSTEM via PsInitialSystemProcess
└─ Extrai token em EPROCESS + EPROCESS_TOKEN (offset 0x4c0)
[5] ESCALAÇÃO DE PRIVILÉGIOS
└─ ClfsArbWrite(CurrentEprocess + 0x4c0, SystemToken)
└─ Sobrescreve token do processo atual com token SYSTEM ✓
[6] EXECUÇÃO DE PAYLOAD C2
├─ VirtualAlloc(PAGE_EXECUTE_READWRITE)
├─ Copia shellcode beacon de 1789 bytes
├─ CreateThread() → execução como NT AUTHORITY\SYSTEM
└─ Beacon C2: IPv6 + DoH → fallback Gmail drafts
└─ sRDI + sleep obfuscation + ETW/AMSI já corrigidos
[7] PERSISTÊNCIA
└─ Sleep(INFINITE) → processo mantém token SYSTEM
| Campo | Offset | Descrição |
|---|---|---|
EPROCESS_TOKEN | 0x4C0 | Token de segurança do processo |
EPROCESS_PID | 0x440 | ID do processo (PID) |
EPROCESS_LINKS | 0x448 | Lista encadeada de processos ativos |
EPROCESS_NAME | 0x5A8 | Nome do processo (ImageFileName) |
⚠️ Esses offsets variam entre builds do Windows. Requerem atualização para outras versões.
Contêiner CLFS legítimo:
[Header 0x100 bytes][Record: cbRecord bytes de dados reais]
Contêiner malformado (evil.blf):
[Header válido][cbRecord=0xFF00 → kernel lê 65.280 bytes]
↓
Kernel overflow → alcança CClfsContainerContext falso
↓
pContainer = TargetKernelAddress - 0x10
cbContainer = ValueToWrite
↓
Driver usa estrutura falsa → escreve ValueToWrite em TargetKernelAddress
CVE-2025-60709.c| Função | Propósito |
|---|---|
GetKernelBase() | ZwQuerySystemInformation(SystemModuleInformation) → base do ntoskrnl.exe |
KillETW() | VirtualProtect + sobrescreve EtwEventWrite na ntdll.dll com 0xC3 (RET) |
KillAMSI() | Carrega amsi.dll + sobrescreve AmsiScanBuffer com 0xC3 (RET) |
GroomLookaside() | Cria 4096 logs CLFS para esgotar lookaside lists → heap determinístico |
ClfsArbWrite() | Núcleo do exploit — primitiva de escrita arbitrária no kernel |
main() | Orquestra ataque: ETW→AMSI→groom→roubo de token→arb write→beacon |
| Aspecto | Versão C | Versão Go |
|---|---|---|
| Tipo | Exploit funcional (conforme documentação) | Demo educativa apenas |
| APIs | Acesso direto (ntdll, clfsw32, advapi32) | Wrappers syscall.NewLazyDLL() |
| Checksum CLFS | Algoritmo completo | Placeholder simplificado |
| Endereços do kernel | Reais | Placeholder fixo (0x123456) |
| Payload C2 | Shellcode de 1789 bytes | Bytes NOP (0x90) de teste |
| Resultado esperado | Escalação para SYSTEM | Mensagem "Arb write failed (yeah)" |
Versão C (requer Visual Studio Build Tools + Windows SDK):
cl /O1 /MT /link ntdll.lib advapi32.lib clfsw32.lib CVE-2025-60709.c
Versão Go (requer Go 1.19+ no Windows x64):
go build -ldflags="-s -w" -o CVE-2025-60709.exe CVE-2025-60709.go
| Mitigação | Eficácia |
|---|---|
| HVCI (Integridade de Código Protegida por Hypervisor) | Alta — impede escrita na memória do kernel |
| kCFI (Integridade de Fluxo de Controle do Kernel) | Alta — dificulta cadeias ROP/JOP |
| CFG (Guardian de Fluxo de Controle) | Média — dificulta execução de shellcode |
| Windows Defender | Média — detecta técnicas conhecidas |
| Atualização do Windows | Alta — patch oficial elimina a vulnerabilidade |
rule CVE_2025_60709_CLFS_LPE {
meta:
description = "Detects CVE-2025-60709 CLFS LPE exploit"
author = "KONDORDEVSECURITYCORP"
date = "2026-03"
cve = "CVE-2025-60709"
severity = "critical"
strings:
$clfs_sig = { 01 02 00 00 }
$magic = { 37 13 37 13 }
$evil_file = "evil.blf" ascii wide
$groom_file = "groom_" ascii wide
$etw_func = "EtwEventWrite" ascii wide
$amsi_func = "AmsiScanBuffer" ascii wide
$token_off = { C0 04 00 00 } // EPROCESS_TOKEN = 0x4C0
condition:
3 of them
}
| Tipo | Valor |
|---|---|
| Arquivo malformado | C:\Windows\Temp\evil.blf |
| Log malformado | \\.\C:\Windows\Temp\evil_log |
| Arquivos de grooming | C:\Windows\Temp\groom_00000.blf … groom_04095.blf |
| Processo | Prioridade REALTIME_PRIORITY_CLASS anômala |
ARQUIVO: Criação massiva de *.blf em C:\Windows\Temp\ (> 100 em segundos)
ARQUIVO: Criação de C:\Windows\Temp\evil.blf
PROCESSO: Processo em modo REALTIME_PRIORITY + chamadas a ClfsReadRestartArea
MEMÓRIA: Escrita em PAGE_EXECUTE_READWRITE + CreateThread imediato
API: VirtualProtect sobre EtwEventWrite ou AmsiScanBuffer
KERNEL: Acesso a PsInitialSystemProcess a partir do user-mode
# Verificar arquivos de grooming
Get-ChildItem C:\Windows\Temp -Filter "groom_*.blf" | Measure-Object
# Verificar arquivo exploit
Test-Path C:\Windows\Temp\evil.blf
# Verificar integridade do ntdll (patch ETW)
Get-AuthenticodeSignature (Get-Process -Name notepad | Select -First 1).Path
CVE-2025-60709 is a Local Privilege Escalation (LPE) vulnerability in the Windows CLFS.sys (Common Log File System) driver. It allows an attacker with local code execution to escalate from a standard user to NT AUTHORITY\SYSTEM through a buffer overflow in CLFS container parsing, obtaining an arbitrary write primitive to kernel memory.
This repository contains two implementations:
| Campo | Detalhe |
|---|---|
| CVE ID | CVE-2025-60709 |
| Type | Local Privilege Escalation (LPE) |
| Component | CLFS.sys (Common Log File System driver) |
| Target OS | Windows 11 24H2 (build 26100.3485+) |
| Architecture | x64 only |
| Vector | Buffer overflow in CLFS container parsing |
| Impact | Escalation to NT AUTHORITY\SYSTEM |
| Prerequisitos | Local code execution (standard user) |
[1] DEFENSE EVASION
├─ KillETW() → Patch EtwEventWrite in ntdll with RET (0xC3)
└─ KillAMSI() → Patch AmsiScanBuffer in amsi.dll with RET (0xC3)
[2] HEAP GROOMING
└─ GroomLookaside()
├─ Creates 4096 files: C:\Windows\Temp\groom_00000.blf
├─ Calls CreateLogFile() + AddLogContainer() for each
└─ Exhausts lookaside lists → guarantees predictable heap layout
[3] ARBITRARY WRITE PRIMITIVE — ClfsArbWrite(Address, Value)
├─ Constructs malformed CLFS buffer (0x102010 bytes)
│ ├─ Valid CLFS signature at +0x00: 0x0201
│ ├─ Oversized cbRecord at +0x100: 0xFF00 (65,280 bytes)
│ ├─ Shadow zone marker at +0x9A8: 0x13371337
│ └─ Fake CClfsContainerContext at offset (0xFF00 + 0x100):
│ ├─ pContainer = TargetAddress - 0x10
│ └─ cbContainer = Value (data to write)
├─ Computes valid CLFS checksum (driver validates)
├─ Writes malformed container → C:\Windows\Temp\evil.blf
├─ Creates log pointing to evil.blf
├─ Calls ClfsReadRestartArea() → triggers kernel parsing
└─ Driver overflows buffer → writes Value to Address ✓
[4] SYSTEM TOKEN THEFT
├─ Reads SYSTEM process EPROCESS via PsInitialSystemProcess
└─ Extracts token at EPROCESS + 0x4C0
[5] PRIVILEGE ESCALATION
└─ ClfsArbWrite(CurrentEprocess + 0x4C0, SystemToken)
└─ Overwrites current process token with SYSTEM token ✓
[6] C2 PAYLOAD EXECUTION
├─ VirtualAlloc(PAGE_EXECUTE_READWRITE)
├─ Copy 1789-byte shellcode beacon
├─ CreateThread() → runs as NT AUTHORITY\SYSTEM
└─ Beacon: IPv6 + DoH C2 → Gmail drafts fallback
└─ sRDI + sleep obfuscation + ETW/AMSI already patched
[7] PERSISTENCE
└─ Sleep(INFINITE) → process keeps SYSTEM token
| Field | Offset | Description |
|---|---|---|
EPROCESS_TOKEN | 0x4C0 | Process security token |
EPROCESS_PID | 0x440 | Process ID |
EPROCESS_LINKS | 0x448 | Active process linked list |
EPROCESS_NAME | 0x5A8 | Process name (ImageFileName) |
⚠️ These offsets vary between Windows builds. Must be updated for other versions.
Legitimate CLFS container:
[0x100 byte Header][Record: cbRecord bytes of real data]
Malformed container (evil.blf):
[Valid Header][cbRecord=0xFF00 → kernel reads 65,280 bytes]
↓
Kernel overflows → reaches fake CClfsContainerContext
↓
pContainer = TargetKernelAddress - 0x10
cbContainer = ValueToWrite
↓
Driver uses fake structure → writes ValueToWrite to TargetKernelAddress
CVE-2025-60709.c| Function | Purpose |
|---|---|
GetKernelBase() | ZwQuerySystemInformation(SystemModuleInformation) → ntoskrnl.exe base |
KillETW() | VirtualProtect + overwrite EtwEventWrite in ntdll.dll with 0xC3 (RET) |
KillAMSI() | Load amsi.dll + overwrite AmsiScanBuffer with 0xC3 (RET) |
GroomLookaside() | Create 4096 CLFS logs to exhaust lookaside lists → deterministic heap |
ClfsArbWrite() | Exploit core — arbitrary kernel memory write primitive |
main() | Orchestrates: ETW→AMSI→groom→token theft→arb write→beacon |
| Aspect | C Version | Go Version |
|---|---|---|
| Type | Functional exploit (per docs) | Educational demo only |
| APIs | Direct (ntdll, clfsw32, advapi32) | syscall.NewLazyDLL() wrappers |
| CLFS checksum | Full algorithm | Simplified placeholder |
| Kernel addresses | Real | Hardcoded placeholder (0x123456) |
| C2 payload | 1789-byte shellcode | NOP bytes (0x90) |
| Expected result | SYSTEM escalation | Message "Arb write failed (yeah)" |
C version (requires Visual Studio Build Tools + Windows SDK):
cl /O1 /MT /link ntdll.lib advapi32.lib clfsw32.lib CVE-2025-60709.c
Go version (requires Go 1.19+ on Windows x64):
go build -ldflags="-s -w" -o CVE-2025-60709.exe CVE-2025-60709.go
| Mitigation | Effectiveness |
|---|---|
| HVCI (Hypervisor-protected Code Integrity) | High — prevents kernel memory writes |
| kCFI (Kernel Control Flow Integrity) | High — blocks ROP/JOP chains |
| CFG (Control Flow Guard) | Medium — hinders shellcode execution |
| Windows Defender | Medium — detects known techniques |
| Windows Update | High — official patch eliminates the vulnerability |
rule CVE_2025_60709_CLFS_LPE {
meta:
description = "Detects CVE-2025-60709 CLFS LPE exploit"
author = "KONDORDEVSECURITYCORP"
date = "2026-03"
cve = "CVE-2025-60709"
severity = "critical"
strings:
$evil_file = "evil.blf" ascii wide
$groom_file = "groom_" ascii wide
$etw_func = "EtwEventWrite" ascii wide
$amsi_func = "AmsiScanBuffer" ascii wide
$magic = { 37 13 37 13 }
$token_off = { C0 04 00 00 }
condition:
3 of them
}
| Type | Value |
|---|---|
| Malformed file | C:\Windows\Temp\evil.blf |
| Malformed log | \\.\C:\Windows\Temp\evil_log |
| Grooming files | C:\Windows\Temp\groom_00000.blf … groom_04095.blf |
| Process | Anomalous REALTIME_PRIORITY_CLASS priority |
FILE: Mass creation of *.blf in C:\Windows\Temp\ (> 100 in seconds)
FILE: Creation of C:\Windows\Temp\evil.blf
PROCESS: REALTIME_PRIORITY process + ClfsReadRestartArea calls
MEMORY: Write to PAGE_EXECUTE_READWRITE + immediate CreateThread
API: VirtualProtect over EtwEventWrite or AmsiScanBuffer
KERNEL: PsInitialSystemProcess access from user-mode
# Check grooming files
Get-ChildItem C:\Windows\Temp -Filter "groom_*.blf" | Measure-Object
# Check exploit file
Test-Path C:\Windows\Temp\evil.blf
PT: Este PoC de exploit é publicado apenas para pesquisa de segurança, análise de vulnerabilidades, inteligência de ameaças e fins defensivos. Usar este código contra sistemas sem autorização explícita por escrito é ilegal e pode violar o CFAA, Computer Misuse Act e leis equivalentes. Os autores não assumem responsabilidade pelo uso indevido.
EN: This exploit PoC is published for security research, vulnerability analysis, threat intelligence, and defensive purposes ONLY. Using this code against systems without explicit written authorization is illegal and may violate the CFAA, Computer Misuse Act, and equivalent laws. Authors assume no liability for misuse.