> 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/information-disclosure/authentication-bypass-via-information-disclosure.md).

# Contournement de l’authentification via divulgation d’informations

### Contournement de l'authentification via divulgation d'informations

L'interface d'administration de l'application inclut un mécanisme de contournement de l'authentification. Celui-ci repose sur un en-tête HTTP personnalisé utilisé par le front-end, mais inconnu a priori. / Pour résoudre le laboratoire, vous devez identifier le nom de cet en-tête, l'utiliser pour contourner l'authentification, accéder à l'interface d'administration et supprimer l'utilisateur **carlos**.

**Accès initial à l'interface d'administration**

Une tentative d'accès direct à la page d'administration via la `/admin` route renvoie le message suivant :

> *L'interface d'administration n'est disponible que pour les utilisateurs locaux*

Cela indique que l'accès est restreint aux requêtes provenant de l'hôte local.

<figure><img src="/files/205dc711475f07b96093c43067a65ccd7e33148b" alt=""><figcaption></figcaption></figure>

**Divulgation d'informations via la méthode TRACE**

En envoyant une requête HTTP avec la `TRACE` méthode à `/admin`, le serveur renvoie davantage d'en-têtes que nécessaire.

```bash
TRACE /admin
```

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

Parmi ces informations, un en-tête personnalisé est révélé :

```bash
X-Custom-Ip-Authorization
```

Cet en-tête est utilisé par le front-end pour déterminer si la requête provient d'un utilisateur local.

**Contournement de l'authentification**

L'ajout de l'en-tête suivant à une requête à `/admin`:

```bash
X-Custom-Ip-Authorization: 127.0.0.1
```

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

permet au serveur de considérer la requête comme locale. / L'interface d'administration devient alors accessible sans authentification supplémentaire.

**Exploitation finale**

Une fois connecté au panneau d'administration, il est possible de supprimer l'utilisateur cible en accédant à l'URL suivante :

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


---

# 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/information-disclosure/authentication-bypass-via-information-disclosure.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.
