CVE-2026-58338
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. Each user has a public profile page that they can customize by adding, moving, and removing blocks, and a Reset page to default button puts the page back to the site default.
A Cross-Site Request Forgery (CSRF) vulnerability (CVE-2026-58338) has been identified in the profile page reset action of Moodle and IOMAD, which allows an attacker to reset a logged-in user's customized profile page by getting that user to open a crafted link. Moodle tracks this issue as MSA-26-0019 (MDL-88545).
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
- Product: Moodle, IOMAD
- Affected packages:
moodle/moodle(user/profile.php) - Affected versions: <4.5.12, >=5.0.0 <5.0.8, >=5.1.0 <5.1.5, >=5.2.0 <5.2.1
- 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.12, 5.0.8, 5.1.5, 5.2.1
- NES for Moodle v4.3.13
- NES for IOMAD v4.3.4
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(). The reset handler in user/profile.php acted on the reset URL parameter without that check:
if ($PAGE->user_allowed_editing()) {
if ($reset !== null) {
if (!is_null($userid)) {
if (!$currentpage = my_reset_page($userid, MY_PAGE_PUBLIC, 'user-profile')) {
throw new \moodle_exception('reseterror', 'my');
}
redirect(new moodle_url('/user/profile.php', array('id' => $userid)));
}
}Because the request needed no token, any page or message could send it on the user's behalf. A logged-in user who opens a link such as /user/profile.php?id=<userid>&edit=1&reset=1, or loads a page that requests it in the background, has the profile page for that user ID reset to the site default, and every block they added to it is removed. A user with the capability to manage other users' blocks, such as an administrator, can be made to reset another user's profile page the same way.
The impact is limited to losing profile page customizations. The request does not expose data or change accounts, permissions, or course content.
The fix adds a require_sesskey() call before the reset runs, so the request is rejected unless it carries the user's session token:
if ($reset !== null) {
require_sesskey();
if (!is_null($userid)) {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)