CVE-2022-40313
PHP vulnerability analysis and mitigation

Overview

CVE-2022-40313 is a vulnerability discovered in Moodle's Mustache template helper functionality. The issue was identified where recursive rendering of Mustache template helpers containing user input could result in Cross-Site Scripting (XSS) risks or cause pages to fail to load. The vulnerability affects Moodle versions 4.0 to 4.0.3, 3.11 to 3.11.9, 3.9 to 3.9.16, and earlier unsupported versions. It was discovered by Adam Roberts from NCC Group and was disclosed on September 19, 2022 (Moodle Forum).

Technical details

The vulnerability stems from improper handling of recursive rendering in Mustache template helpers when processing user input. This implementation flaw could lead to two distinct security issues: stored Cross-Site Scripting (XSS) attacks and denial of service conditions that could prevent pages from loading. The issue was classified as 'Serious' in severity by the Moodle security team (Moodle Forum).

Impact

The vulnerability could allow attackers to execute stored XSS attacks against users of the affected Moodle installations. Additionally, the flaw could be exploited to cause denial of service conditions where affected pages would fail to load, disrupting normal platform operation (Moodle Forum).

Exploitability

The vulnerability requires the ability to input content that would be processed by the Mustache template helpers. The stored XSS aspect of the vulnerability suggests that malicious content could persist in the system and affect multiple users over time (Moodle Forum).

Mitigation and workarounds

The vulnerability has been fixed in Moodle versions 4.0.4, 3.11.10, and 3.9.17. Users of affected versions should upgrade to these patched versions to mitigate the risk. The fix was implemented through improved checks in the template rendering system (Moodle Forum).

Additional resources


SourceThis report was generated using AI

Related PHP vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-44741HIGH8.8
  • PHP logoPHP
  • pimcore/admin-ui-classic-bundle
NoYesAug 12, 2026
CVE-2026-47233MEDIUM6.5
  • PHP logoPHP
  • admidio/admidio
NoYesAug 12, 2026
CVE-2026-47132MEDIUM5.4
  • PHP logoPHP
  • thorsten/phpmyfaq
NoYesAug 12, 2026
CVE-2026-47234MEDIUM4.4
  • PHP logoPHP
  • admidio/admidio
NoYesAug 12, 2026
CVE-2026-49262LOW3
  • PHP logoPHP
  • aimeos/pagible
NoYesAug 12, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management