> 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/reflected-xss-with-custom-tags-only.md).

# XSS منعكس مع وسوم مخصصة فقط

### XSS معكوس إلى سياق HTML مع حظر جميع الوسوم باستثناء الوسوم المخصصة

يحظر هذا التطبيق جميع وسوم HTML «الكلاسيكية»؛ ولا يُسمح إلا بالعناصر المخصصة. هدف المختبر هو حقن وسم مخصص ينفذ تلقائيًا `alert(document.cookie)` (هنا تريد سرقة ملف تعريف ارتباط الجلسة عبر alert).

الملاحظات والمنهجية (معاد الصياغة)

* بما أن جميع الوسوم القياسية مُرشَّحة، فالتقنية هي تعريف/إدراج وسم مخصص يقبله المتصفح.
* قد يحتوي العنصر المخصص على معالجات أحداث — لكن بعض الأحداث لا تحدث إلا إذا كان العنصر قادرًا على تلقي التركيز.
* العناصر المخصصة لا تكون قابلة للتركيز افتراضيًا؛ لذلك من الضروري فرض التركيز بإضافة `tabindex=1` حتى يعمل الحدث المرتبط عند التفاعل (مثلًا بالنقر أو باستخدام Tab).

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

1. وسم بسيط — غير قابل للتركيز (لا ينفذ alert):

```javascript
<jordan onfocus=alert(0)>HELLO
```

2. نفس الوسم، مع جعله قابلًا للتركيز بواسطة `tabindex` — `onfocus` يعمل:

```javascript
<jordan onfocus=alert(0) tabindex=1>HELLO
```

<figure><img src="/files/5583fc636989483144cecef47f3f2d19bf8ed1df" alt=""><figcaption></figcaption></figure>

إثبات المفهوم النهائي (تسريب البيانات عبر إعادة التوجيه)

* نبني عنوان URL يحقن الوسم المخصص مع `onfocus` استدعاء `alert(document.cookie)` وفرض التركيز بواسطة `tabindex=1`.
* مثال على الحمولة لإرسالها إلى الضحية (الحقن مُشفّرًا بعنوان URL في `search` المعلمة):

{% code overflow="wrap" %}

```javascript
<script>
location = 'https://0a07009c03dde34d825bba7b0028004d.web-security-academy.net/?search=%3Cjordan%20id=x%20onfocus=alert(document.cookie)%20tabindex=1%3E#x';
</script>
```

{% endcode %}


---

# 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/reflected-xss-with-custom-tags-only.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.
