5 min read

TryHackMe c4ptur3-th3-fl4g writeup (zh-TW)

TryHackMe c4ptur3-th3-fl4g writeup (zh-TW)

題目資訊

Task 1: Translate, shift and decode

這個任務包含多種編碼解碼挑戰,每題都需要識別編碼類型並解碼

好用工具:

ASCII to Hex - Free text conversion tools
Convert ASCII to hex and other formats, and vice versa.
Morse Code Translator
The translator can translate between Morse code and Latin, Hebrew, Arabic and Cyrillic alphabets. It can play, flash or vibrate the Morse code. You can also save the sound and share a link to use it to send messages to your friends. The speed, Farnsworth speed and frequency of the sound are all fully adjustable.
ROT Cipher - Rotation - Online Rot Decoder, Solver, Translator
Tool to decrypt/encrypt by ROT. The code ROT for Rotation (which most common variant is Caesar Cipher) is the easiest shift-based encryption cipher.

1.1 Leetspeak

題目:c4n y0u c4p7u23 7h3 f149?
解法:將數字替換回字母 (4→a, 0→o, 7→t, 2→r, 3→e, 1→l, 9→g)
答案:Redacted

1.2 Binary

題目:01101100 01100101 01110100 01110011...
解法:二進制轉 ASCII
答案:Redacted

1.3 Base32

題目:MJQXGZJTGIQGS4ZAON2XAZLSEBRW63LNN5XCA2LOEBBVIRRHOM======
解法:Base32 解碼
答案:Redacted

1.4 Base64

題目:RWFjaCBCYXNlNjQgZGlnaXQgcmVwcmVzZW50cyBleGFjdGx5IDYgYml0cyBvZiBkYXRhLg==
解法:Base64 解碼
答案:Redacted

1.5 Hexadecimal

題目:68 65 78 61 64 65 63 69 6d 61 6c 20 6f 72 20 62 61 73 65 31 36 3f
解法:十六進制轉 ASCII
答案:Redacted

1.6 ROT13

題目:Ebgngr zr 13 cynprf!
解法:ROT13 凱撒密碼
答案:Redacted

1.7 ROT47

題目:*@F DA:? >6 C:89E C@F?5 323J C:89E C@F?5 Wcf E:>6DX
解法:ROT47 位移密碼
答案:Redacted

1.8 Morse Code

題目:- . .-.. . -.-. --- -- -- ..- -. .. -.-. .- - .. --- -. . -. -.-. --- -.. .. -. --.
解法:摩斯電碼解碼
答案:Redacted

1.9 BCD (Binary-Coded Decimal)

題目:85 110 112 97 99 107 32 116 104 105 115 32 66 67 68
解法:十進制轉 ASCII
答案:Redacted

1.10 多層編碼

題目:LS0tLS0gLi0tLS0g... (非常長的 Base64)
解法步驟:
1. Base64 解碼
   先把整段 `LS0tLS0gLi0tLS0g...` 做 base64 -d,得到滿版的 `-----` 與 `.----`(摩斯數字的 0 與 1)。

2. 摩斯數字 → 位元
   用文字替換把 `-----` 換成 `0`、把 `.----` 換成 `1`,再清掉空白與換行;保留原本每 8 位為一組的分隔。
   例:`sed "s/-----/0/g" | sed "s/.----/1/g"` … → 得到像
   `01100110 01100101 00100000 ...` 的二進位序列。

3. 二進位 → ASCII 字元
   以空白拆分,每 8 位轉十進位再轉字元(Python 一行 comprehension 就能做):
   `''.join(chr(int(b, 2)) for b in bits.split())`
   轉完會得到一串看似怪怪的字串:
   `fe \`_` ``e bh ``d ba `_h hf ... ``c ce ce ce`

4. 判斷這串怪字是再一層替換:試 ROT 系列 → ROT47 命中
   對「可列印 ASCII」常見再編碼,優先嘗試 ROT13/ROT47。
   這裡ROT47一解就變成一串十進位數字:
   `76 101 116 39 115 32 109 97 107 101 32 116 104 105 115 32 97 32 98 105 116 32 116 114 105 99 107 105 101 114 46 46 46`

5. 十進位 ASCII 碼 → 文字
   把這些十進位轉回字元,得到最後答案:
   `Let's make this a bit trickier...`

答案:Redacted

Task 2: Spectrograms

題目

分析 .wav 音頻檔案,從頻譜圖中找出隱藏訊息

解法

  1. 使用 Audacity 開啟 .wav 檔案
  2. 切換到頻譜圖視圖:
    • 點擊音軌名稱旁的下拉選單
    • 選擇 "Spectrogram"

工具

Task 3: Steganography

題目

從圖片中解碼隱藏訊息

stegseek stegosteg_1559008553457.jpg /usr/share/wordlists/rockyou.txt
StegSeek 0.6 - https://github.com/RickdeJager/StegSeek

[i] Found passphrase: ""
[i] Original filename: "steganopayload2248.txt".
[i] Extracting to "stegosteg_1559008553457.jpg.out".

cat stegosteg_1559008553457.jpg.out
Redacted

Task 4: Security through obscurity

4.1 第一題:找出檔案名稱

題目:Download and get 'inside' the file. What is the first filename & extension?

解法

# 1. 使用 binwalk 掃描
$ binwalk meme_1559010886025.jpg

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             JPEG image data, JFIF standard 1.01
74407         0x122A7         RAR archive data, version 5.x
74478         0x122EE         PNG image, 147 x 37, 8-bit/color RGBA

# 2. 提取隱藏檔案
$ binwalk -e meme_1559010886025.jpg

# 3. 查看 RAR 內容
$ unrar l _meme_1559010886025.jpg.extracted/122A7.rar

答案:Redacted

4.2 第二題:找出隱藏文字

題目:Get inside the archive and inspect the file carefully. Find the hidden text.

解法

# 1. 解壓 RAR 檔案
$ unrar x 122A7.rar

# 2. 使用 zsteg 分析 PNG
$ zsteg hackerchat.png

[?] 22 bytes of extra data after image end (IEND), offset = 0x15a4
extradata:0         .. text: "\"AHH_YOU_FOUND_ME!\" \r\n"
meta Software       .. text: "gnome-screenshot"
meta Creation Time  .. text: "Wed 15 May 2019 09:09:10 PM CDT"

答案:Redacted

總結與學習要點

關鍵技術

  1. 編碼識別:熟悉各種編碼格式的特徵
    • Base64: 結尾有 = 填充
    • Base32: 只有大寫字母和數字 2-7
    • Hex: 成對的 0-9 和 a-f
    • Binary: 只有 0 和 1
  2. 音頻分析:頻譜圖是 CTF 音頻題的首選方法
  3. 檔案分析
    • binwalk - 掃描嵌入檔案
    • strings - 快速查找文字
    • exiftool - 檢查 metadata
  4. 圖片隱寫
    • PNG: 使用 zsteg
    • JPEG: 使用 steghide、stegseek