> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/es/writeups-ctf/hackthebox/linux-easy/keeper-hackthebox-writeup.md).

# Writeup de Keeper en HackTheBox

{% embed url="<https://app.hackthebox.com/machines/Keeper>" %}

{% hint style="warning" %}
**Habilidades:**

* Abusando de Request Tracker
* Fuga de información
* Obteniendo la contraseña de KeePass mediante un volcado de memoria (Escalada de privilegios)
  {% endhint %}

## Reconocimiento

**Configuración del espacio de trabajo:**

Configura el espacio de trabajo creando tres carpetas para almacenar contenido importante, exploits y resultados de reconocimiento de Nmap.

<figure><img src="/files/a91b9b6d0ce54fb3136faac4f51a061cb40447b9" alt="" width="563"><figcaption></figcaption></figure>

**Comprobación de conectividad VPN**/ Compruebe la conectividad VPN para garantizar una comunicación estable con la máquina objetivo.

<figure><img src="/files/00769b17eb18c8fd5ac5280795adaf1917516845" alt="" width="563"><figcaption></figcaption></figure>

**Búsqueda de puertos abiertos con Nmap: 22.80**

```bash
nmap -p- --open -n -Pn -vvv --min-rate 5000 10.10.11.227 -oG allPorts 
```

<figure><img src="/files/024d56262f8ae28ab962f3dc64bf138cc12bbcff" alt=""><figcaption></figcaption></figure>

**Escaneo de versiones de puertos con Nmap:** Usando Nmap para escanear la versión de los puertos y extraer la información al archivo "targeted":

```bash
nmap -sCV -p22,80 10.10.11.227 -oN targeted
```

<figure><img src="/files/f77b5bd320828cd8da14991c2f506c64b3335723" alt=""><figcaption></figcaption></figure>

### Puerto 80

Descubrimos el dominio **keeper.htb** y un subdominio **tickets.keeper.htb**.

<figure><img src="/files/7bcf790cd4343b8c30bd06a00ff97b46863da688" alt=""><figcaption></figcaption></figure>

Los añadimos al `/etc/hosts` archivo:

<figure><img src="/files/8587ee712f409d86f5c6e9848b28a1d1f0061792" alt=""><figcaption></figcaption></figure>

## CMS de Request Tracker

Visitando **tickets.keeper.htb** encontramos un panel de administración.

<figure><img src="/files/19d1f0fb24e176405ca22e2fd73a80ba658cdcfb" alt=""><figcaption></figcaption></figure>

Probamos las credenciales predeterminadas de **Request Tracker**:

```plaintext
Usuario: root  
Contraseña: password  
```

<figure><img src="/files/2edada4de5e205c1d2863b80d42f47d28fc9f1f2" alt=""><figcaption></figcaption></figure>

¡Conexión exitosa!

<figure><img src="/files/9c0137fd607a9622a9d38d4877aeb791261185df" alt=""><figcaption></figcaption></figure>

En el **Admin → Usuarios** en la sección encontramos una cuenta de usuario:

* Usuario: <Inorgaard@keeper.htb>
* Contraseña: Welcome2023!

<figure><img src="/files/956b6200976ca7218eec970fdb48c0baf78f0c4a" alt=""><figcaption></figcaption></figure>

#### Conexión SSH

Usamos las credenciales encontradas para conectarnos por SSH:

```bash
ssh Inorgaard@keeper.htb
```

<figure><img src="/files/9c9666c091ddc6c5ecf284a42d31b3a9b2a08b89" alt=""><figcaption></figcaption></figure>

### Bandera user.txt :)

<figure><img src="/files/d75f3b1e0d99c39e8ade47bf4966118c259086ae" alt="" width="563"><figcaption></figcaption></figure>

## Escalada de privilegios

### **Volcado de base de datos de KeePass**

Encontramos un archivo ZIP `RT30000.zip` que descargamos en nuestra máquina:

```bash
python3 -m http.server 8080
```

```bash
wget http://10.10.11.227:8080/RT30000.zip
```

<figure><img src="/files/ac64d785c3fe678865a2b435ea6383a63df0a689" alt=""><figcaption></figcaption></figure>

Tras la extracción, obtenemos:

* **KeePassDumpFull.dmp**
* **passcodes.kdbx**

<figure><img src="/files/4301a16a047b47050aac001c14520c4f113b64c4" alt=""><figcaption></figcaption></figure>

Estamos intentando abrir `passcodes.kdbx` con KeePassXC:

```bash
keepassxc passcodes.kdbx
```

Pide una contraseña. Probamos un ataque de fuerza bruta con **John The Ripper**, sin éxito.

<figure><img src="/files/e898d9856cba888b756078db2ea7212ebe97fe02" alt=""><figcaption></figcaption></figure>

### **KeePass - análisis del volcado de memoria**

{% embed url="<https://github.com/matro7sh/keepass-dump-masterkey>" %}

Aprovechamos la `.dmp` archivo con un script de Python:

```bash
python3 poc.py KeePassDumpFull.dmp
```

Esto revela caracteres ilegibles. Una búsqueda en línea nos lleva a una posible contraseña:

<figure><img src="/files/95c24b5c0aea763f258cd1f2ee4ac2aec9b84592" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/6189b13352d17cc2baba667a77eb816ff7e99d53" alt="" width="563"><figcaption></figcaption></figure>

**Resultado**: gachas rojas con crema

<figure><img src="/files/c08b9515e3a54e9554bf113363b767988dafbfb7" alt="" width="563"><figcaption></figcaption></figure>

Usamos esta contraseña para desbloquear KeePass, lo que nos da una **clave cifrada de PuTTY y la contraseña de root**.

<figure><img src="/files/5eca336e98cb594a7d53b7f82058cfd9dfe8ac00" alt=""><figcaption></figcaption></figure>

### Convertir la clave de PuTTY al formato OpenSSH

Necesitamos convertir la clave de PuTTY al formato OpenSSH:

```bash
puttygen key.ppk -O private-openssh -o id_rsa
```

A continuación, asegúrate de que tu clave privada tenga los permisos correctos:

```bash
chmod 600 id_rsa
```

#### **Conectarse al servidor SSH**

```bash
ssh -i id_rsa root@10.10.11.227
```

<figure><img src="/files/7c40160b1032e8e44f2067644669ebcbcb66f6c1" alt=""><figcaption></figcaption></figure>

### Bandera root.txt :)

<figure><img src="/files/b31c086bbae489e02592df85a451ce617bb38da5" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/92dfe21942a94c88876a29bb96f22055ca7edd1c" alt="" width="417"><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 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://hacking-notes.jord4n.pro/es/writeups-ctf/hackthebox/linux-easy/keeper-hackthebox-writeup.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.
