> 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-in-template-literal-with-escaped-unicode.md).

# XSS dans un modèle littéral avec caractères Unicode échappés

### XSS réfléchi dans un littéral de template avec des chevrons, des guillemets simples, des guillemets doubles, un antislash et des backticks échappés en Unicode

XSS réfléchi dans un littéral de template (backticks) où `<` et `>` les chevrons ainsi que les guillemets simples et doubles sont encodés, et le backtick est échappé en Unicode. L'objectif : provoquer l'exécution de `alert()` à l'intérieur du template de chaîne.

Le paramètre de recherche est réfléchi dans un littéral JavaScript. La chaîne template doit être rompue pour exécuter `alert()` à partir de la valeur réfléchie.

<pre class="language-javascript"><code class="lang-javascript">var message = `2 search results for 'test'`;
<strong>document.getElementById('searchMessage').innerText = message;
</strong></code></pre>

<figure><img src="/files/454f97af93d225e443c59f8718e3ad7bc2b02b4d" alt=""><figcaption></figcaption></figure>

* Le caractère backtick (`` ` ``) délimite le littéral de template ; la page échappe le backtick fourni par l'utilisateur (par exemple, en utilisant l'échappement Unicode), empêchant une simple sortie.

<figure><img src="/files/19ce924b6be8777a7ca81b199dadfe2cf5e48ea3" alt=""><figcaption></figcaption></figure>

Exemple de différence d'interpolation JS (illustration) :

```javascript
variable = "Testing";
console.log("The variable is: ${variable}")
console.log(`The variable is: ${variable}`)
```

<figure><img src="/files/890cd16d1c0eead6537f83e9a51b60c64a5bc430" alt=""><figcaption></figcaption></figure>

La première ligne affiche littéralement `${variable}`, la seconde interprète la variable avec les backticks.

* Essayer d'insérer une expression d'interpolation qui exécute `alert()`:

```javascript
${alert(0)}
```

<figure><img src="/files/915598037eff51bbd08423b83a2c6aebd55fd463" alt="" width="520"><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-in-template-literal-with-escaped-unicode.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.
