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

# AMOR

### 1. RECONOCIMIENTO

Realizo un escaneo de puertos básico para identificar servicios abiertos:

```
nmap -sC -sV -p- --open -n -Pn 172.17.0.2
```

Encuentro lo siguiente:

* No consigo nada de interés, únicamente veo abiertos el puerto 80 y el 22.

***

### 2. ENUMERACIÓN

Enumero los directorios de la página para buscar rutas ocultas:

```
gobuster dir -u http://172.17.0.2 -w /usr/share/dirb/wordlists/big.txt -x php,html,txt
```

Resultados:

* Observo un directorio JavaScript abierto y lo tengo en cuenta para posibles explotaciones siguientes.

Hago un curl a la página para revisar el código fuente

```
curl -s http://172.17.0.2
```

Como veo que hay bastante código, decido acceder directamente por el navegador. Al observar el contenido, saco las siguientes conclusiones:

* Carlota y Juan son dos potenciales usuarios.
* El sitio nos da una pista: hay un usuario con una contraseña muy débil.

***

### 3. EXPLOTACIÓN

Realizo un ataque de fuerza bruta al usuario Carlota

```
hydra -l carlota -P /usr/share/wordlists/rockyou.txt ssh://172.17.0.2 -t 4
```

<figure><img src="https://3620341559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiE3IpoEbJxF5BQL5nIOG%2Fuploads%2FK1CCjkdwMQXXir88uLpl%2Fimage.png?alt=media&amp;token=49ef276b-d225-439c-bf53-a8c090e852ca" alt=""><figcaption></figcaption></figure>

Obtengo su contraseña y accedo por SSH para examinar el sistema:

```
ssh carlota@172.17.0.2
```

Hago un `sudo -l` pero veo que Carlota no tiene ningún permiso.&#x20;

![](https://3620341559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiE3IpoEbJxF5BQL5nIOG%2Fuploads%2FLBXBjG5JASabQ7FFBobt%2Fimage.png?alt=media\&token=c6bd6465-0022-4ea0-b216-83c1baffcdf7)

Reviso los usuarios del sistema y localizo a Oscar. Como con Carlota no puedo hacer nada, mi objetivo ahora es pivotar a su usuario.

Examino los archivos de Carlota buscando pistas:

```
find /home/carlota -type f 2>/dev/null
```

Localizo una imagen en la ruta: `/home/carlota/Desktop/fotos/vacaciones/imagen.jpg`. Me la traigo a mi máquina local con `scp` para analizarla a fondo:

```
scp carlota@172.17.0.2:/home/carlota/Desktop/fotos/vacaciones/imagen.jpg ~/Escritorio/
```

***

### 4. ESCALADA DE PRIVILEGIOS

Examino la imagen en busca de información oculta con stegseek:

```
stegseek imagen.jpg
```

<figure><img src="https://3620341559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiE3IpoEbJxF5BQL5nIOG%2Fuploads%2Fw0Z5fZfDOoEAP6rUUvr7%2Fimage.png?alt=media&amp;token=715b6ce4-cb54-4de4-ab7e-6b62a79d933b" alt=""><figcaption></figcaption></figure>

Encuentro un archivo extraído que contiene una cadena codificada. Procedo a descodificarla:

<figure><img src="https://3620341559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiE3IpoEbJxF5BQL5nIOG%2Fuploads%2FhJvp1ZMFZf6jXAp5S90x%2Fimage.png?alt=media&amp;token=01bcb50d-ef63-4072-8264-347f429521ee" alt=""><figcaption></figcaption></figure>

```
echo "ZXNsYWNhc2FkZXBpbnlwb24=" | base64 -d
```

Consigo una potencial contraseña para el usuario Oscar. Intento acceder por SSH y verifico sus privilegios:

```
ssh oscar@172.17.0.2
sudo -l
```

<figure><img src="https://3620341559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiE3IpoEbJxF5BQL5nIOG%2Fuploads%2FNICJMS4XXuF3etOmJ0bE%2Fimage.png?alt=media&amp;token=974c9aec-457f-4040-9773-85376f03582b" alt=""><figcaption></figcaption></figure>

Veo que Oscar sí tiene privilegios de sudo para ejecutar ciertos comandos. Aprovecho esta configuración para intentar subir al root.

***

### 5. POST-EXPLOTACIÓN

Logro elevar privilegios y accedo como root:

<figure><img src="https://3620341559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiE3IpoEbJxF5BQL5nIOG%2Fuploads%2FuJe6uWsSdM7JR1lq3ysS%2Fimage.png?alt=media&amp;token=fc6620c5-b255-4465-9c61-c68dedd93b20" 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/amor.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.
