PoC di escalation dei privilegi da Admin a SYSTEM su Windows che costringe i processi SYSTEM ad autenticarsi a un listener HTTP.sys locale, cattura il token NTLM e genera una shell SYSTEM.
Proof of concept per il passaggio da Admin a SYSTEM su Windows tramite la cattura del token NTLM di HTTP.sys.
Lo strumento sfrutta il fatto che HTTP.sys è in grado di eseguire l'autenticazione NTLM/Negotiate in modalità kernel ed esporre il token di accesso risultante al codice in modalità utente. Inducendo un processo a livello SYSTEM ad autenticarsi contro un listener HTTP.sys locale, il token SYSTEM viene catturato e riutilizzato per avviare un nuovo processo.
Phase 1 Listener Setup
Register an HTTP.sys URL group on 127.0.0.1:7778 with Negotiate + NTLM auth enabled.
Phase 2 Coercion (background thread)
Force a SYSTEM process to authenticate against the listener:
Method 1: SCM + WebDAV - Create a service with a UNC binPath routed through
WebClient (WebDAV redirector) to the HTTP listener.
Method 2: schtasks + PowerShell - Schedule a SYSTEM task that calls
Invoke-WebRequest with -UseDefaultCredentials.
Method 3: schtasks + certutil - Same idea but using certutil -urlcache
as a fallback when PowerShell is restricted.
Phase 3 Token Capture
HTTP.sys completes the NTLM handshake in kernel mode and delivers the
authenticated SYSTEM token via HTTP_REQUEST_AUTH_INFO.AccessToken.
Phase 4 Spawn
Duplicate the token as a primary token and call CreateProcessAsUserW
(or CreateProcessWithTokenW as fallback) to launch cmd.exe as SYSTEM.
cl /EHsc /W3 /O2 httpsys_token_capture.cpp httpapi.lib advapi32.lib ole32.lib
g++ -O2 -o httpsys_token_capture.exe httpsys_token_capture.cpp -lhttpapi -ladvapi32 -lole32 -lwtsapi32
httpsys_token_capture.exe
Eseguire da un prompt dei comandi con privilegi elevati. Lo strumento è completamente automatizzato: configura il listener, prova ciascun metodo di coercizione in sequenza, cattura il token, stampa i dettagli del token (identità, SID, livello di integrità, privilegi) e avvia una shell SYSTEM.
| # | Metodo | Meccanismo | Richiede |
|---|---|---|---|
| 1 | SCM + WebDAV | Crea un servizio con un percorso UNC (\\127.0.0.1@7778\...) che il redirector WebDAV risolve come HTTP, innescando l'autenticazione NTLM da parte di SCM (SYSTEM) | Servizio WebClient |
| 2 | schtasks + PowerShell | Un'attività pianificata in esecuzione come SYSTEM esegue Invoke-WebRequest -UseDefaultCredentials | PowerShell |
| 3 | schtasks + certutil | Un'attività pianificata in esecuzione come SYSTEM esegue certutil -urlcache, che utilizza le credenziali predefinite di WinHTTP per la zona intranet | certutil |
I metodi vengono provati in sequenza. Lo strumento si arresta non appena viene catturato un token SYSTEM.
Tutti gli artefatti (servizio temporaneo, attività pianificata) vengono rimossi automaticamente dopo l'esecuzione. Il listener HTTP.sys viene deregistrato all'uscita.