Windows Privilege Escalation Cheatsheet
Latest updated as of: 12 / June / 2022
So you got a shell, what now?
This post will help you with local enumeration as well as escalate your privileges further.
Usage of different enumeration scripts and tools is encouraged, my favourite is WinPEAS. If confused which executable to use, use this
Keep in mind:
- To exploit services or registry, you require:
- appropriate write permissions
- service start permission
- service stop permission
- Look for non-standard programs on the system
Note: This is a live document. I’ll be adding more content as I learn
Binaries
Get 64-bit netcat from here Get Chisel from here
General Information
If nothing is specified, assume command can be run on cmd.exe or powershell.exe
Who am I?
Do I have anything fun?
Notice groups you are part of and privileges you have
Where am I?
Anyone home?
Local users
Domain users
What am I part of?
Local groups
Domain groups
What is this place?
Is it fancy?
Both should be the same for ease of exploitation, if either is 32-bit then try to gain a 64-bit shell.
Use PowerShell
Am I tied up?
Check LanguageMode. FullLanguage is nicer to have.
Use PowerShell
Anything reachable?
Use PowerShell
What does the inside look like?
Look for interesting services
Leave me alone
Do you have admin privs?
Disable Windows Defender real time monitoring
Disable Windows Defender scanning for all files downloaded
File Transfer
SMB
On KALI, start smb server to serve files. Get impacket from here
Use double-quotes if file path has spaces in it
You can download files in multiple ways.
Mount drive
CMD or PowerShell
PowerShell
Copy w/o mounting
HTTP
Load script in memory
May help bypass trivial anti-virus solutions
Save to disk
CMD or PowerShell
Automated Enumeration
WinPEAS
WinPEAS can be found here
For color, first apply below registry settings and then spawn a new shell
Exploit suggester
This works well with older machines
Windows exploit suggester can be found here
This script will be executed on Kali. First take the systeminfo
info, paste it in a file
An update may be required, it will generate the Excel file necessary
Find vulns
PowerUp
PowerUp can be found here
Although not entirely allowed, we can leverage its Invoke-AllChecks
function to quickly find escalation points
The script can be executed in multiple ways
- Save on disk, and execute
- Execute from memory
Modify the script to contain Invoke-AllChecks
at the bottom of the script
Hacking the Services
Checking Access using Accesschk.exe
Below should give you an idea of some of the useful flags
Checking service permissions
ALWAYS RUN THE FOLLOWING TO CHECK IF YOU’VE PERMISSIONS TO START AND STOP THE SERVICE
Get all writable services as per groups
Check unquoted service paths by testing if directories are writable
Check user permissions on an executable
Find all weak permissions
Folders
Files
Weak registry permissions
Getting ACLs
Can we do something about it?
PowerShell
Getting ACLs of services
Get ACLs of any file or folder
Exploiting Services - sc.exe
Query service configuration
Verify config after doing all the changes
What is the current state of the service?
Modifying config
If dependencies exist, make it auto or NULL
Check if you can restart the dependant svc
Turn it off and back on again
Registry
Credentials or Hashes
Finding credentials
Common creds location, always in plaintext
Look for interesting files that may contain creds
Extracting credentials
No Admin
SMB can be used to extract credentials.
First check if target connects back
Start a listener on 445
Get target to connect to it
If nc shows connection, it means hash can be extracted
Responder is an OffSec authorized tool now
Replace interface as required
Get the target to connect to your server and it will start dropping hashes. These are now required to cracked by your fav cracker (john or hashcat) to be able to use them to pass-the-hash
With Admin Mimikatz requires admin since a handle on lsass is needed to play with credentials (tokens,hashes,tickets) Use can either use mimikatz.exe or Invoke-Mimikatz.ps1
Elevate privileges to debug
Dump logged on user and computer credentials
Elevate privileges to SYSTEM by impersonation
Retrieves credential from LSA
List credentials in CredentialManager
Dump credentials in CredentialManager - plaintext password
Leverage credentials
Found plaintext password? On attacker machine you can attempt to login
--system
only works if admin creds are on hand
Found hash instead of plaintext password?
RunAs
CMD
PowerShell Runas 1
PowerShell Runas 2
Find Files Fast
CMD or PowerShell
PowerShell