> ## 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 CyberHeroes writeup (zh-TW)
- URL: https://taiwanding.com/tryhackme-cyberheroes-writeup-zh-tw/
- Published: 2025-11-13T07:47:10.000Z
- Updated: 2026-07-15T02:50:25.000Z
- Author: Kevin Chen
- Tags: tryhackme, CTF, #broken access

## 題目資訊

- **平台**: TryHackMe
- **房間名稱**: CyberHeroes
- **難度**: Easy
- **目標**: 繞過登入驗證取得 Flag
- 連結: [https://tryhackme.com/room/cyberheroes](https://tryhackme.com/room/cyberheroes?ref=taiwanding.com)

## 解題流程

### Step 1: 初步探索

訪問網站發現一個登入頁面：

```
Show your hacking skills and login to became a CyberHero ! :D

```

提示：需要找到正確的使用者名稱和密碼

### Step 2: 查看原始碼

按 **F12** 或 **右鍵 → 檢視原始碼**，找到登入驗證邏輯：

```javascript
function authenticate() {
  a = document.getElementById('uname')
  b = document.getElementById('pass')
Redacted
    xhttp.open("GET", "RandomLo0o0o0o0o0o0o0o0o0o0gpath12345_Flag_"+a.value+"_"+b.value+".txt", true);
    xhttp.send();
  }
}

```

關鍵發現:

💡 **Username**: `h3ck3rBoi`（直接明文）  
💡 **Password**: `RevereString("54321@terceSrepuS")`（需要反轉）  
💡 **Flag 路徑**: `RandomLo0o0o0o0o0o0o0o0o0o0gpath12345_Flag_{username}_{password}.txt`

### Step 3: 解碼密碼

密碼使用 `RevereString` 函數反轉字串：

```javascript
"54321@terceSrepuS".split('').reverse().join('')
// 結果: "SuperSecret@12345"

```

或直接在瀏覽器 Console 執行：

```javascript
const RevereString = str => [...str].reverse().join('');
RevereString("54321@terceSrepuS");
// SuperSecret@12345

```

完整憑證:

✅ **Username**: `h3ck3rBoi`  
✅ **Password**: `SuperSecret@12345`

### Step 4: 取得 Flag

**方法 1 - 直接登入**

在登入頁面輸入憑證：

```
Username: h3ck3rBoi
Password: SuperSecret@12345

```

點擊 **Login** 按鈕，Flag 會顯示在頁面上！ 🎉

**方法 2 - 直接訪問 Flag 檔案**

根據源碼，Flag 檔案路徑為：

```
RandomLo0o0o0o0o0o0o0o0o0o0gpath12345_Flag_h3ck3rBoi_SuperSecret@12345.txt

```

直接用 curl 獲取：

```bash
curl http://TARGET_IP/RandomLo0o0o0o0o0o0o0o0o0o0gpath12345_Flag_h3ck3rBoi_SuperSecret@12345.txt

```

或瀏覽器訪問：

```
http://TARGET_IP/RandomLo0o0o0o0o0o0o0o0o0o0gpath12345_Flag_h3ck3rBoi_SuperSecret@12345.txt

```

完成! 🏆

## 技術要點總結

### 1\. 客戶端驗證漏洞

```
⚠️ 所有驗證邏輯都在瀏覽器執行
⚠️ 攻擊者可以直接查看 JavaScript 源碼
⚠️ 無法防止繞過

```

### 2\. 敏感資訊洩露

```javascript
// ❌ 錯誤：憑證寫在前端
if (a.value=="h3ck3rBoi" & b.value=="SuperSecret@12345")

// ❌ 錯誤：檔案路徑洩露
xhttp.open("GET", "RandomLo0o0o0o0o0o0o0o0o0o0gpath12345_Flag_...txt", true);

```

### 3\. 簡單的混淆不是安全

```javascript
// 反轉字串不是加密，只是混淆
RevereString("54321@terceSrepuS") // 還是能輕易解碼

```