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

# XSS in einer literalen Vorlage mit maskierten Unicode-Zeichen

### Reflektiertes XSS in ein Template-Literal mit per Unicode-Escape maskierten spitzen Klammern, einfachen und doppelten Anführungszeichen, Backslash und Backticks

XSS wird in einem Template-Literal (Backticks) reflektiert, bei dem `<` und `>` spitze Klammern sowie einfache und doppelte Anführungszeichen codiert sind und der Backtick per Unicode-Escape maskiert ist. Das Ziel: die Ausführung von `alert()` innerhalb des String-Templates.

Der Suchparameter wird in einem JavaScript-Template-Literal reflektiert. Die Template-Zeichenkette muss aufgebrochen werden, um `alert()` aus dem reflektierten Wert heraus.

<pre class="language-javascript"><code class="lang-javascript">var message = `2 Suchergebnisse für 'test'` ;
<strong>document.getElementById('searchMessage').innerText = message;
</strong></code></pre>

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

* Das Backtick-Zeichen (`` ` ``) grenzt das Template-Literal ab; die Seite maskiert den vom Benutzer bereitgestellten Backtick (zum Beispiel durch Unicode-Escaping) und verhindert so einen einfachen Ausbruch.

<figure><img src="/files/81f4ef70eb50213dd0c1c68b7e1794608003d324" alt=""><figcaption></figcaption></figure>

Beispiel für den Unterschied bei JS-Interpolation (Veranschaulichung):

```javascript
variable = "Testen";
console.log("Die Variable ist: ${variable}")
console.log(`Die Variable ist: ${variable}`)
```

<figure><img src="/files/358c9424b3e44ea52c8efadd5708439170eed4a7" alt=""><figcaption></figcaption></figure>

Die erste Zeile zeigt wörtlich `${variable}`, die zweite interpretiert die Variable mit Backticks.

* Der Versuch, einen Interpolationsausdruck einzufügen, der `alert()`:

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

<figure><img src="/files/7a76df17e03bff554da55137d7545406d690e9fd" 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/de/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.
