> 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/pt-br/web/xss/xss-reflected-in-an-attribute-with-encoded-angle-brackets.md).

# XSS Refletido em um Atributo com Colchetes Angulares Codificados

### XSS refletido em atributo com colchetes angulares codificados em HTML

Este laboratório contém uma vulnerabilidade de XSS refletida na funcionalidade de busca do blog: o conteúdo fornecido pelo usuário é injetado no valor de um `valor` atributo de um `<input>`, e os `<` e `>` sinais de menor e maior são codificados em HTML (`&lt;`, `&gt;`). O objetivo é injetar um novo atributo que dispare `alert()`.

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

#### Observações

* O texto inserido aparece no `valor` atributo da entrada.
* Tentar inserir `">test` é neutralizado pela codificação dos sinais de menor e maior, então você não pode abrir uma nova tag dessa forma.

```
">test
```

<figure><img src="/files/3939899d8adea8698815a0dfde7133cde315039c" alt=""><figcaption></figcaption></figure>

No entanto, como o valor está entre aspas, é possível fechar o `valor` valor e adicionar um novo atributo ao mesmo `<input>` elemento, injetando uma sequência que contenha uma aspa de fechamento.

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

<figure><img src="/files/1154d03ab2f7c77de26e1af144096ef919fa9e2a" alt=""><figcaption></figcaption></figure>

1. Feche o `valor` valor com uma aspa dupla injetada.
2. Adicione um novo atributo de evento (por exemplo, `onmouseover`) contendo a chamada para `alert()`.

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

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

* A carga útil fecha o `valor` atributo e adiciona `onmouseover="alert(0)"` ao `<input>` elemento.

<figure><img src="/files/9e1b953c0fcb371fce305d3ed0453761c743ee45" 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/pt-br/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.
