CVE-2025-32044: Moodle allows unauthenticated REST API user data exposure
7.5
Basic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
moodle/moodle | composer | >= 4.5.0-beta, < 4.5.3 | 4.5.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability describes unauthenticated user data exposure via stack traces in API calls. The provided commit (41917db65e6b3dba3bf3d805a8599e6752655646) directly addresses this by modifying how stack traces are handled.
-
Analysis of
lib/classes/router/response/exception_response.php
:- The function
get_payload_data
within the classcore_router\response\exception_response
(namespace derived from Moodle's file structure and common practice, confirmed by checking Moodle source) was changed. - Previously, it assigned
$exception->getTrace()
directly to thestacktrace
field in the response. This raw trace could include function arguments ifzend.exception_ignore_args
was not set in PHP's configuration. - The fix explicitly filters out 'args' from each frame of the stack trace using
array_map
andarray_filter
. - This directly points to
core_router\response\exception_response::get_payload_data
as the function responsible for preparing the vulnerable stack trace output.
- The function
-
Analysis of
lib/setup.php
:- This file was modified to enforce
ini_set('zend.exception_ignore_args', '1');
. This is a global mitigation strategy to prevent arguments from appearing in any stack trace by default. - While this change is crucial for the fix, it doesn't pinpoint a specific Moodle function that is vulnerable but rather a configuration Moodle now enforces to protect itself. The vulnerability exists in how Moodle handles exceptions when this PHP setting is not active, which leads back to
get_payload_data
.
- This file was modified to enforce
-
Analysis of
lib/tests/classes/router/route_testcase.php
:- The test function
assert_exception_response
was updated to assert that 'args' are not present in the stack trace, confirming the fix inget_payload_data
.
- The test function
The primary function that would appear in a runtime profile during the exploitation (i.e., when the sensitive data is being packaged into the response) is core_router\response\exception_response::get_payload_data
. The vulnerability isn't that this function itself takes malicious input, but that it handles exception objects in a way that, under certain PHP configurations, leaks sensitive data that originated from arguments of other functions higher in the call stack during an API request that led to an exception.