CVE-2024-34002: Local file inclusion via modified feedback backups in Moodle
When restoring a feedback activity, Moodle took the type of each item from the backup file and built the path of a PHP file from it, which it then included.
1Summary
- Advisory
- MSA-24-0013
- System
- Moodle
- Component
- Feedback activity (mod_feedback)
- Class
- Local file inclusion (LFI)
- Severity
- Serious
A feedback activity consists of items such as multiple choice questions, text fields or info texts. The item type decides which code displays and evaluates it: Moodle looks for a directory of that name in the feedback module and loads the PHP file inside.
In a backup the type is plain text. Moodle took it over on restore without cleaning it and later, when loading the items, put it into the file path. A modified type could therefore point to a file somewhere else on the server.
Reported by Vincent Schneider through the Moodle security process, published as MSA-24-0013.
2Who is affected
Anyone allowed to restore feedback activities who, on misconfigured shared hosting, can also place files outside the Moodle directory.
According to the advisory, two things have to come together. The person needs the permission to restore feedback activities, and must be able to place files on the same server outside the Moodle directory.
Only shared hosting where one customer account can access the content of others meets the second condition. On a dedicated server it is missing.
3Impact
An included PHP file is executed inside the web server process, with everything Moodle itself may read. That includes the database credentials in config.php.
4Fix
- Affected versions
- 4.3.0 to 4.3.3, 4.2.0 to 4.2.6, 4.1.9 and earlier
- Fixed in
- 4.3.4, 4.2.7, 4.1.10
- Published
- 13 May 2024
- Fix in the source
- 5a18d94
The fix works in two places. On restore and when loading, clean_param() reduces the type to letters, and feedback_get_item_class() only includes types that exist in the module. For anything else Moodle stops with an error.
If your Moodle runs at a shared hosting provider, have the separation between customer accounts checked, whether or not you have upgraded yet.
We check for this class of flaw in every project we build or audit. For third-party code as a security audit.
5 / Contact
Should we review your Moodle plugins?
Describe your project in three short steps. We usually reply within one business day.