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

Fries

22 Nov 2025 · 10 min read · root access
Fries — Hack The Box machine

Executive summary — Fries is a Hard box with two systems behind the same IP: a Docker host (Ubuntu) and an AD DC (Windows Server 2019). Assumed breach with d.cooper. A 6-phase chain: a Postgres secret in Gitea's commit history → Postgres RCE (COPY TO PROGRAM) → root shell in a container → L3 pivot with Ligolo + the Docker API reached with a forged cert built from CA material stolen over NFS (insecure + GID spoof) → real root of the Linux host and user.txt → RCE in pgAdmin (CVE-2025-2945) → env vars → a default password reused over SSH (svc) → redirecting PWM's LDAPS to capture svc_infra in cleartext → ReadGMSAPassword over gMSA_CA_prod$ → WinRM on the CA → AD CS ESC6+ESC16 enabled via a local COM object (ESC7 over RPC was blocked) → an Administrator certificate → NTLM → Domain Admin and root.txt.

PlatformHack The Box
Operating systemUbuntu (Docker host) + Windows Server 2019 (DC01, fries.htb) — two systems, one IP
DifficultyHard
StatusRetired
ScenarioAssumed breach (d.cooper@fries.htb / D4LE11maan!!)
tun0 (attacker)<ATTACKER_IP>
Target IP<TARGET_IP>

Attack map

[1] Gitea (code.fries.htb, creds provistas) -> .env en historial -> root:PsqLR00tpaSS11 (Postgres)
        |
[2] pgAdmin (db-mgmt05) -> server Postgres superuser -> COPY TO PROGRAM -> shell en contenedor postgres
      DNS Docker -> host en 172.18.0.1 (SSH/RPC/NFS)
        |
[3] Ligolo L3 (CAP_NET_ADMIN) -> ruta 172.18.0.0/16 -> NFS /srv/web.fries.htb (insecure)
      spoof GID -> ca.pem+ca-key.pem -> cert cliente CN=root -> Docker API TLS ->
      run -v /:/mnt/hostroot -> root real del host  ->  user.txt
        |
[4] pgAdmin RCE (CVE-2025-2945, atacar IP interna por SNI) -> env PGADMIN_DEFAULT_PASSWORD
      -> reutilizada por SSH: svc@172.18.0.1
        |
[5] PwmConfiguration.xml -> redirigir ldaps://dc01 a listener propio (SAN+pinning) ->
      capturar simple bind -> svc_infra:m6tneOMAh5p0wQ0d
        |
[6] BloodHound -> ReadGMSAPassword sobre gMSA_CA_prod$ -> WinRM en el CA ->
      ESC7 RPC BLOQUEADO -> activar ESC6+ESC16 via COM local (CertificateAuthority.Admin) ->
      certipy req -upn administrator (como svc_infra) -> cert sin SID -> LDAP/Schannel -> NTLM admin
      +-> evil-winrm PtH  ->  root.txt

1. Gitea — secrets in commit history

With d.cooper@fries.htb:D4LE11maan!! we reach Gitea at code.fries.htb (user dale). There's a private repo dale/fries.htb with the site's Flask code. The README drops a hint about an internal tool:

«The backend database can be managed from http://db-mgmt05.fries.htb. (requires infra access, contact Dylan, Mike or Dale)»

The current code loads config from a .env (and doesn't commit it), but the history still holds the cleartext values from an earlier commit:

curl -s -b gitea_cookies.txt -H "Host: code.fries.htb" \
  "http://<TARGET_IP>/dale/fries.htb/raw/commit/<hash>/.env"
DATABASE_URL=postgresql://root:PsqLR00tpaSS11@172.18.0.3:5432/ps_db
SECRET_KEY=y0st528wn1idjk3b9a

The repo also mistakenly included __pycache__/*.pyc: its metadata reveals build paths (/root/scripts/project/, /app/app/) that confirm a Docker deployment — no new secrets, but useful orientation.

echo "<TARGET_IP> fries.htb code.fries.htb db-mgmt05.fries.htb" | sudo tee -a /etc/hosts
🔒 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.