CVE-2024-43437
Medium · 5.4Moodle Cross-site Scripting vulnerability
CVSS
5.4
EPSS
0.3%
Published
Nov 11, 2024
CISA due date
—
Cloudanix analysis
A bug in the Moodle learning platform lets attackers hide harmful scripts inside backup files that run automatically for other users when the backup is restored.
- Exploitation
- Requires User Interaction
- Attacker needs
- Low Privilege
- Complexity
- Low
- Impact
- Other
- Component
- Application
- Class
- XSS
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Insufficient sanitization of user-supplied data during course or site restore operations permits persistent cross-site scripting payloads embedded in malicious backup archives to be stored and later executed in the context of other users' browsers.
Why it matters to the business
Attackers can hijack authenticated sessions, steal user data, or perform unauthorized actions inside the learning platform; the low exploitation probability and absence from known exploited lists reduce immediate urgency but still require prompt patching of any internet-facing or multi-tenant installations.
How an attack unfolds
An attacker creates or modifies a Moodle backup file containing unsanitized script content, uploads and restores the archive through the normal restore workflow, and the payload is persisted in the database so that subsequent users who view the restored content trigger script execution.
How to fix it
Upgrade Moodle to the commit aea9770cfc7d003a737f4899489d1e3982efe9ac or later; verify that the restore path applies the new sanitization logic before allowing untrusted backup files.
How to confirm the fix worked
Confirm the installed codebase contains commit aea9770cfc7d003a737f4899489d1e3982efe9ac, attempt a restore of a test backup containing known script markers, and verify that the markers are escaped or rejected in the resulting pages.
Typical attack path
- Craft or tamper with a Moodle backup archive to include executable script in unsanitized fields
- Obtain sufficient privileges to initiate a course or site restore
- Perform the restore operation so the payload is written to the database without sanitization
- Wait for or lure other users to interact with the restored content, triggering XSS
How to detect it
Review web-server and application logs for restore operations initiated by non-admin accounts, search database tables that store restored content for unexpected script tags, and monitor for new user sessions or actions originating from pages that were recently restored.
What your security team should do
- Apply the fixed commit to all Moodle instances within the next maintenance window
- Restrict restore permissions to trusted administrators until the patch is deployed
- Add automated scanning of uploaded backup archives for script patterns as a compensating control
The record
A flaw was found in moodle. Insufficient sanitizing of data when performing a restore could result in a cross-site scripting (XSS) risk from malicious backup files.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Packagist | moodle/moodle | 0 | 4.1.12 |
| Packagist | moodle/moodle | 4.2.0 | 4.2.9 |
| Packagist | moodle/moodle | 4.3.0 | 4.3.6 |
| Packagist | moodle/moodle | 4.4.0 | 4.4.2 |
| Bitnami | moodle | 0 | 4.1.12 |
| Ubuntu:16.04:LTS | moodle | 0 | No fix |
| Ubuntu:18.04:LTS | moodle | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | moodle | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | moodle | 0 | No fix |
| packagist | moodle/moodle | 4.2.0 | 4.2.9 |
| packagist | moodle/moodle | 4.3.0 | 4.3.6 |
| packagist | moodle/moodle | 4.4.0 | 4.4.2 |
Related vulnerabilities
- GHSA-ggxq-2mg9-8966 Moodle has a Remote Code Execution risk via file restore Also affects moodle/moodle
- GHSA-cg8j-5cr2-568q Moodle TeX formula editor is vulnerable to DoS through lack of execution time limits Also affects moodle/moodle
- CVE-2026-26047 A denial-of-service vulnerability was identified in Moodle’s TeX formula editor. Also affects moodle/moodle
- CVE-2026-26045 A flaw was identified in Moodle’s backup restore functionality where specially crafted… Also affects moodle/moodle
- GHSA-5cx4-w4fh-fr57 Moodle Affected by Improper Restriction of Excessive Authentication Attempts Also affects moodle/moodle
- GHSA-8jrv-wx83-w3xj Moodle Inserts Sensitive Information Into Sent Data Also affects moodle/moodle
- GHSA-hcm6-q6pc-xfhm Moodle has an authorization logic flaw Also affects moodle/moodle
- GHSA-qv78-6gpp-hm68 Moodle Open Redirect vulnerability Also affects moodle/moodle