CVE-2024-45691
NoneMoodle Lesson activity password bypass through PHP loose comparison
CVSS
—
EPSS
0.4%
Published
Nov 20, 2024
CISA due date
—
Cloudanix analysis
A password lock on certain course activities in an online learning system could be bypassed if the lock used one of a small set of specially formatted passwords.
- Exploitation
- Remote Authenticated
- Attacker needs
- Low Privilege
- Complexity
- Moderate
- Impact
- Privilege Gain
- Component
- Application
- Class
- Authorization Bypass
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Loose string comparison in lesson activity password validation allows bypass when the configured password matches a magic hash value, causing the check to evaluate true for crafted inputs due to PHP type juggling.
Why it matters to the business
Attackers can access restricted educational content without authorization, undermining access controls on learning platforms and potentially exposing lesson materials or enabling unauthorized progression.
How an attack unfolds
An attacker targets a password-protected lesson activity whose stored password is a magic hash string; they submit a specially crafted input that loosely equals the stored value under PHP loose comparison, granting access without knowing the actual password.
How to fix it
Upgrade moodle/moodle to the fixed commit d4f5e92ee156002b95db1ab6f76e25870563e2f6 or apply the corresponding patch to enforce strict password comparison; ignore unrelated libarchive packages listed in affected products.
How to confirm the fix worked
Review source code for replacement of loose (==) comparisons with strict (===) checks in password validation functions; test by attempting access with known magic hash bypass strings after upgrade to confirm denial.
Typical attack path
- Locate a lesson activity configured with password access restriction
- Determine or test for a stored password matching a known magic hash format
- Submit a crafted string input that triggers loose equality in the comparison logic
- Gain unauthorized entry to the lesson content or activities
How to detect it
Search Moodle access logs for repeated failed or successful lesson attempts originating from the same session with unusual password values; correlate with lesson activity configuration exports to identify any magic-hash-formatted passwords still in use.
What your security team should do
- Prioritize upgrade of all Moodle instances to the patched commit within standard change windows given stable low EPSS and no KEV listing
- Audit existing lesson activities for any passwords that match documented magic hash patterns and rotate them
- Implement code review requirements for all future authentication logic changes to prevent similar comparison flaws
The record
A flaw was found in Moodle. When restricting access to a lesson activity with a password, certain passwords could be bypassed or less secure due to a loose comparison in the password-checking logic. This issue only affected passwords set to "magic hash" values.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Packagist | moodle/moodle | 0 | 4.1.13 |
| Packagist | moodle/moodle | 4.2.0-beta | 4.2.10 |
| Packagist | moodle/moodle | 4.3.0-beta | 4.3.7 |
| Packagist | moodle/moodle | 4.4.0-beta | 4.4.3 |
| Bitnami | moodle | 0 | 4.1.13 |
| 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-beta | 4.2.10 |
| packagist | moodle/moodle | 4.3.0-beta | 4.3.7 |
| packagist | moodle/moodle | 4.4.0-beta | 4.4.3 |
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