root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat hercules.md
// writeups

Hercules

18 Oct 2025 · 23 min read · root access
Hercules — Hack The Box machine

Executive summary — Hercules is, by far, the longest and most heavily chained Active Directory box I've solved: seven distinct exploitation phases, each depending on the previous one. The environment has NTLM disabled domain-wide for authentication and lateral movement — Pass-the-Hash doesn't work, every credential has to become a Kerberos TGT (password, NT hash via getTGT.py -hashes, or a certificate via PKINIT). The initial vector is a blind LDAP injection in a custom SSO login form, bypassing the filter with double URL-encoding. From there the chain combines classic web exploitation (path traversal, cryptographic forgery of an .ASPXAUTH cookie via 100% empirical reverse engineering of a proprietary binary format), NTLM authentication coercion via a malicious OpenDocument file, and a full battery of modern Active Directory abuse techniques: Shadow Credentials chained with a ModifyDN between OUs to inherit ACLs, a hidden OU invisible to BloodHound, ADCS ESC3 with an Enrollment Agent on-behalf-of request, a race condition against SDProp/adminCount won by running detection and action in a single remote session, and finally RBCD combined with an advanced Kerberos session-key synchronisation technique to force a forwardable U2U S4U2Self ticket on an account with no SPN. The whole chain is pure Kerberos end to end: not a single step uses NTLM/Pass-the-Hash to move through the domain.

PlatformHack The Box
Operating systemWindows Server (Domain Controller, single host)
DifficultyInsane
StatusActive
Domainhercules.htb / HERCULES.HTB
DC hostnamedc.hercules.htb
Target IP<TARGET_IP>

Attack map

FASE 1  /Login  ->  inyeccion LDAP ciega (doble URL-encoding, bypass de regex)
   oraculo booleano: "Login attempt failed" (TRUE) vs "Invalid login attempt" (FALSE)
   extraccion caracter a caracter -> description de johnathan.j
        |
        v
   "change*th1s_p@ssw()rd!!"  (contrasena reutilizada)  ->  kinit ken.w  (TGT de dominio)
        |
        v
FASE 2  /Home/Download  ->  path traversal con \\  ->  web.config  ->  machineKey robado
        |
        v
FASE 3  reversing 100% empirico del FormsAuthenticationTicket (.ASPXAUTH)
   IV + AES-256-CBC + HMAC-SHA256(externo) ... HMAC-SHA256(interno) sobre el "core"
   cookie forjada: ken.w, rol = "Web Administrators"  ->  desbloquea /Home/Forms
        |
        v
FASE 4  upload .odt malicioso (Bad-ODF) en /Home/Forms
   (.docx con ntlm_theft NO funciona -- el backend no renderiza Word real)
   Responder captura NetNTLMv2 de natalie.a  ->  hashcat/rockyou
        |
        v
   natalie.a : Prettyprincess123!
        |  Shadow Credentials (Web Support -> GenericWrite heredado)
        v
FASE 5  bob.w (hash NT)  --WRITE directo + ModifyDN-->  Auditor: Security Dept -> Web Dept
        |  hereda GenericWrite  ->  Shadow Credentials natalie.a -> auditor
        v
   auditor --[WinRM Kerberos+SSL]-->  USER.TXT
        |  GenericAll autoconcedido en OU oculta "Forest Migration"
        v
FASE 6  fernando.r (Smartcard Operators) habilitado
        |  ESC3: EnrollmentAgent -dcom + peticion on-behalf-of
        v
   ashley.b (IT Support, Remote Mgmt Users) -- solo certificado PKINIT, sin contrasena
        |  dispara tarea SYSTEM "Password Cleanup"
        |  CARRERA ganada: deteccion+accion en UNA sola sesion remota (359 ms)
        v
   IIS_Administrator (Service Operators) habilitado + contrasena reseteada
        |  Service Operators -> reset de password de cuentas de servicio
        v
FASE 7  iis_webserver$ (RBCD configurada desde el propio DC$)
        |  "session-key hash sync": TGT -> clave de sesion -> NT hash = clave de sesion
        |  reutilizar el MISMO ccache -> S4U2Self U2U -force-forwardable -> S4U2Proxy
        v
   Service Ticket cifs/dc.hercules.htb impersonando Administrator
        |  DCSync (MS-DRSR)
        v
   Administrator NT hash  ->  TGT  ->  WinRM Kerberos+SSL
        |
        v
                            ROOT.TXT

1. Reconnaissance

sudo nmap -p- -T4 --min-rate 3000 -Pn -n -oA nmap_alltcp <TARGET_IP>
PORT      STATE SERVICE
53/tcp    open  domain
80/tcp    open  http
88/tcp    open  kerberos-sec
135/tcp   open  msrpc
139/tcp   open  netbios-ssn
389/tcp   open  ldap
443/tcp   open  https
445/tcp   open  microsoft-ds
464/tcp   open  kpasswd5
593/tcp   open  http-rpc-epmap
636/tcp   open  ldapssl
3268/tcp  open  globalcatLDAP
3269/tcp  open  globalcatLDAPssl
5986/tcp  open  wsmans
9389/tcp  open  adws

A textbook Domain Controller port set. Two details shape the entire rest of the exploitation:

  • smb2-security-mode: signing enabled and required, null session rejected (NT_STATUS_NOT_SUPPORTED) and anonymous LDAP bind rejected — consistent with domain-wide NTLM being disabled.
  • 5985 (plain WinRM) is filtered, not closed; only 5986 (WinRM over SSL) responds. Any remote shell must negotiate Kerberos+TLS end to end.

Practical consequence: Pass-the-Hash is off the table for lateral movement across the whole box. Every credential obtained (password, NT hash, certificate) has to become a Kerberos TGT before it can be used.

We prepare the attacking environment for Kerberos:

# /etc/hosts
<TARGET_IP> hercules.htb dc.hercules.htb DC.hercules.htb HERCULES.HTB

# /etc/krb5.conf
[libdefaults]
    default_realm = HERCULES.HTB
    dns_lookup_kdc = false
    dns_lookup_realm = false
    rdns = false
    dns_canonicalize_hostname = false
    ignore_acceptor_hostname = true

[realms]
    HERCULES.HTB = {
        kdc = dc.hercules.htb
        admin_server = dc.hercules.htb
        default_domain = hercules.htb
    }

sudo ntpdate dc.hercules.htb   # Kerberos rejects clock skew > 5 min

Non-obvious technical note: without dns_canonicalize_hostname = false and ignore_acceptor_hostname = true, any tool using the operating system's gssapi/Kerberos library (ldapsearch -Y GSSAPI, ldap3 with SASL/Kerberos, pypsrp) fails with Server not found in Kerberos database, even though kinit/kvno prove the SPN is valid: the application-layer GSSAPI stack tries to canonicalise the target hostname before building the principal name, producing a name different from the real registered SPN. Tools with their own pure-Python Kerberos stack (bloodyAD, impacket) don't suffer from this.

🔒 Clearance required

Root Access unlocks the content you can't see — everything else on the site is already open.

See Root Access plans

No account? Create one free then upgrade from your console.