Windows
This is a page dedicated to privilege escalation in windows. Helpful hacktricks checklist: https://book.hacktricks.xyz/windows-hardening/checklist-windows-privilege-escalation
Tools
Always double check information from automated tools manually.
winPEAS: https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS
Seatbelt (compile): https://github.com/GhostPack/Seatbelt
Watson (compile): https://github.com/rasta-mouse/Watson
SharpUp (compile): https://github.com/GhostPack/SharpUp
windows exploit suggester: https://github.com/AonCyberLabs/Windows-Exploit-Suggester
oneliner for pip: curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py; python get-pip.py
winPEAS: https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS windows exploit suggester: https://github.com/AonCyberLabs/Windows-Exploit-Suggester
Informations we have to obtain
Username and hostname
Group memberships of the current user
Existing users and groups
Operating system, version and architecture
Network information
Installed applications
Running processes
System information
Look for valueable information in C:\ and user home folders manually.
Event Viewer
You can also search for events recorded by Script Block Logging.
Installed programs
Network enumeration
User information
Check drives
Antivirus information
Firewall information
Password Hunting
More content: https://swisskyrepo.github.io/InternalAllTheThings/redteam/escalation/windows-privilege-escalation/#eop-looting-for-passwords
Cmdkey listing
If any key was found you can try exploiting run as to get access
Search for .txt and .ini files
More interesting extensions:
Browsers
Check cashe and search for installed addons.
Run As
If you have credentials to the another user which do not have permissions to connect through RDP and WINRM you can use the following command (you need RDP as another user):
Sometimes in windows you are able to run a program with run as privileges. Run As admin command :
WSL
You can get some interesting information in linux subsystem (see Internal > Linux to enumerate).
Token impersonation
Privileges can differ on the method of connecting to the target. e.g. ssh can have limited privileges in comparison to reverse shell
Tokens are temporary keys that allow you access to a system/network without providing the credentials. It works similar to cookies.
You have 2 types of tokensL
Delegate - created for logging into a machine using remote desktop
Impersonate - "non-interactive" such as attaching a network drive or a domain logon script
Then look here to find privileges that can be used: https://github.com/gtworek/Priv2Admin
Registry
Autorun (RDP required)
In order to check for autoruns that can be used you can download the Autoruns64.exe tool.
In Autoruns, click on the ‘Logon’ tab.
From The listed results search where exploitable program has its path.
Use accesschk64.exe -wvu "C:\Program Files\Autorun Program" in order to check access permissions.
You can replace the file with msfvenom created reverse shell.
When event happens (e.g. Administrator will login you will get reverse shell)
These tools can be found here: https://github.com/davehardy20/sysinternals
AlwaysInstallElevated
Check if value in registry is 1
If the configuration is vulnerable you can proceed to exploit the system in the following way:
Place the file in C:\Temp
Regsvc
ACL If the group that user belongs to has full control the machine can be exploited. You can check it by running the following command:
Exploitation:
Get windows_service.c file: https://github.com/sagishahar/scripts/blob/master/windows_service.c.
Open windows_service.c in a text editor and replace the command used by the system() function to: cmd.exe /k net localgroup administrators user /add
Exit the text editor and compile the file by typing the following in the command prompt:
Copy the generated file to windows machine (C:\Temp)
Open command prompt at type:
If the technique succeded user should be added to administrator group.
Startup
Microsoft documentation with listed permissions: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/icacls
Check permissions:
If you have permissions to the directory create malicious file in kali:
Place it here:
Create listener in kali
Wait for administrator to login.
Service Binary Hijacking
List the services:
Check service with icalcs:
Icalcs permissions:
F
Full access
M
Modify access
RX
Read and execute access
R
Read-only access
W
Write-only access
If you have permissions you can replace the file with malicious one:
Compilation:
Replacement:
Stop service:
If service can be started.
Stop service
Start service
If service can not be started - reboot.
Check service startmode options
Service DLL Hijacking
Get running services:
Check permissions:
Use procmon to investigate the binary:
Run Procmon64.exe.
Filter menu > Filter
Replace BetaServ.exe with process of your choice and click ADD.

Restart Service in powershell and analyze the response in ProcMon:
During the analysis look for the CreateFile attempts with states:
NAME NOT FOUND
PATH NOT FOUND
See the path variables:
DLL replacement file:
Compile the dll:
Put the dll.
Restart the vulnerable service:
Path
binPath
Check permissions write access for everyone:
If something was found we can use direct accesschk64.exe command on this service in order to obtain more information (in this case daclsvc):
Exploitation (change daclsvc to your found service):
if you can change configuration:
Unquoted service path
We can use this attack when we have Write permissions to a service's main directory or subdirectories but cannot replace files within them.
Open powershell in execution policy bypass in order to execute scripts:
Execute PowerUp.ps1:
Run function from powerup:
Is vulnerable when:
How windows search for it? When we have the following path:
C:\Program.exe -> not found
C:\Program Files\Unqoted.exe -> not found
C:\Program Files\Unquoted Path.exe -> not found
... until he finds the exe
We can exploit this by creating malicious file in the following path with the following name:
You can use msfvenom in order to create the file (we use unqouted.exe as example).
Move the generated file to windows.
Set up listener
In order to execute the file start the service
Unquoted service path (manual)
Enumerate running and stopped services:
More efficient way:
After finding the vulnerable path test if we can reset the service (or reboot machine which will start it).
Check access to paths using icacls:
Scheduled tasks
Check scheduled tasks:
Check permissions:
CVE-2019-1388
RDP access required
Find a program that can trigger the UAC prompt screen
Select "Show more details"
Select "Show information about the publisher's certificate"
Click on the "Issued by" URL link it will prompt a browser interface.
Wait for the site to be fully loaded & select "save as" to prompt a explorer window for "save as".
On the explorer window address path, enter the cmd.exe full path: C:\WINDOWS\system32\cmd.exe
Now you'll have an escalated privileges command prompt.
Last updated