> 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

Разбор Easy Linux-машины HackTheBox Keeper, охватывающий злоупотребление Request Tracker, утечку информации, получение пароля KeePass через дамп памяти (повышение привилегий), с практическими заметками по перечислению, э

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

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

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

## Разведка

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1daea7fe4a5f12c95c5f636efb53601b5c1dd716%2Fimage%20(2858).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-106199afa6907972b35d6c991158df1a1911e9af%2Fimage%20(2859).png?alt=media" 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="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4c81d21456749c53bbd0f4a5f590aa30f14573eb%2Fimage%20(2860).png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-de06ec57138db755d39f61c53b265c438287558e%2Fimage%20(2861).png?alt=media" alt=""><figcaption></figcaption></figure>

### Порт 80

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-736a526fc66ed498886efa883745e0257308c6bf%2Fimage%20(2862).png?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4d5c91da3cb7f5cdf627ab979e47c6d7d583a0c1%2Fimage%20(2863).png?alt=media" alt=""><figcaption></figcaption></figure>

## CMS Request Tracker

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-26c53eb984edab9d28b606fdb1dd99fad739bea5%2Fimage%20(2864).png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4348c548652cc3646252cf1c928e47ee0af222e7%2Fimage%20(2865).png?alt=media" alt=""><figcaption></figcaption></figure>

Подключение успешно!

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f3a7c22f6b34a75f42886c0b308d1ca778e7ba1f%2Fimage%20(2866).png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9a4b389cefd80fc989e3d50e8e52081a4940a202%2Fimage%20(2867).png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7d2b48c026468476d09f49f72b7476fb57cf7734%2Fimage%20(719).png?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cd8afd60013271941e739fd314cb1625a72ad99d%2Fimage%20(720).png?alt=media" 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="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0f26cf09466e8586507ef3dcc65167a830ebd162%2Fimage%20(721).png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a083bdfed784d266e4be05f3874a6375846fca61%2Fimage%20(723).png?alt=media" alt=""><figcaption></figcaption></figure>

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

```bash
keepassxc passcodes.kdbx
```

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7fe73720931bd178e5c76ece0ee57e27a57900e9%2Fimage%20(722).png?alt=media" 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="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3b190ce7266316ed0d0d7cc6434ab0d1138a1440%2Fimage%20(724).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-73a3378c51ebaa83bb54894ae5046e2661635b9d%2Fimage%20(725).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Результат**: red porridge with cream

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8bb05d1d6204657f047011d42b69fd36c6740335%2Fimage%20(726).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1922b68469347a5ba6a014476bd1e73b4b55356f%2Fimage%20(727).png?alt=media" 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="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7341286e6ef1bb0f3b6364fa22244dbf5c2b6e65%2Fimage%20(730).png?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c6fad0aaaa37ad4f62398e77d71e6ae16fc3092e%2Fimage%20(731).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cd34abac87dcf4d967f077c022ea096d94a6c21b%2Fimage%20(732).png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ru/writeups-ctf/hackthebox/linux-easy/keeper-hackthebox-writeup.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.
