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

# XSS en una plantilla literal con caracteres Unicode escapados

### XSS reflejado en un literal de plantilla con signos de menor y mayor, comillas simples, comillas dobles, barra invertida y acentos graves escapados en Unicode

XSS reflejado en una plantilla literal (acentos graves) donde `<` y `>` los signos de menor y mayor, así como las comillas simples y dobles, están codificados, y el acento grave está escapado en Unicode. El objetivo: provocar la ejecución de `alert()` dentro de la plantilla de cadena.

El parámetro de búsqueda se refleja en una plantilla literal de JavaScript. La cadena de plantilla debe romperse para ejecutar `alert()` a partir del valor reflejado.

<pre class="language-javascript"><code class="lang-javascript">var message = `2 resultados de búsqueda para 'test'`;
<strong>document.getElementById('searchMessage').innerText = message;
</strong></code></pre>

<figure><img src="/files/1f9293ef156eb8ff66fd42f78c3705c83aae4a83" alt=""><figcaption></figcaption></figure>

* El carácter de acento grave (`` ` ``) delimita el literal de plantilla; la página escapa el acento grave proporcionado por el usuario (por ejemplo, usando escape Unicode), lo que impide una ruptura simple.

<figure><img src="/files/5163aba2995257814311aedc0ce3e0ea18258318" alt=""><figcaption></figcaption></figure>

Ejemplo de la diferencia de interpolación en JS (ilustración):

```javascript
variable = "Prueba";
console.log("La variable es: ${variable}")
console.log(`La variable es: ${variable}`)
```

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

La primera línea muestra literalmente `${variable}`, la segunda interpreta la variable con acentos graves.

* Intentando insertar una expresión de interpolación que ejecute `alert()`:

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

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