> For the complete documentation index, see [llms.txt](https://itskode.gitbook.io/pentesting/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://itskode.gitbook.io/pentesting/dockerlabs/facil/injection.md).

# Injection

## Enumeración

Se comienza realizando un escaneo de puertos con nmap, identificando un servicio web y SSH.

![](/files/N0dfQIYnZTYuPwGrr7ZI)

Se accede al servicio web donde se observa un panel de login.

<div align="left"><img src="/files/pNXQSQDgybcsomt82lW5" alt=""></div>

***

## Explotación -- SQL Injection

Se prueba una inyección SQL básica:

```
' OR 1=1 -- -
```

El sistema resulta vulnerable y devuelve credenciales válidas del usuario.

![](/files/SXr3Ryj0bcz8VF83MTKp)

Se obtiene usuario y contraseña del usuario **dylan**.

***

## Acceso inicial

Con las credenciales obtenidas, se accede al sistema vía SSH.

<div align="left"><img src="/files/489XdRoNLNfMHDIjwanP" alt=""></div>

Se obtiene una shell como usuario dylan.

***

## Escalada de privilegios

Se enumeran binarios SUID en el sistema:

<div align="left"><img src="/files/WSQn5XRqhCaROi5z8hlX" alt=""></div>

Se identifica el uso de `/usr/bin/env` como vector de escalada.

Se ejecuta:

```
/usr/bin/env /bin/sh -p
```

Obteniendo privilegios de root.

<div align="left"><img src="/files/RlFbciDEF2CvngluuYT4" alt=""></div>

***

## Post-Explotación

Una vez con acceso root, se continúa la enumeración del sistema.

Se localiza un archivo de configuración con credenciales de base de datos:

<div align="left"><img src="/files/FJ8BdMYSzhYlfcO2VY72" alt=""></div>

Se accede a la base de datos utilizando dichas credenciales:

<div align="left"><img src="/files/Ho1k9WLRaqb5RaONAGcl" alt=""></div>

Se listan bases de datos y tablas, confirmando acceso completo.

***

## Conclusión

Esta máquina demuestra cómo una vulnerabilidad de SQL Injection puede derivar en compromiso completo del sistema cuando se combina con malas prácticas en la gestión de credenciales y permisos.

### Puntos clave

* SQL Injection en login
* Reutilización de credenciales
* Binarios SUID inseguros
* Exposición de credenciales en archivos de configuración

***

## Recomendaciones

* Validar correctamente entradas en formularios
* Evitar concatenación directa en consultas SQL
* Restringir binarios SUID
* Proteger archivos de configuración sensibles


---

# 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://itskode.gitbook.io/pentesting/dockerlabs/facil/injection.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.
