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

# XSS réfléchi dans un attribut avec chevrons encodés

### XSS réfléchi dans un attribut avec les chevrons encodés en HTML

Ce laboratoire contient une vulnérabilité XSS réfléchie dans la fonctionnalité de recherche du blog : le contenu fourni par l'utilisateur est injecté dans la valeur d'un `valeur` attribut d'un `<input>`, et les `<` et `>` chevrons sont encodés en HTML (`&lt;`, `&gt;`). Le but est d'injecter un nouvel attribut qui déclenche `alert()`.

<figure><img src="/files/0232d22cf6cabe5eaa6a6dfa7cef6c290ff68310" alt=""><figcaption></figcaption></figure>

#### Observations

* Le texte saisi apparaît dans l' `valeur` attribut du champ de saisie.
* Essayer d'insérer `">test` est neutralisé par l'encodage des chevrons, vous ne pouvez donc pas ouvrir une nouvelle balise de cette manière.

```
">test
```

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

Cependant, comme la valeur est entourée de guillemets, il est possible de fermer la `valeur` valeur et d'ajouter un nouvel attribut au même `<input>` élément en injectant une séquence contenant un guillemet fermant.

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

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

1. Fermez la `valeur` valeur avec un guillemet double injecté.
2. Ajoutez un nouvel attribut d'événement (par ex. `onmouseover`) contenant l'appel à `alert()`.

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

<figure><img src="/files/323c06ebea3ea3127b70d807a642a72e947e5bda" alt=""><figcaption></figcaption></figure>

* La charge utile ferme l' `valeur` attribut et ajoute `onmouseover="alert(0)"` à l' `<input>` élément.

<figure><img src="/files/0b6a189b1f69c968e183a5590c3d857523141e9a" 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/fr/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.
