Moodle XSS from profile fields from external db

moodle/moodle Updated 02 Oct 2025

Summary

13/05/2022
Yes i
Moderate
6.1

CVE-2016-2152: Moodle XSS from profile fields from external db. Affects moodle/moodle across 4 version ranges.

>= 2.7, < 2.7.13 >= 2.8, < 2.8.11 >= 2.9, < 2.9.5 >= 3.0, < 3.0.3

Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Moodle is an open-source learning management system (LMS) used by educational institutions worldwide. It provides a platform for creating and managing online courses, allowing educators to deliver content and interact with students. Moodle supports various authentication methods, including the ability to authenticate users against an external database. This feature allows administrators to configure Moodle to use an external database for user authentication. However, a vulnerability in the authentication process exposes Moodle to cross-site scripting (XSS) attacks.

Vulnerability Detail

The vulnerability exists in the auth/db/auth.php file in Moodle versions 2.6.11 through 2.7.x before 2.7.13, 2.8.x before 2.8.11, 2.9.x before 2.9.5, and 3.0.x before 3.0.3. It allows remote attackers to inject arbitrary web script or HTML through an external DB profile field. This means that an attacker can craft a malicious input that, when displayed on a Moodle page, will execute arbitrary code in the context of the user's browser. This can lead to various security risks, including session hijacking, data theft, and unauthorized access to sensitive information.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 2.7, < 2.7.13 2.7.13
    composer require moodle/moodle:2.7.13
  • >= 2.8, < 2.8.11 2.8.11
    composer require moodle/moodle:2.8.11
  • >= 2.9, < 2.9.5 2.9.5
    composer require moodle/moodle:2.9.5
  • >= 3.0, < 3.0.3 3.0.3
    composer require moodle/moodle:3.0.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary workaround, administrators can disable the use of external DB profile fields in Moodle. This can be done by modifying the Moodle configuration to remove the option for users to authenticate against an external database. However, this workaround may impact the functionality of certain features that rely on external DB profile fields. It is recommended to apply the official patches and upgrade to the latest version of Moodle as soon as possible.

Conclusion

The XSS vulnerability in Moodle's authentication process exposes the system to potential attacks that can compromise user data and system integrity. It is crucial for administrators to promptly upgrade to the latest version of Moodle and apply the necessary patches to mitigate the risk. Additionally, reviewing and sanitizing external DB profile fields is essential to prevent the injection of malicious scripts or HTML. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for moodle/moodle →

Share this vulnerability

FAQ

Moodle is an open-source learning management system used by educational institutions to create and manage online courses.

Cross-site scripting (XSS) is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users.

The vulnerability in Moodle allows attackers to inject arbitrary web script or HTML through an external DB profile field. This can lead to various security risks, including session hijacking, data theft, and unauthorized access to sensitive information.

To fix the vulnerability, it is recommended to upgrade to the latest version of Moodle and apply the official patches. Additionally, administrators should review and sanitize any external DB profile fields to prevent the injection of malicious scripts or HTML.

As a temporary workaround, administrators can disable the use of external DB profile fields in Moodle. However, this may impact the functionality of certain features that rely on these fields. It is recommended to apply the official patches and upgrade to the latest version of Moodle as soon as possible.

Related vulnerabilities

Recent vulnerabilities recorded for moodle/moodle.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 2.7, < 2.7.13 2.7.13
    composer require moodle/moodle:2.7.13
  • >= 2.8, < 2.8.11 2.8.11
    composer require moodle/moodle:2.8.11
  • >= 2.9, < 2.9.5 2.9.5
    composer require moodle/moodle:2.9.5
  • >= 3.0, < 3.0.3 3.0.3
    composer require moodle/moodle:3.0.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback