> 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/access-control-based-on-the-referer-header.md).

# Contrôle d'accès basé sur l'en-tête Referer

### Contrôle d'accès basé sur le Referer

Ce laboratoire applique un contrôle d'accès aux fonctionnalités d'administration basé sur l'en-tête **Referer**. / Vous pouvez d'abord explorer le panneau d'administration en vous connectant avec **administrator:admin** des identifiants.

Pour résoudre le laboratoire, vous devez vous connecter avec l'utilisateur **wiener:peter** et utiliser la mauvaise validation du Referer pour obtenir un rôle administrateur.

#### **1. Contexte**

* Cookie de session pour *wiener*

```bash
cIA2AyZn2GhizvLK7VR8SUCMcdezZcFl
```

* Lorsque l'on tente de changer de rôle sans en-tête supplémentaire, l'application refuse l'accès :

```http
GET /admin-roles?username=wiener&action=upgrade HTTP/2
Host: 0a19008c034b40de834b14e0009a0062.web-security-academy.net
Cookie: session=cIA2AyZn2GhizvLK7VR8SUCMcdezZcFl
```

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

La réponse indique que l'utilisateur ne dispose pas des droits nécessaires.

#### **2. Contournement de la vérification du Referer**

Si l'on ajoute un en-tête **Referer** pointant vers une page d'administration légitime, l'application accepte l'opération

```bash
Referer: https://0a19008c034b40de834b14e0009a0062.web-security-academy.net/admin
```

Avec cet en-tête ajouté, la promotion de wiener devient possible et l'accès administrateur est obtenu.

<figure><img src="/files/7d57290721d221288a8969ac7874aad08c2f70c6" 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/fr/web/access-control/access-control-based-on-the-referer-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.
