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

# Keeper HackTheBox 复盘

Keeper HackTheBox 简单 Linux 机器复盘，涵盖滥用 Request Tracker、信息泄露、通过内存转储获取 KeePass 密码（提权），并包含实用的枚举、e

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

{% hint style="warning" %}
**技能：**

* 滥用 Request Tracker
* 信息泄露
* 通过内存转储获取 KeePass 密码（权限提升）
  {% endhint %}

## 侦察

**工作区设置：**

通过创建三个文件夹来设置工作区，用于存放重要内容、漏洞利用和 Nmap 侦察结果。

<figure><img src="https://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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>

## Request Tracker CMS

访问 **tickets.keeper.htb** 我们找到了一个管理面板。

<figure><img src="https://1574813340-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://1574813340-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://1574813340-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>

在 **管理员 → 用户** 部分中我们找到了一个用户账户：

* 用户：<Inorgaard@keeper.htb>
* 密码：Welcome2023!

<figure><img src="https://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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>

**结果**：红色粥配奶油

<figure><img src="https://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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/zh/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.
