CVE-2026-58342

Cross-site Request Forgery
Affects
Moodle, IOMAD
in
Moodle
No items found.
Versions
<4.5.12, >=5.0.0 <5.0.8, >=5.1.0 <5.1.5, >=5.2.0 <5.2.1

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. Teachers build quizzes on the quiz editing page, where they can split the questions into sections, each with its own heading, through the Add menu's a new section heading option.

A Cross-Site Request Forgery (CSRF) vulnerability (CVE-2026-58342) has been identified in the quiz editing page of Moodle and IOMAD, which allows an attacker to add section headings to a quiz by getting a logged-in teacher to open a crafted link. Moodle tracks this issue as MSA-26-0023 (MDL-88540).

Per OWASP: Cross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated. With a little help of social engineering (such as sending a link via email or chat), an attacker may trick the users of a web application into executing actions of the attacker's choosing.

This issue affects all versions of Moodle before 4.5.12, versions 5.0.0 through 5.0.7, versions 5.1.0 through 5.1.4, and version 5.2.0, 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 Low-severity vulnerability is found in the moodle/moodle package in all versions before 4.5.12, 5.0.0 through 5.0.7, 5.1.0 through 5.1.4, and 5.2.0 of Moodle, and in IOMAD releases built on those versions. Moodle rates it Minor.

Moodle protects state-changing requests with a per-session token, the sesskey, and checks it with require_sesskey() or confirm_sesskey(). Most commands in mod/quiz/edit.php, such as adding a question or repaginating, call confirm_sesskey(), but the handler for adding a section heading acted on the addsectionatpage URL parameter without it:

if ($addsectionatpage = optional_param('addsectionatpage', false, PARAM_INT)) {
    // Add a section to the quiz.
    $structure->check_can_be_edited();
    $structure->add_section_heading($addsectionatpage);
    quiz_delete_previews($quiz);
    redirect($afteractionurl);
}

The renderer built the Add a new section heading link from only the course module ID and the page number, so the request carried no token. A teacher who opens a link such as /mod/quiz/edit.php?cmid=<cmid>&addsectionatpage=<page>, or loads a page that requests it in the background, adds a new section heading at that page of the quiz, and the handler also deletes the quiz's preview attempts.

The page requires the mod/quiz:manage capability, which the editing teacher and manager archetypes have by default, so the victim must be someone who can edit the quiz. check_can_be_edited() throws an exception once the quiz has been attempted, so only quizzes without attempts can be changed. The impact is an unwanted section heading and the loss of preview attempts; the request does not expose data or change grades, questions, or settings.

The fix requires a valid session token before the section is added, and the renderer now includes 'sesskey' => sesskey() in the link's parameters:

if (($addsectionatpage = optional_param('addsectionatpage', false, PARAM_INT)) && confirm_sesskey()) {
    // Add a section to the quiz.
    $structure->check_can_be_edited();
    $structure->add_section_heading($addsectionatpage);

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.12, 5.0.8, 5.1.5, 5.2.1, or later, or to an IOMAD release built on one of those versions.
  • Leverage a commercial support partner like HeroDevs for post-EOL security support.

Credits

  • Paul Holden from Moodle HQ (finder)
Vulnerability Details
Severity
Level
CVSS Assessment
Low
>=0 <4
Medium
>=4 <6
High
>=6 <8
Critical
>=8 <10
Low
ID
CVE-2026-58342
PROJECT Affected
Moodle, IOMAD
Versions Affected
<4.5.12, >=5.0.0 <5.0.8, >=5.1.0 <5.1.5, >=5.2.0 <5.2.1
NES Versions Affected
Published date
October 14, 2026
≈ Fix date
October 1, 2026
Category
Cross-site Request Forgery
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.