Overview
Machine author: xct. Windows Server Domain Controller. Domain: cicada.vl. Host:
DC-JPQ225.
Kill chain: a password on a sticky note in an image from an open NFS share, Kerberos authentication (NTLM disabled), ADCS vulnerable to ESC8, a Kerberos relay (bypassing the self-relay block) plus PetitPotam coercion, a certificate as the DC machine account, DCSync, the Administrator hash, a shell.
| |
The key lesson: how to perform ESC8 in an environment where NTLM is fully disabled, so the
classic NTLM relay does not work. The solution is a Kerberos relay using a crafted DNS
record containing a serialized (empty) CREDENTIAL_TARGET_INFORMATION structure, which
bypasses the self-relay restriction.
Reconnaissance
| |
- 53 (DNS), 88 (Kerberos), 389/636/3268/3269 (LDAP), 445 (SMB), 464 (kpasswd), 9389 (ADWS): a domain controller.
- 2049 (NFS) + 111 (rpcbind): unusual on a Windows DC, the main entry vector.
- 80 (IIS): later tied to ADCS Web Enrollment.
- SMB:
signing:True (required),SMBv1:False,NTLM:False(this determines the rest of the box). - LDAP TLS certificate:
CN=DC-JPQ225.cicada.vl.
| |
NTLM check:
| |
STATUS_NOT_SUPPORTED on NTLM means the environment enforces Kerberos. From now, add -k
to every tool and keep the clock synchronized.
Initial Access
NFS + password in an image
| |
/profiles maps to C:\Users. Most directories are empty, but two images are available:
| |
NFS maps permissions by UID/GID, not domain identity. marketing.png is -rwx------, but
NFS maps the owner to nobody, so local root (sudo cp) reads it anyway. root_squash
is often misconfigured; always try sudo on “no access” files.
vacation.png: a man with a laptop on a paraglider (a decoy).marketing.png: a woman at a desk, withCicada123visible on a yellow sticky note.
Candidate owner: Rosie.Powell (the directory the image came from).
Authenticate as Rosie.Powell (Kerberos)
| |
| |
| |
CertEnroll confirms AD CS on the DC. It holds only public keys and CRLs, but it is a
signal to enumerate ADCS.
Reusable TGT:
| |
Privilege Escalation
ADCS, identifying ESC8
| |
| |
No vulnerable templates (ESC1-7), but the CA itself is vulnerable to ESC8.
ESC8 = relaying authentication to the AD CS web enrollment endpoint
(http://<ca>/certsrv/certfnsh.asp):
- Coercion: force a privileged account (here the DC machine account) to authenticate to us (PetitPotam / PrinterBug / DFSCoerce / Coercer).
- Relay: pass the captured authentication to the web enrollment endpoint.
- Enroll as the victim: the CA issues a certificate for the relayed account (for a
machine account, the
DomainControllertemplate). - Use the certificate:
certipy auth-> PKINIT -> TGT and/or NT hash of the victim.
Why classic ESC8 does not work here:
- NTLM is disabled, so there is nothing to relay in the classic NTLM sense.
- NTLM self-relay is blocked (CVE-2019-1384/MIC and later protections; you cannot relay a machine’s authentication back to the same machine over NTLM).
The solution is a Kerberos relay.
ESC8 via a Kerberos relay (Linux path)
Kerberos is designed to resist relaying: a client requests a service ticket (ST) for a specific target SPN; a ticket encrypted with service A’s key does not work on service B. To relay Kerberos authentication, the victim must ask the KDC for a ticket for our host but connect to us so we can forward it.
Technique (Synacktiv / Tyranid’s Lair, James Forshaw):
- Create a DNS record pointing at our machine, whose name contains the target host plus a
serialized, empty
CREDENTIAL_TARGET_INFORMATIONstructure. - When the victim resolves that name and builds the SPN, Windows “thinks” it is connecting to the target service, but the traffic reaches our IP, and we forward the authentication to the real DC.
Record format: <host><serialized empty CREDENTIAL_TARGET_INFORMATION>. For this box:
DC-JPQ2251UWhRCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYBAAAA
Step 1, add the malicious DNS record:
| |
A regular authenticated domain user can create records in an AD-integrated zone (ADIDNS); no admin rights needed.
Step 2, start the relay (certipy):
| |
Use a current certipy (v5.x) that supports relay + Kerberos.
Step 3, check and choose a coercion method:
| |
Step 4, coerce (PetitPotam) with LISTENER = the malicious DNS record:
| |
LISTENER is the malicious DNS record, not a raw IP, so the victim requests a Kerberos
ticket and connects to us.
Relay result:
| |
A .pfx, the identity certificate of the machine account DC-JPQ225$.
Certificate to machine-account hash
| |
certipy auth performs PKINIT and returns a TGT plus the NT hash via the U2U/PAC
extension.
DCSync and shell
The DC machine account has directory replication rights (DS-Replication-Get-Changes*),
so DCSync:
| |
| |
The machine account does not get a shell directly, but its TGT is enough for DCSync, which gives the Administrator hash and full domain compromise.
Alternative path, RemoteKrbRelay (Windows VM)
MachineAccountQuota = 10 (default), so:
- Join your own Windows VM to the domain (
rosie.powell). - Run
RemoteKrbRelay.exe(CICADA8 / MzHmO), which automates coercion + Kerberos relay:
| |
| |
Detection and Mitigation
ESC8:
- Disable web enrollment over HTTP; enforce HTTPS with Extended Protection for Authentication (EPA / channel binding).
- Enable “Require SSL” on
certsrvin IIS. - Introduce request signing and separate CA and DC roles.
Relay / coercion:
- Disable unneeded services that enable coercion (Print Spooler on the DC, EFSRPC).
- Enforce SMB signing (already present here) and LDAP signing + channel binding.
- Monitor ADIDNS anomalies: authenticated users creating unusual DNS records.
NFS:
- Do not expose
C:\Usersover NFS; configureroot_squashand limit exports to specific hosts.
Detection (what to log):
- Event 4886/4887 (certificate requests and issuance on the CA): a sudden
DC$enrollment from theDomainControllertemplate. - Event 4768/4769: PKINIT / ST requests from unusual sources.
- Event 5136: DNS object modifications in AD.
- SMB traffic to unusual hosts after an EFSRPC /
EfsRpcAddUsersToFilecall.
Lessons Learned
- NFS on a Windows DC is a red flag; always
showmount -e; UID/GID mapping lets you bypass apparent lack of access withsudo. STATUS_NOT_SUPPORTEDmeans NTLM disabled; switch to Kerberos (-k) and synchronize the clock.- ESC8 does not require a vulnerable template; HTTP web enrollment is enough.
certipy find -vulnerableshows it at the CA level. - Kerberos relay bypasses the lack of NTLM / self-relay via a DNS record with a
serialized empty
CREDENTIAL_TARGET_INFORMATION. The key technique of this box. - PetitPotam was the most stable coercion;
coerce_plusoffers several methods. - The DC machine account is the key to the domain via DCSync, even without a direct shell.
- Two equivalent exploitation paths: Linux (bloodyAD + certipy relay) and Windows (domain-joined VM + RemoteKrbRelay).
Command Reference
| |