| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| moodle/moodle | composer | >= 5.0.0-beta, < 5.0.3 | 5.0.3 |
| moodle/moodle | composer | >= 4.5.0-beta, < 4.5.7 | 4.5.7 |
The vulnerability lies in Moodle's error handling within its routing system, which could lead to sensitive information disclosure. The analysis of the provided patches reveals two key areas that were modified to address this issue.\n\n1. Unconditional Display of Error Details: The first commit (5d4910509eeaac8403d18ec8f259e29d2f11527e) modifies the add_error_handler_middleware function in public/lib/classes/router.php. Previously, the displayErrorDetails parameter for the ErrorMiddleware was hardcoded to true. This meant that regardless of the Moodle configuration, any error would result in a detailed error page being shown. The patch changes this behavior to respect the global debug display setting ($CFG->debugdisplay), thus preventing the disclosure of sensitive information in a production environment.\n\n2. Detailed Error Responses for Non-Admins: The second commit (5e7d5abc483d0511ebfc2042075eabcc392ff4ce) addresses an issue in the validation_middleware. The process function in this middleware would return detailed exception information, even for 404 'Not Found' errors. The patch adds a condition to check if the user is a site administrator. If a non-admin user triggers a 404 error, a generic 'page not found' response is returned instead of the detailed error, effectively hiding potentially sensitive information from unauthorized users.\n\nBoth of these functions are part of the request handling and error processing pipeline in Moodle's router. Exploitation would involve sending a malformed request that triggers an error in either the validation middleware or another part of the routing process, leading to the disclosure of internal directory listings or other sensitive server information.
core_public\lib\router::add_error_handler_middlewarepublic/lib/classes/router.php
core_public\lib\router\middleware\validation_middleware::processpublic/lib/classes/router/middleware/validation_middleware.php
Ongoing coverage of React2Shell