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

# Blocky HackTheBox攻略記事

WordPress列挙、情報漏えい、jarファイル解析 - JD-Gui + SSHアクセス、sudoers権限の悪用（権限昇格）を扱うBlocky HackTheBox Easy Linuxマシンの攻略記事。実践的な

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

{% hint style="warning" %}
**スキル:**

* WordPressの列挙
* 情報漏えい
* jarファイルの解析 - JD-Gui + SSHアクセス
* Sudoers権限の悪用（権限昇格）
  {% endhint %}

## 偵察

**作業環境の設定:**

重要なコンテンツ、エクスプロイト、Nmap の偵察結果を保存するために、3つのフォルダを作成して作業環境を整えます。

<figure><img src="https://2001299964-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://2001299964-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://2001299964-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://2001299964-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://2001299964-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://2001299964-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://2001299964-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://2001299964-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://2001299964-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://2001299964-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://2001299964-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://2001299964-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://2001299964-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://2001299964-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コマンドの実行：**/ ルートシェルを取得するために、次のコマンドを実行します：

```bash
sudo su
8YsqfCTnvxAUeduzjNSXe22
```

### root.txtのフラグ：）

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