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

# XSS reflejado en un atributo con signos de menor que codificados

### XSS reflejado en un atributo con corchetes angulares codificados en HTML

Este laboratorio contiene una vulnerabilidad de XSS reflejada en la función de búsqueda del blog: el contenido proporcionado por el usuario se inyecta en el valor de un `valor` atributo de un `<input>`, y los `<` y `>` corchetes angulares están codificados en HTML (`&lt;`, `&gt;`). El objetivo es inyectar un nuevo atributo que active `alert()`.

<figure><img src="/files/50143c451a386adee91f51c86cb1229e2c18eec6" alt=""><figcaption></figcaption></figure>

#### Observaciones

* El texto introducido aparece en el `valor` atributo de la entrada.
* Intentar insertar `">test` es neutralizado al codificarse los corchetes angulares, por lo que no puedes abrir una nueva etiqueta de esta manera.

```
">test
```

<figure><img src="/files/83a2d751d1e7eda93947e0b381e684f4e2680219" alt=""><figcaption></figcaption></figure>

Sin embargo, dado que el valor va entre comillas, es posible cerrar el `valor` valor y añadir un nuevo atributo al mismo `<input>` elemento inyectando una secuencia que contenga una comilla de cierre.

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

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

1. Cierra el `valor` valor con una comilla doble inyectada.
2. Añade un nuevo atributo de evento (p. ej., `onmouseover`) que contenga la llamada a `alert()`.

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

<figure><img src="/files/434fd2d92329963f2277dba6261f90653e3f512f" alt=""><figcaption></figcaption></figure>

* La carga útil cierra el `valor` atributo y añade `onmouseover="alert(0)"` al `<input>` elemento.

<figure><img src="/files/33d96332a7d1623fc1755ca6db052d7a02394df2" 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/es/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.
