Skip to content
XSS Write-up Intermediate

Playing Dominos with Moodle's Security (1/2)

An unauthenticated attacker could create arbitrary folders on a Moodle server due to unsanitised input in the 'rev' parameter, leading to stored XSS in the admin panel when a folder name containing JavaScript is reflected. This XSS could then be escalated to remote code execution by installing a malicious plugin.

Yaniv Nizry Follow

Published on sonarsource.com

Moodle is an open-source learning management system (LMS) used to create and deliver online courses. It was first developed in 2002 by Martin Dougiamas and is now widely used by educators and institutions around the world, earning the trust of educational institutions worldwide, with its user base exceeding 350…

Yaniv Nizry (@YNizry), on sonarsource.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The 'rev' parameter was not sanitised and was inserted into a file path, allowing path traversal to create arbitrary folders; later, folder names were displayed without HTML escaping in the admin filetype page.

What the attacker needed

Moodle before 4.1.3 or 4.2.0; admin visits the filetype page; no authentication needed

How it was found

  1. Send a request to one of the vulnerable endpoints with a crafted 'rev' parameter containing path traversal to create a folder with a malicious name under the pix/f directory.
  2. The folder name includes an SVG or image tag with an event handler that executes JavaScript.
  3. Wait for an administrator to visit the 'new filetype' page in the admin panel.
  4. The folder name is reflected unsanitised in a select tag, breaking out and executing the JavaScript in the admin's browser.
  5. Use the admin's session to install a malicious plugin (PHP code), achieving remote code execution.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Moodle is a learning platform used by schools. A flaw let anyone create folders on the server with a name they choose. When an admin later viewed a settings page, that folder name was shown without cleaning, so hidden JavaScript ran in the admin's browser. Since admins can install plugins (which are just code), the attacker could then run any code on the server.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by Yaniv Nizry

View all

7 more disclosed reports, best first.

More from Moodle

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.