CVE-2026-102581
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. The Forum activity (mod_forum) renders each post from a Mustache template. For accessibility, the post container and its action menu carry an aria-label that names the post subject and its author.
A Cross-Site Scripting (XSS) vulnerability (CVE-2026-102581) has been identified in the templates used to display forum posts of Moodle and IOMAD, which allows a user who can post in a forum to inject script that runs in the browser of another user viewing the post. Moodle tracks this issue as MSA-26-0034 (MDL-88981).
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 Moodle versions 3.7.0 through 4.5.12, 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
- Product: Moodle, IOMAD
- Affected packages: moodle/moodle (mod_forum)
- Affected versions: >=3.7.0 <4.5.13, >=5.0.0 <5.0.9, >=5.1.0 <5.1.6, >=5.2.0 <5.2.2
- GitHub repository: https://github.com/moodle/moodle (Moodle), https://github.com/iomad/iomad (IOMAD)
- Published packages: https://packagist.org/packages/moodle/moodle
- Package manager: Composer
- Fixed in:
- OSS Moodle 4.5.13, 5.0.9, 5.1.6, 5.2.2
- NES for Moodle v4.3.14
- NES for IOMAD v4.3.5
Vulnerability Info
This Medium-severity vulnerability is found in the moodle/moodle package in Moodle versions 3.7.0 through 4.5.12, 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.6 (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N). Moodle rates it Minor.
The label text comes from a language string with two placeholders. The templates built it inline, passing the post subject and the author's name to the string helper as JSON inside the attribute:
<div
class="d-flex border p-2 mb-2 forumpost focus-target {{#unread}}unread{{/unread}} {{#firstpost}}firstpost starter{{/firstpost}}"
aria-label='{{#str}} postbyuser, mod_forum, {"post": "{{subject}}", "user": "{{author.fullname}}"} {{/str}}'
data-post-id="{{id}}" data-content="forum-post"
>The subject is escaped for HTML when it is inserted, but it then sits inside a JSON string that the helper parses, and the result is written into a single-quoted attribute. The escaping applied at the first step is not sufficient for those later contexts. A crafted post subject can therefore break out of the attribute and add markup of its own, which runs when another user views the discussion.
The attacker needs permission to post in a forum. Anyone who can view the post is a potential victim, including teachers and managers. The nested discussion view used the same pattern.
The fix builds the label in PHP and exports it as its own property, so the templates output a single escaped value in a double-quoted attribute:
<div
class="d-flex border p-2 mb-2 forumpost focus-target {{#unread}}unread{{/unread}} {{#firstpost}}firstpost starter{{/firstpost}}"
aria-label="{{label}}"
data-post-id="{{id}}" data-content="forum-post"
>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
- Lars Bonczek (finder)
- David Woloszyn (remediation)