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

# XSS في قالب حرفي مع أحرف Unicode مهربة

### ثغرة XSS منعكسة داخل حرفية قالب مع أقواس زاوية، وأقواس اقتباس مفردة ومزدوجة، والشرطة العكسية، وعلامات الـ backtick مُرمَّزة بتشفير Unicode

ثغرة XSS منعكسة في قالب حرفي (backticks) حيث `<` و `>` تُرمَّز الأقواس الزاوية وكذلك علامات الاقتباس المفردة والمزدوجة، وتُشفَّر علامة الـ backtick باستخدام Unicode. الهدف: التسبب في تنفيذ `alert()` داخل قالب السلسلة.

تُنعكس معلمة البحث داخل قالب حرفي في JavaScript. يجب كسر سلسلة القالب لتنفيذ `alert()` من القيمة المنعكسة.

<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/b14de2ad6371ed908b05a144f7a53d4b6a4bb9c3" alt=""><figcaption></figcaption></figure>

* حرف الـ backtick (`` ` ``) يحدد حرفية القالب؛ وتقوم الصفحة بتهريب backtick المُدخَل من المستخدم (على سبيل المثال، باستخدام ترميز Unicode)، مما يمنع الخروج البسيط.

<figure><img src="/files/16f067c04ce46248bc5e9bf96c1f70007cb837b6" alt=""><figcaption></figcaption></figure>

مثال على فرق الاستيفاء في JS (توضيح):

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

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

السطر الأول يعرض حرفيًا `${variable}`، أما السطر الثاني فيفسّر المتغير باستخدام backticks.

* محاولة إدراج تعبير استيفاء يتم تنفيذه `alert()`:

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

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