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).

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-21857HIGH8.3
  • PHPPHP
  • redaxo/source
NoYesJan 07, 2026
CVE-2025-61676MEDIUM6.1
  • PHPPHP
  • october/system
NoYesJan 10, 2026
CVE-2025-61674MEDIUM6.1
  • PHPPHP
  • october/system
NoYesJan 10, 2026
CVE-2026-21896MEDIUM5.8
  • PHPPHP
  • getkirby/cms
NoYesJan 08, 2026
CVE-2026-22242MEDIUM4.9
  • PHPPHP
  • coreshop/core-shop
NoYesJan 08, 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