PingPong is an insane-difficulty machine from Hack The Box with the following scenario: Assumed-breach creds (c.roberts) -> NTLM disabled so everything is Kerberos -> ADCS ESC13 enrollment of the TemporaryWinRM template -> PKINIT to recover c.roberts nthash and WinRM on DC1 -> discover a hidden second domain (pong.htb) behind a forest trust -> chisel reverse SOCKS5 + port forwards to reach DC2 -> cross-forest DACL abuse (foreign SID into gMSA Managers, groupType flip) -> read the Pong_gMSA$ password blob -> derive AES256 and mint a TGT -> JEA restricted endpoint + the ${path} file-as-variable trick to leak c.carlssen’s creds from PSReadLine history -> WinRM on DC2 as c.carlssen (user.txt) -> RBCD + S4U into MSSQL as c.adam -> xp_cmdshell -> GodPotato (SeImpersonatePrivilege) to SYSTEM on DC2 -> DCSync r.martinelli over the SOCKS pivot -> ADCS ESC4 to flip the SmartcardAuthentication template -> ESC1 enrollment with -sid (CVE-2022-26923) -> PKINIT to recover Administrator’s nthash -> root.txt.
This one is a monster. Two domain controllers, a forest trust, one of them completely hidden behind the other, NTLM disabled domain-wide so you live and breathe Kerberos the whole way, and a chain that bounces between ping.htb and pong.htb so many times I’m pretty sure that’s where the name comes from. Grab a coffee.
PingPong
Reconnaissance
We start as always with a quick ping to make sure the box is alive:
1
ping -c 2 10.129.26.198
1 2 3 4 5 6
PING 10.129.26.198 (10.129.26.198) 56(84) bytes of data. 64 bytes from 10.129.26.198: icmp_seq=1 ttl=127 time=363 ms 64 bytes from 10.129.26.198: icmp_seq=2 ttl=127 time=328 ms
PORT STATE SERVICE VERSION 53/tcp open domain Simple DNS Plus 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2026-04-28 14:25:04Z) 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: ping.htb0., Site: Default-First-Site-Name) 445/tcp open microsoft-ds? 464/tcp open kpasswd5? 593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 636/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: ping.htb0., Site: Default-First-Site-Name) 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: ping.htb0., Site: Default-First-Site-Name) 3269/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: ping.htb0., Site: Default-First-Site-Name) 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) 9389/tcp open adws? Service Info: Host: DC1; OS: Windows; CPE: cpe:/o:microsoft:windows
Classic domain controller fingerprint: Kerberos, LDAP, DNS, SMB, WinRM, ADWS. The host is DC1 and the domain is ping.htb. Let’s add it to our hosts file so Kerberos can resolve everything:
1
echo'10.129.26.198 ping.htb dc1.ping.htb DC1' | sudo tee -a /etc/hosts
Now, because the whole box runs on Kerberos, we need a proper krb5.conf. I’m going to be greedy here and already define both realms, since I have a strong feeling pong.htb is going to show up later (spoiler: it does). The PONG.HTB KDC points at 127.0.0.1:88 because once our pivot is up, that loopback port gets forwarded straight to DC2’s KDC:
Two very important things here. See that (NTLM:False)? And the STATUS_NOT_SUPPORTED instead of a login success/failure? That means NTLM authentication is disabled domain-wide. Every single authentication from this point forward has to be Kerberos. No pass-the-hash, no NTLM relay against the DC, nothing. We’re doing this the hard way.
One more quirk before we start: the lab clock is roughly 8 hours ahead of my Kali box. Kerberos is extremely picky about clock skew (that’s the whole KRB_AP_ERR_SKEW pain), so instead of fighting my system clock I’m going to wrap every Kerberos command in faketime -f '+8h'. You’ll see that prefix a lot.
Valid starting Expires Service principal 04/28/2026 08:14:46 04/28/2026 18:14:46 krbtgt/[email protected] renew until 04/29/2026 08:16:03
We have a valid ticket for c.roberts. Time to go hunting.
ESC13 - Enrolling the TemporaryWinRM template
The 593 (RPC over HTTP) and the overall AD-CS smell makes me want to check the certificate templates first. Let’s point certipy at the CA and look for anything vulnerable:
Template Name : TemporaryWinRM Display Name : Temporary WinRM Certificate Authorities : ping-DC1-CA Enabled : True Client Authentication : True Requires Manager Approval : False Schema Version : 2 Issuance Policies : 1.3.6.1.4.1.311.21.8.5808481.4086498.12600997.2067446.8927163.214.489503.1996623 Linked Groups : CN=TempWinRMAccess,CN=Users,DC=ping,DC=htb Permissions Enrollment Permissions Enrollment Rights : PING.HTB\Domain Admins PING.HTB\Domain Users PING.HTB\Enterprise Admins [+] User Enrollable Principals : PING.HTB\Domain Users [!] Vulnerabilities ESC13 : Template allows client authentication and issuance policy is linked to group 'CN=TempWinRMAccess,CN=Users,DC=ping,DC=htb'.
This is ESC13. The short version: this template’s issuance policy OID is linked (via msDS-OIDToGroupLink) to the security group TempWinRMAccess, and Domain Users are allowed to enroll. When we authenticate with PKINIT using a cert minted from this template, the KDC looks at that linked issuance policy and helpfully injects the TempWinRMAccess SID into the PAC of the resulting ticket. In other words: enrolling this cert effectively makes us a member of a group we were never added to - and that group grants WinRM on DC1.
[*] Successfully requested certificate [*] Got certificate with UPN '[email protected]' [*] Certificate object SID is 'S-1-5-21-750635624-2058721901-1932338391-2617' [*] Saving certificate and private key to 'c.roberts.pfx'
Two things worth pocketing here: the .pfx itself, and c.roberts’s SID S-1-5-21-750635624-2058721901-1932338391-2617. Write that SID down, we’re going to need it when we start abusing the trust.
Now we PKINIT with the cert to pull a TGT (and, for free, c.roberts’s NT hash via UnPAC-the-hash):
[*] Got TGT [*] Trying to retrieve NT hash for 'c.roberts' [*] Got hash for '[email protected]': aad3b435b51404eeaad3b435b51404ee:2475be69d40e815588a85fd89c7a439d
The ticket in our cache now carries the TempWinRMAccess SID thanks to ESC13, so let’s WinRM into DC1 and do some local recon. I want my token’s groups, my IP config, and crucially, what DNS and the trust look like:
List of domain trusts: 0: pong pong.htb (NT 5) (Direct Outbound) (Direct Inbound) ( Attr: foresttrans ) 1: PING ping.htb (NT 5) (Forest Tree Root) (Primary Domain) (Native)
Okay, this is where the box opens up. Four things jumped out:
DC1 has a second NIC at 192.168.2.1/24 into a hidden network we can’t touch from our VPN.
There’s a DC2 at 192.168.2.2 serving pong.htb, completely hidden behind DC1.
There’s a forest trust between ping.htb and pong.htb.
My token now also carries PING\IT with SID ending in -2618. Remember that one, it’s the key to the trust abuse.
So the real target, pong.htb, is sitting on an isolated subnet that only DC1 can reach. We need a tunnel.
Pivoting DC1 -> DC2 with chisel
We’re going to use chisel to build a reverse tunnel from DC1 back to our Kali box, and forward all the ports we’ll need to reach DC2. First, the chisel server on our side:
1
/home/kali/pingpong/chisel server -p 9999 --reverse > /home/kali/pingpong/chisel-server.log 2>&1 &
1 2
server: Reverse tunnelling enabled server: Listening on http://0.0.0.0:9999
Then a quick HTTP server so DC1 can grab the chisel binary:
Small detour on how we drive WinRM. The evil-winrm heredoc gets clumsy for scripted commands, so I wrote a tiny pypsrp wrapper that gives much cleaner control over the remote runspace (and lets me target JEA configurations later):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import sys, os from pypsrp.wsman import WSMan from pypsrp.powershell import PowerShell, RunspacePool
wsman = WSMan(server, port=5985, ssl=False, auth='kerberos', encryption='always', cert_validation=False, negotiate_service=nego_svc) with RunspacePool(wsman, configuration_name=config_name) as pool: ps = PowerShell(pool); ps.add_script(script) for o in ps.invoke(): print(o) if ps.had_errors: for s in ps.streams.error: print("ERR:", s, file=sys.stderr)
One gotcha: DC1 only registers the SPN HTTP/dc1.ping.htb, but pypsrp defaults to WSMAN/. So whenever I use this script against DC1 I pass NEGO_SVC=HTTP to switch the service class, otherwise Kerberos refuses to hand out the ticket.
Now the fun part. We upload chisel to DC1 and start a reverse client that forwards a SOCKS proxy plus every DC2 port we care about - WinRM, SMB, MSSQL, Kerberos, LDAP(S), RPC - all back to loopback on Kali:
Notice I mapped DC2’s MSSQL 1433 to local 1434 just to avoid clashing with anything local. From now on, 127.0.0.1 on my Kali box is DC2 for most services, which is exactly why the PONG.HTB KDC in our krb5.conf pointed at 127.0.0.1:88.
Last piece of plumbing: add DC2 to our hosts file. The FQDN has to come first:
1
echo'127.0.0.1 dc2.pong.htb DC2 pong.htb' | sudo tee -a /etc/hosts
Why FQDN first? Because MIT krb5 uses the first hostname matching an IP for SPN canonicalization. If pong.htb came first, gssapi would go request WSMAN/pong.htb and Kerberos would faceplant. Little detail, big headache if you get it wrong.
Cross-domain DACL chain -> ReadGMSAPassword on Pong_gMSA$
Now we abuse the forest trust. Remember our token carries PING\IT (SID -2618). Let’s see what that gets us over on pong.htb. First, pre-fetch the cross-realm referral TGT and an LDAP TGS for DC2 (this forces the PONG.HTB referral through the trust):
Look at the owner (O:) of that security descriptor: S-1-5-21-750635624-2058721901-1932338391-2618. That’s PING\IT - the group we’re already in across the trust. Owning an object gives us an implicit WriteDacl, so we effectively control this group from the other forest.
The plan is to add c.roberts (a foreign principal, since we’re PING and the group is PONG) as a member of gMSA Managers. But AD makes that annoying on purpose:
First, grant ourselves an explicit GenericAll so bloodyAD’s subsequent writes are unambiguous.
The group is currently a Global security group (groupType: -2147483646), and Global groups can’t hold foreign principals. Universal groups reject foreign security principals too (ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS). Only DomainLocal groups accept them. So we have to flip Global -> Universal -> DomainLocal.
[+] S-1-5-21-750635624-2058721901-1932338391-2617 added to CN=gMSA Managers,CN=Users,DC=pong,DC=htb
Group membership lands in the PAC, and our current ticket was issued before we added ourselves, so it won’t reflect the change. We re-mint a fresh TGT to pick up the new membership:
msDS-SupportedEncryptionTypes: 28 means AES only. The NT hash from the blob is useless to us (NTLM is disabled anyway), so we have to derive the AES256 key ourselves.
Deriving AES256 for Pong_gMSA$ and minting a TGT
gMSA passwords are 256-byte blobs of random UTF-16. To turn that into a usable Kerberos key we run it through the AES string-to-key with the account’s salt. The salt format for a machine/managed account is <UPPER-REALM>host<lowercase sam without the $>.<lowercase dnsHostName>, which for us works out to PONG.HTBhostpong_gmsa.pong.htb:
We now hold a Kerberos identity on pong.htb. The question is what Pong_gMSA$ can actually do.
JEA on DC1 as Pong_gMSA$ -> stealing c.carlssen’s creds
It turns out Pong_gMSA$ has access to a constrained JEA (Just Enough Administration) endpoint back on DC1 called restricted. Let’s pre-fetch the cross-realm TGS (this time PONG -> PING, the other direction of the trust) for the WinRM SPN:
So: no Get-Content, no FileSystem provider, no method invocation, no nothing. This looks like a dead end… except for one lovely piece of PowerShell language syntax that survives ConstrainedLanguage. ${C:\path\to\file} isn’t a cmdlet - it’s a variable reference to a file via the FileSystem provider, and it reads the file contents straight into a variable. JEA whitelists cmdlets, not language syntax, so this slips right through.
The obvious target is the gMSA’s own PSReadLine history:
And there it is, sitting in cleartext at the bottom of the history file: c.carlssen / A()DUJ!@414. Someone left their credentials in a one-liner. Classic.
WinRM on DC2 as c.carlssen -> user.txt
Grab a TGT for c.carlssen through the tunnelled KDC:
Then PSRemote into DC2 and grab the user flag (I’m using [System.IO.File]::ReadAllText since that goes through a normal, full-language runspace here):
pong\IT Service Admins Group S-1-5-21-2410575906-3092493790-2123333151-1108 ... BUILTIN\Remote Management Users ...
7744750761c41153d78c50526441dbe6
USER FLAG: 7744750761c41153d78c50526441dbe6
And notice c.carlssen sits in pong\IT Service Admins - which is exactly the lever we need for the next step.
RBCD on svc_sql -> S4U -> MSSQL as c.adam
Let’s enumerate the pieces for a resource-based constrained delegation attack. We want the SQL service account, the account mapped to sysadmin, and the principal we’ll use as the RBCD “actor”:
So svc_sql runs the MSSQL service (mssqlsvc/dc2.pong.htb), and c.adam is a Database Admins member, which maps to sysadmin inside SQL. The idea: as IT Service Admins, c.carlssen can write msDS-AllowedToActOnBehalfOfOtherIdentity on svc_sql. We point it at Pong_gMSA$ (a principal we already fully control), then use S4U2Self/S4U2Proxy to mint an MSSQL service ticket as c.adam.
SQL (pong\C.Adam dbo@master)> 1 -- IS_SRVROLEMEMBER('sysadmin') INFO(DC2): Configuration option 'xp_cmdshell' changed from 0 to 1. pong\svc_sql -- xp_cmdshell runs as the service account
SeImpersonatePrivilege Impersonate a client after authentication Enabled SeCreateGlobalPrivilege Create global objects Enabled
We’re sysadmin, command execution runs in the pong\svc_sql context, and - the magic words - SeImpersonatePrivilege is Enabled. That’s a free ticket to SYSTEM via a Potato attack.
We stage it to C:\ProgramData\gp.exe on DC2. Since we’re driving everything through WinRM as c.carlssen, I base64-embed the binary into a PowerShell script and write it out with [System.IO.File]::WriteAllBytes, then loosen the ACL so the SQL service account can execute it:
Now, back in the MSSQL shell, we fire GodPotato through xp_cmdshell. Since we have SYSTEM via the potato, the cleanest move is to add c.carlssen to the local Administrators group on DC2:
[*] CurrentUser: NT AUTHORITY\NETWORK SERVICE [*] Find System Token : True [*] CurrentUser: NT AUTHORITY\SYSTEM [*] process start with pid 3272 The command completed successfully.
Members ------------------------------------------------------------------------------- Administrator C.Carlssen Domain Admins Enterprise Admins
c.carlssen is now a local admin on DC2 - and DC2 is a domain controller, so this is effectively domain-admin-equivalent on pong.htb. Which means DCSync is on the table.
DCSync r.martinelli
First, renew c.carlssen’s TGT so the PAC carries the brand-new local Administrators membership:
DCSync uses DRSUAPI over dynamic RPC ports, and forwarding the entire high-port range through chisel is a pain. Instead we just route the whole impacket process through the SOCKS5 proxy with proxychains:
Why r.martinelli specifically? Because this user has rights over on the ping.htb side of the trust that let us go finish off DC1. Since NTLM is dead, we grab a TGT with the AES256 key:
ESC4 -> making SmartcardAuthentication vulnerable to ESC1
r.martinelli has write access over the SmartcardAuthentication certificate template on DC1’s CA. That’s ESC4 - and ESC4 is really just “I can turn any template into an ESC1”. Let’s cross the trust toward DC1 by pre-fetching a TGS for ldap/dc1.ping.htb:
The template is already published on ping-DC1-CA and already has the Client Authentication EKU (1.3.6.1.5.5.7.3.2). So all we have to do is make three edits: set ENROLLEE_SUPPLIES_SUBJECT, drop the manager-approval flag, and let Authenticated Users enroll:
[+] ...'s msPKI-Certificate-Name-Flag has been updated [+] ...'s msPKI-Enrollment-Flag has been updated [+] S-1-5-11 has now GenericAll on CN=SmartcardAuthentication,...
What we just did, in a table:
Attribute
New value
Effect
msPKI-Certificate-Name-Flag
1 (ENROLLEE_SUPPLIES_SUBJECT)
Enrollee gets to pick their own SAN/UPN - the core ESC1 condition
We go back to our humble c.roberts ticket to enroll (any authenticated user works now), requesting a cert with the Administrator UPN and the Administrator SID baked in:
[*] Successfully requested certificate [*] Got certificate with UPN '[email protected]' [*] Certificate object SID is 'S-1-5-21-750635624-2058721901-1932338391-500'
The -sid is non-negotiable on patched DCs because of CVE-2022-26923 / StrongCertificateBindingEnforcement - without the SID in the certificate, the KDC won’t strongly map it to the Administrator account. -dynamic-endpoint tells certipy to go through the RPC endpoint mapper instead of a hardcoded port, which was the only way to reach the CA in this tunnelled setup.
PKINIT with the cert to recover Administrator’s NT hash and a TGT:
PingPong absolutely earns its insane rating, but not because any single step is exotic - it’s the orchestration. You never stop living inside Kerberos, you’re constantly bouncing a ticket from one realm to the other to satisfy the trust, and the whole back half of the box only exists behind a tunnel you have to build yourself. If you lose track of which .ccache you’re holding or which direction of the trust you’re crossing, you’ll spin for hours.