MoodleCMS

CVE-2025-67850

MEDIUM · 6.1 CVSS v3.1 Published 2026-02-03
Fix available
A fix is available. Upgrade to 4.1.22 / 4.4.11 or later.
See remediation →
68/100
Remediation priority · Elevated
Remotely reachable No privileges

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
A flaw was found in moodle. This vulnerability, known as Cross-Site Scripting (XSS), occurs due to insufficient checks on user-provided data in the formula editor's arithmetic expression fields. A remote attacker could inject malicious code into these fields. When other users view these expressions, the malicious code would execute in their web browsers, potentially compromising their data or leading to unauthorized actions.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · moderate confidence

This is a stored Cross-Site Scripting (XSS) vulnerability in Moodle's formula editor. The application fails to properly sanitize user input in arithmetic expression fields, allowing an attacker to inject malicious JavaScript code that executes in the browsers of other users who view these expressions.

MitigationImplement proper input validation and output encoding for all user-provided formula content in the formula editor. Use Moodle's built-in sanitization functions (such as clean_param or s()) to neutralize malicious script content before storage and display.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
MoodleCMS
Affected:< 4.1.22>= 4.4.0, < 4.4.11>= 4.5.0, < 4.5.8>= 5.0.0, < 5.0.4= 5.1.0

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Identify installed Moodle version
    Check the version.php file in the Moodle root directory or access the Site Administration > Server > Environment page to view the installed Moodle version
    Affected if The installed version falls within any of these ranges: < 4.1.22; >= 4.4.0 and < 4.4.11; >= 4.5.0 and < 4.5.8; >= 5.0.0 and < 5.0.4; or exactly 5.1.0
  2. Determine if formula editor is in use
    Check if any courses or activities contain questions or content using the Moodle formula editor (Question type: Calculated, Calculated multichoice, or Formula question types) by querying the mdl_question and mdl_question_answers tables in the database for records with qtype containing 'formula' or 'calculated'
    Affected if The formula editor feature is actively used and the Moodle version is vulnerable
  3. Inspect stored formula content for XSS payloads
    Query the database for any formula question content that may contain script tags, javascript: handlers, or other XSS vectors. Check tables mdl_question, mdl_question_answers, and mdl_question_numerical for unusual HTML or script content in formula fields. Example SQL: SELECT * FROM mdl_question WHERE qtype LIKE '%formula%' OR questiontext LIKE '%<script%'
    Affected if Any formula content contains unsanitized JavaScript or HTML tags such as <script>, <img onerror>, or event handlers like onload/onerror

A user is affected if their Moodle installation version is within the vulnerable ranges AND they have the formula editor enabled with stored formula content that could contain malicious scripts.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Upgrade available Upgrade to 4.1.22 / 4.4.11 / 4.5.8 or later
Fixed in 4.1.224.4.114.5.8
Interim mitigation

Implement proper input validation and output encoding for all user-provided formula content in the formula editor. Use Moodle's built-in sanitization functions (such as clean_param or s()) to neutralize malicious script content before storage and display.

Recommended fix High confidence

Upgrade to the latest available version in your current branch: 4.1.22 (for 4.1.x), 4.4.11 (for 4.4.x), 4.5.8 (for 4.5.x), or 5.0.4 (for 5.0.x)

  1. 1. Back up your Moodle database and entire installation directory (including moodledata) before proceeding.
  2. 2. Place your site into Maintenance Mode via Site Administration > Server > Maintenance Mode.
  3. 3. Download the appropriate fixed version of Moodle (4.1.22, 4.4.11, 4.5.8, or 5.0.4) from https://download.moodle.org/releases/
  4. 4. Extract the new Moodle files and replace your existing installation, preserving config.php and any custom code in lib/local or theme directories.
  5. 5. Run the Moodle upgrade process by accessing the site URL - the upgrade.php script will automatically run.
  6. 6. Verify the upgrade completed successfully by checking Site Administration > Server > System paths and confirming the Moodle version displayed.
  7. 7. Test the formula editor functionality to confirm the XSS fix is working properly.
  8. 8. Disable Maintenance Mode once testing is complete.
Caveat Moodle minor version upgrades typically have minimal breaking changes; however, always review the release notes for your target version for any behavior changes or deprecated features.

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in Moodle Scoped from the published advisory
  • Consultation3.0 h
  • Implementation6.0 h
  • Testing4.0 h
  • Review / QA2.0 h
15.0 hours of engineering $2,640
Get the upgrade done

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $4,224.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2025-67850 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2025-67850 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data