> 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 в атрибуте с закодированными угловыми скобками для лабораторных работ PortSwigger Web Security Academy, включая процесс эксплуатации, тестирование полезной нагрузки, проверку в Burp Suite и контек

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-fc2d30b77cffcc51f165ad90b2f460bde2bc136c%2F%7B71527070-CD57-4432-8AD8-7E00987CB4F4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

```
">test
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a8dc691e0f73938c9846c0ea77e00539a883ba46%2F%7B82974CE5-7E55-4164-8A8F-751731A6044B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-76f3542f81c6d34e368d6a5efa49f164bc665173%2F%7B850D47D6-C680-4C82-BD99-5AD8970B57D3%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2a68ee1711c4ef46404d981314e31082ad904249%2F%7B0E533FFC-4354-4775-8107-4E803A6783B4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c9ccfc3f244c3f139c144debed3eae8198b388e3%2F%7B192F39F4-2CA5-4E94-A757-93B77022B775%7D.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/xss/xss-reflected-in-an-attribute-with-encoded-angle-brackets.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.
