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

# XXE über das Hochladen eines bösartigen Bildes

Notizen zu XXE über das Hochladen eines bösartigen Bildes für Labs der PortSwigger Web Security Academy, einschließlich Ausnutzungs-Workflow, Payload-Tests, Burp-Suite-Validierung und Behebungskontext.

### Ausnutzung von XXE über den Upload von Bilddateien

Ausnutzen einer XXE-Schwachstelle durch das Senden eines bösartigen Bildes (SVG), das während der Verarbeitung durch die Apache-Batik-Bibliothek den Inhalt einer lokalen Datei preisgibt. Die Übung erfordert das Hochladen eines SVG-Avatars, der `/etc/hostname` den Inhalt anzeigt und dann den Hostnamen als Lösung einzureichen.

Die Website bietet ein Formular, um d的Avatar für Kommentare hinzuzufügen. Durch Abfangen des d

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b6c50bc60b50f0a6601edc7d2e993c688fcce39a%2F%7B5916D6B8-BF3F-4B83-81A1-7939B73F35DF%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-deb2d7e349fb839b8cfa7bc609d06c54d4c367d0%2F%7BDC74CA07-F8EC-417A-8DF2-5749BFA83626%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Erstelle eine SVG-Datei, die eine `<!DOCTYPE>` Anweisung, die eine externe Entität definiert, die auf `file:///etc/hostname` und füge dann diese Entität in den SVG-Text ein, sodass beim Rendern/Verarbeiten der Inhalt der Datei in das angezeigte Bild injiziert wird.

```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="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a343b3264d357cef21e140b4f35c0a4beda7e57b%2F%7B5AC5DB1F-C391-431C-9982-BD190FA54C67%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Nach dem Hochladen zeigt die Darstellung des Avatars im Kommentarbereich, dass der Server das SVG interpretiert und den Entitätswert zurückgegeben hat — den Inhalt von `/etc/hostname` erscheint im Bild, wodurch der Hostname ausgelesen und die Lösung eingereicht werden kann.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e2d53d5c99fede0707e750fa8d06ef7d64984257%2F%7BAC47938B-9598-40B7-851B-A27A65E30360%7D.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/de/web/xxe/xxe-via-malicious-image-upload.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
