Windows Privilege-Escalation
Automated tooling exists:
Enumeration
Manual Enumeration
Let’s start with system information
Then get some information about the current user, their privileges and groups; and about all available users and groups:
Network Information:
Search for passwords
Anti-Virus Enumeration
Automated Enumeration/Tools
There are multiple automated enumeration tools
Some unmaintained (or outdated projects): sherlock.ps1, watson, jaws-enum.ps1
Privilege Escalation
Automated Tooling
- powerup (not maintained anymore)/sharpup
- windows-exploit-suggester.py, exploit suggester (metasploit)
- powershell → run post/multi/recon/local_exploit_suggester
- metasploit
getsystem
- a named pipe + in-memory dll
- a named pipe + drops a dll to the disk
- token impersonation
windows kernel exploits
- https://github.com/SecWiki/windows-kernel-exploits
- maybe use metasploit for this
Impersonation and Potato Attacks (jeeves)
-
whoami /priv
-
use mimikatz, etc. to show tokens
-
meterpreter → getprivs
-
priv2admin → https://github.com/gtworek/Priv2Admin
-
if we have SeAssignPrimaryToken → we can do PotatoAttacks (oder SeImpersonatePrivilege)
-
potato attacks
- creates a new token
- then impersonate this token
- mostly works for service accounts
-
windows-expoit-suggester.py
- check for *potato
-
do the same form meterpreter
- run post/multi/recon/local_exploit_suggester
- use windows/local/ms16_075_reflection
- run
- load incognito
- list_tokens -u
- impersonate_token
registry exploits
autorun feature
alwaysinstall elevated
reg query HKLM\Software\Policies\Microsoft\Windows\Installer'
- user msfvenom to create a new payload → just create a msi instead of an exe payload
regsrv escalation
- Get-Alc -Path search for regsvc interactive
- regsvc → FullControl allowed
- compile a new service
- install it with reg add
- sc start regsvc
executable files as a service
- replace current binary with backdoor
sc start filepermservice
startup applications
icacls.exe "c:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
- replace file
- logout and login to execute the payload
DLL hijacking
- search for an executable that uses a DLL
- run procmon.exe
- add filter: “result is NAME NOT FOUND”
- and “PATH ends with .dll”
- now search for something where we can write to
- add filter: “result is NAME NOT FOUND”
- windows_dll.c source code for creating a service
- could use msfvenom for this too