CVE-2026-102586

Cross-Site Scripting
Affects
Moodle, IOMAD
in
Moodle
No items found.
Versions
<4.5.13, >=5.0.0 <5.0.9, >=5.1.0 <5.1.6, >=5.2.0 <5.2.2

Patch Available.

Exclamation circle icon
Patch Available

This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.

Overview

Moodle is an open source learning management system written in PHP. Schools, universities, and companies use it to run online courses. IOMAD is a multi-tenant distribution of Moodle that lets one installation serve several companies or organizations; it is built on Moodle core and shares the affected code. Moodle's forgotten password process emails the user a link containing a reset token. Opening the link shows a form to set a new password, with the account's username displayed above the password fields.

A Cross-Site Scripting (XSS) vulnerability (CVE-2026-102586) has been identified in the password reset page of Moodle and IOMAD, which allows a remote attacker to run script in the browser of an unauthenticated user who opens a crafted password reset link. Moodle tracks this issue as MSA-26-0039 (MDL-88335).

Per MITRE CWE-79: The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.

This issue affects all versions of Moodle before 4.5.13, versions 5.0.0 through 5.0.8, versions 5.1.0 through 5.1.5, and versions 5.2.0 through 5.2.1, including End-of-Life release lines such as Moodle 4.3. IOMAD releases built on these Moodle versions contain the same code and are affected as well.

Details

Module Info

Vulnerability Info

This Medium-severity vulnerability is found in the moodle/moodle package in all versions of Moodle before 4.5.13, versions 5.0.0 through 5.0.8, versions 5.1.0 through 5.1.5, and versions 5.2.0 through 5.2.1, including End-of-Life release lines such as Moodle 4.3. IOMAD releases built on these Moodle versions contain the same code and are affected as well. The CVE record's CNA assigns it a CVSS 3.1 base score of 4.3 (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N). Moodle rates it Minor.

When a valid reset link is opened, Moodle loads the account for the token and fills in the set password form. The username is passed to the form twice, once as a hidden value and once for display:

// User hasn't submitted form, they got here directly from email link.
// Next, display the form.
$setdata = new stdClass();
$setdata->username = $user->username;
$setdata->username2 = $user->username;
$setdata->token = $user->token;
$mform->set_data($setdata);

The display copy is shown through a static form element, which outputs its content as HTML. The username was not escaped first, so a username containing markup is rendered as markup on the page. The same unescaped username was also placed in the reset confirmation email text.

Per the advisory, this affects an unauthenticated user who is tricked into opening a password reset link, so authenticated sessions are not affected. Exploitation depends on an account whose username contains HTML, which standard Moodle username rules do not normally allow.

The fix escapes the username before it is displayed on the form and before it is used in the email:

// User hasn't submitted form, they got here directly from email link.
// Next, display the form.
$setdata = new stdClass();
$setdata->username = $user->username;
$setdata->username2 = s($user->username);
$setdata->token = $user->token;
$mform->set_data($setdata);

Mitigation

Moodle publishes security fixes only for its supported release lines. Earlier release lines, including Moodle 4.3 and the IOMAD releases built on it, are End-of-Life and will not receive any public updates to address this issue.

Users of the affected components should apply one of the following mitigations:

  • Upgrade to Moodle 4.5.13, 5.0.9, 5.1.6, 5.2.2, or later, or to an IOMAD release built on one of those versions.
  • Leverage a commercial support partner like HeroDevs (NES for Moodle, NES for IOMAD) for post-EOL security support.

Credits

  • Henk van den Toorn (finder)
  • Paul Holden (remediation)
Vulnerability Details
Severity
Level
CVSS Assessment
Low
>=0 <4
Medium
>=4 <6
High
>=6 <8
Critical
>=8 <10
Medium
ID
CVE-2026-102586
PROJECT Affected
Moodle, IOMAD
Versions Affected
<4.5.13, >=5.0.0 <5.0.9, >=5.1.0 <5.1.6, >=5.2.0 <5.2.2
NES Versions Affected
Published date
September 30, 2026
≈ Fix date
October 12, 2026
Category
Cross-Site Scripting
Vex Document
Download VEXHow do I use it?
Sign up for the latest vulnerability alerts fixed in
NES for Moodle
Rss feed icon
Subscribe via RSS
or

By submitting the form I acknowledge receipt of our Privacy Policy.

Thanks for signing up for our Newsletter! We look forward to connecting with you.
Oops! Something went wrong while submitting the form.