CVE-2024-34003: Local file inclusion via modified workshop backups in Moodle
A workshop backup contains the names of the grading strategy and the evaluation method. Moodle took both over on restore and used them to load code without checking the names.
1Summary
- Advisory
- MSA-24-0014
- System
- Moodle
- Component
- Workshop activity (mod_workshop)
- Class
- Local file inclusion (LFI)
- Severity
- Serious
In a workshop, participants assess each other. The grading strategy, a rubric for example, defines how they assess. The evaluation method defines how the assessments turn into a grade at the end. Both are subplugins with their own subdirectory.
Moodle loads the code of the selected subplugin by its stored name. After a restore, strategy and evaluation came straight from the backup file and so became part of the path of the file to include.
Reported by Vincent Schneider through the Moodle security process, published as MSA-24-0014.
2Who is affected
People allowed to restore workshops who, on misconfigured shared hosting, can also place files outside the Moodle directory.
On a properly set up installation the restore permission alone is not enough. It also takes direct access to the server file system outside Moodle, the kind a badly separated shared hosting can give to other customers.
3Impact
When both apply, Moodle runs foreign PHP code as soon as the workshop loads its strategy or evaluation. The code has the same permissions as Moodle and can reach the site's database and file storage.
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
- e870bc0
clean_param() now limits both values to valid plugin names: on restore, when the activity is loaded and when the evaluation method is set. An empty strategy ends in an error before Moodle looks for any file.
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.