# HTTP Host header attacks

## HTTP Host header attacks <a href="#http-host-header-attacks" id="http-host-header-attacks"></a>

### Enunciado

Este laboratorio es vulnerable a *password reset poisoning*. El usuario carlos hará clic sin cuidado en cualquier enlace que reciba por correo electrónico. Inicia sesión en la cuenta de Carlos.

Puedes iniciar sesión en tu propia cuenta con las siguientes credenciales:

* **Usuario:** `wiener`
* **Contraseña:** `peter`

Cualquier correo enviado a esta cuenta puede leerse a través del cliente de correo en el servidor de exploits.

### Resolución

Pulsamos a olvidar contraseña a través del usuario de prueba y restablecemos la contraseña. Vemos las peticiones.

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

Cambiamos el host con el enlace del exploit server. Tras enviar la petición miramos en los logs y hay una petición GET con su token.

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

Si vamos a peticiones anteriores de restablecer contraseña y cambiamos el token por el anterior podemos enviar perfectamente la petición y cambiar la contraseña de carlos.

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

Nos sale que podemos cambiar la contraseña por lo que la cambiamos e interceptamos para cambiar otra vez el token y le damos a Forward. En definitiva, debemos de interceptar cada petición para cambiar el token.

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

## Lab: Host header authentication bypass

### Enunciado

Este laboratorio hace una suposición sobre el nivel de privilegio del usuario basándose en el encabezado HTTP Host. Accede al panel de administración y elimina al usuario **carlos**.

### Resolución

Mandamos al **Repeater** la petición.

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

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

Como dice de usuarios locales puede ser que si las peticiones vienen del mismo servidor no daría problema.

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

Confirmamos la suposición. Entonces interceptando otra vez la petición cambiando eso para eliminar a carlos.

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


---

# Agent Instructions: 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:

```
GET https://beafn28.gitbook.io/beafn28/web-security/laboratorios-portswigger/http-host-header-attacks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
