PetitPotam
ABOUT
PetitPotam (CVE-2021-36942) is an LSA spoofing vulnerability patched in August 2021.
It allows an unauthenticated attacker to coerce a Domain Controller (DC) into authenticating to a malicious host via NTLM over LSARPC (port 445) by abusing the MS-EFSRPC interface. When combined with misconfigured Active Directory Certificate Services (AD CS), the attacker can relay this authentication to the CA’s Web Enrollment interface, submit a malicious Certificate Signing Request (CSR), and obtain a certificate usable for domain compromise.
Prerequisites
EFSRPC or Print Spooler enabled on DC
AD CS with Web Enrollment + vulnerable template
SMB signing not required (or relaying to HTTP)
PetitPotam
+Impacket
+Certipy
FLOW
Vulnerability itself only coercing an auth. But as example if we combine it to NTLM relay to ADCS, we could make a big impact.
1. Getting TGT
Setup the Trap with
ntlmrelayx.py
Force Auth with
PetitPotam.py
so DC is trying to auth to usRelay the Auth to ADCS
Get the Cert if ADCS is misconfigured, so it thinks we are DC
Become DC (Kerberos). We could use cert to ask for DC's TGT.
After getting DC's TGT there are different options:
DCSync with using TGT
2. Stealing Hash for DCSync
Using the TGT: The tool uses the TGT in your cache to communicate with the Key Distribution Center (KDC).
User-to-User Request: It sends a Kerberos User-to-User (U2U) request to the KDC, asking for a Service Ticket for the DC machine account.
PAC: The service ticket contains a Privileged Attribute Certificate (PAC) with the NTLM hash of the machine account.
Decrypting the Ticket: Using the AS-REP encryption key from TGT we captured earlier, the tool decrypts the ticket and extracts the PAC, which includes the NTLM hash.
Extracting the Hash: The NTLM hash (e.g.,
313b6f...
) is then extracted from the PAC data.
3. Stealing Base64 Cert for TGT and PTT
Here we are using Rubeus and mimikatz, so this variation is for windows
Get a base64 Cert (from
ntlmrelayx.py
part)Using
Rubeus
with cert for TGT requestConfirming ticket in memory
DCSync with
mimikatz
LINUX
Starting ntlmrelay.py
Here we are relaying NTLM request and getting a AD CS certificate
PetitPotam
Requesting TGT with gettgtpkinit.py
Setting TGT Environment Variable
Using DC's TGT for DCSync
This is part from point 2 in Flow section, where getting hash for TGT. That's why I separated it with line above.
TGS Request to extract a hash