> 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/authentication-bypass-via-host-header.md).

# Evasión de autenticación mediante el encabezado Host

### Elusión de autenticación del encabezado Host

**Descripción del laboratorio**

Este laboratorio se basa en una mala hipótesis del lado del servidor: el nivel de privilegio del usuario se determina en función del valor del encabezado HTTP **Host**. / Al manipular este encabezado, es posible acceder a funciones reservadas al administrador.

\*\*Objetivo:\*\*/ Ir al panel de administración y eliminar al usuario **carlos**.

\*\*Comportamiento inicial observado\*\*

Cuando se intenta acceder a la página de administración con una solicitud estándar, se deniega el acceso.

Solicitud clásica:

```http
GET /admin HTTP/2
Host: 0aa100b30336117186f29ede001a0029.web-security-academy.net
```

Respuesta: acceso no autorizado

<figure><img src="/files/94d2f12647bf11c12a915cbe7d5c78e90a37567a" alt=""><figcaption></figcaption></figure>

**Análisis de la vulnerabilidad**

La aplicación parece conceder privilegios elevados cuando la solicitud proviene de un host considerado "interno" o de confianza, p. ej. **localhost**. / No se realiza ninguna verificación adicional para confirmar el origen real de la solicitud.

```http
Host: 0aa100b30336117186f29ede001a0029.web-security-academy.net
```

<figure><img src="/files/36c2f91bea961631f6354ca9ba386b8c20e78e1e" alt=""><figcaption></figcaption></figure>

**Explotación**

Simplemente cambie manualmente el **Host** valor del encabezado en la solicitud HTTP.

Solicitud modificada:

```http
Host: localhost
```

Resultado: acceso autorizado al panel de administración

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

**Acción final**

Una vez obtenido el acceso de administrador, es posible eliminar al usuario objetivo:

```bash
/admin/delete?username=carlos
```

<figure><img src="/files/1d294af1c23655d629fefbfb1c97171364a27dd1" 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/authentication-bypass-via-host-header.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.
