> 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/stored-xss-in-onclick-with-full-encoding.md).

# XSS stocké dans onclick avec encodage complet

### XSS stocké dans l’événement onclick avec les chevrons et les guillemets doubles encodés en HTML, et les apostrophes simples et les antislashs échappés

Ce laboratoire contient une vulnérabilité XSS stockée dans la fonctionnalité de commentaires : la valeur d’un champ (name/author/website) est réutilisée dans un `onclick` attribut et encodé — `<` et `>` les chevrons et les guillemets doubles sont encodés en HTML, tandis que les apostrophes simples et les antislashs sont échappés.

Objectif : soumettre un commentaire pour exécuter `alert()` lors du clic sur le nom de l’auteur.

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

Dans le `site web` zone, la page injecte quelque chose comme :

```javascript
onclick="var tracker={track(){}};tracker.track('http://test.com');"
```

Les apostrophes simples sont représentées par le `&apos;` l’entité. Exemple :

```javascript
&apos;
```

* Lorsque `HTTP://hack.com&apos;test` est envoyé à la `&apos;` page sous forme d’une apostrophe (de sorte que l’apostrophe est présente côté DOM).

```javascript
<p>C&apos;est une merveilleuse journée </p>
```

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

* Profitez du fait que `&apos;` devient une apostrophe pour casser la chaîne JavaScript et injecter une opération de calcul/de concaténation qui appelle `alert()`.

<pre class="language-javascript"><code class="lang-javascript"><strong>HTTP://hack.com&#x26;apos;test
</strong></code></pre>

* Lorsque `HTTP://hack.com&apos;test` est envoyé à la `&apos;` page sous forme d’une apostrophe (de sorte que l’apostrophe est présente côté DOM).

<figure><img src="/files/333014d3da855d7a222e73470288983b5274beb1" alt=""><figcaption></figcaption></figure>

* Profitez du fait que `&apos;` devient une apostrophe pour casser la chaîne JavaScript et injecter une opération de calcul/de concaténation qui appelle `alert()`.

```javascript
http://hack.com&apos; + alert(0) + &apos;
```

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

<figure><img src="/files/7a80563ab16c5f6f4a495b1dc98895614c6286de" 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/stored-xss-in-onclick-with-full-encoding.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.
