# 21) Reflected XSS into a template literal with angle brackets, single, double quotes, backslash and backticks Unicode-escaped

<div align="left"><figure><img src="/files/N5uK8SSc6JlUm0253zUs" alt=""><figcaption></figcaption></figure></div>

#### Locate possible injection points

As usual the first step is to analyse the application, we have a search functionnality so let's search for random string and then open the developer tools and find where the user input is located in the html

<div align="left"><figure><img src="/files/5PnHfgxmn92xJQLEqDHo" alt=""><figcaption></figcaption></figure></div>

as we see our input is reflected in a template literal

### template literal

JavaScript template literals are string literals that allow embedded JavaScript expressions. The embedded expressions are evaluated and are normally concatenated into the surrounding text. Template literals are encapsulated in backticks instead of normal quotation marks, and embedded expressions are identified using the `${...}` syntax.

then you can use the following payload to execute JavaScript without terminating the template literal:

```
${alert(1)}
```

### payload

```
xxxx${alert(1)}
```

<div align="left"><figure><img src="/files/GU9O4nJU57hBROZbEFN4" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="/files/CRBn5mLuPtY0PHHLXDqk" alt=""><figcaption></figcaption></figure></div>

and we have solved the lab

<div align="left"><figure><img src="/files/PuARpc1YTGMvchemXDy6" alt=""><figcaption></figcaption></figure></div>


---

# Agent Instructions: 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:

```
GET https://sayonara.gitbook.io/writeups/portswigger/xss/21-reflected-xss-into-a-template-literal-with-angle-brackets-single-double-quotes-backslash-and-back.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
