> 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/blocky-hackthebox-writeup.md).

# Blocky HackTheBox 复盘

Blocky HackTheBox 简单 Linux 机器复盘，涵盖 WordPress 枚举、信息泄露、分析 jar 文件 - JD-Gui + SSH 访问、滥用 Sudoers 权限（提权），并包含实用的

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

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

* WordPress 枚举
* 信息泄露
* 分析 jar 文件 - JD-Gui + SSH 访问
* 滥用 Sudoers 权限（提权）
  {% endhint %}

## 侦察

**工作区设置：**

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

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2df091155b769d42f9bff6272a11cdeacadc8c2e%2Fimage%20(952).png?alt=media" alt=""><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-8dbca5a16f847793dbb66da42156253baee475d2%2Fimage%20(953).png?alt=media" alt=""><figcaption></figcaption></figure>

**使用 Nmap 发现开放端口：** 枚举开放端口，并将结果导出到 Nmap 目录中的“allPorts”文件：

```bash
nmap -p- --open -sS -n -Pn --min-rate 5000 10.10.10.37 -oG allPorts
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f832b5c76685f99ecb0a16b4dd6d220ce1a77ad9%2F%7BD8CC492B-5DFE-40C4-9CB5-074FECAB3AF3%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**使用 extractport 分析开放端口：** 使用 extractport 函数以汇总方式显示开放端口并将它们复制到剪贴板。（21.22.80,25565）

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

**使用 Nmap 扫描端口版本：** 使用 Nmap 扫描端口版本，并将信息提取到“targeted”文件中：

```bash
nmap -sCV -p21,22,80,25565 10.10.10.37 -oN targeted
```

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

### 80 端口

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c35cf77902efc22544732dc8091974f1f117fcd0%2F%7BFFA085C0-2D66-45F3-9B65-AEC3E396A7E2%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**使用 Gobuster 枚举目录：**

我们使用 **Gobuster** 用于枚举目标机器 Web 服务器上的目录。

```bash
gobuster dir -u http://blocky.htb/ -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 100
```

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

我们发现一个名为 **plugins**.

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

**下载并解压 BlockyCore.jar 文件：**

我们下载 **BlockyCore.jar** 文件，它看起来像一个自定义插件。然后我们解压其内容。

```java
jar xf BlockyCore.jar
```

#### 反编译 BlockyCore.class 文件

在解压后的文件中我们找到一个 **BlockyCore.class** 文件。我们使用 **javap** 以检查其内容

```bash
javap -c BlockyCore.class
```

我们找到一组数据库凭据：

* **localhost**
* **root**
* **8YsqfCTnvxAUeduzjNSXe22**

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

#### 通过 PhpMyAdmin 访问数据库

使用提取出的凭据，我们登录到 **PhpMyAdmin** 并发现数据库中有一张表，其中包含一个名为 **notch**.

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

**通过 SSH 连接：**

我们使用该密码 **`8YsqfCTnvxAUeduzjNSXe22`** 针对用户 **notch** 并成功登录。

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3459cfe9b7974dbfcda48da767dbb140c245b760%2Fimage%20(961).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-319e6cc68b1e5e048e92c90146e362a6819a1564%2Fimage%20(962).png?alt=media" alt=""><figcaption></figcaption></figure>

## 权限提升

我们注意到该用户属于 **sudo** 组，这使我们能够使用 **sudo** 来提升权限

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

**执行 sudo su 命令：**/ 我们运行以下命令以获得 root shell：

```bash
sudo su
8YsqfCTnvxAUeduzjNSXe22
```

### root.txt 标志：）

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-50de6de688badbfdbca88bc01ba5b705ca38643e%2Fimage%20(964).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-fa69622a7b4769448941b8ac62086501491e9dc6%2F%7B395319FC-ACD2-4902-B2FA-A831B9E272FE%7D.png?alt=media" alt="" width="516"><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/blocky-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.
