> 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-reflected-in-an-attribute-with-encoded-angle-brackets.md).

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

### Отражённый XSS в атрибут с HTML-кодированием угловых скобок

В этом лабораторном задании есть уязвимость XSS, отражённая в функции поиска блога: содержимое, введённое пользователем, внедряется в значение `значение` атрибута `<input>`, и `<` и `>` угловые скобки кодируются в HTML (`&lt;`, `&gt;`). Цель — внедрить новый атрибут, который вызывает `alert()`.

<figure><img src="/files/5c3a4834ab4ad3156f33bcfd9ef1dd1b446d18a9" alt=""><figcaption></figcaption></figure>

#### Наблюдения

* Введённый текст появляется в `значение` атрибуте элемента input.
* Попытка вставить `">test` нейтрализуется кодированием угловых скобок, поэтому так нельзя открыть новый тег.

```
">test
```

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

Однако, поскольку значение заключено в кавычки, можно закрыть `значение` значение и добавить новый атрибут к тому же `<input>` элементу, внедрив последовательность, содержащую закрывающую кавычку.

```javascript
hola" test="hello
```

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

1. Закройте `значение` значение с помощью внедрённой двойной кавычки.
2. Добавьте новый событийный атрибут (например, `onmouseover`) содержащий вызов `alert()`.

```javascript
test" onmouseover="alert(0)
```

<figure><img src="/files/031d9ef502a4348de3bb054a0fd2e2d04f808a96" alt=""><figcaption></figcaption></figure>

* Полезная нагрузка закрывает `значение` атрибут и добавляет `onmouseover="alert(0)"` к `<input>` элементу.

<figure><img src="/files/acbff7dc21188c772f12c02721208f63c0bbc945" 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/xss/xss-reflected-in-an-attribute-with-encoded-angle-brackets.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.
