/

CVE-2026-133062

Severity:

HIGH RISK

(7.5)

SQL Injection (CWE-89) in Moodle External DB Enrolment

CVE-2026-133062

Awaiting Analysis

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Unauthorized access to or modification and deletion of external database records

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Moodle's external database enrolment plugin does not sufficiently sanitize data before using it in queries against the connected database. When the non-default plugin is enabled, an authenticated user with course editing permissions may be able to inject SQL and view, modify, or delete records in that database.

Affected context

The issue occurs in Moodle's external database enrolment plugin when it builds queries using insufficiently sanitized data. Exposure depends on the plugin being enabled and connected to an external database; the described attack also requires an authenticated account with course editing permissions.

Exploit preconditions

  • Attack surface: Queries issued by the external database enrolment plugin
  • Required access: An authenticated account with course editing permissions
  • Trigger point: Processing data that is incorporated into a query against the external database
  • Why exploitation is possible: Insufficient sanitization may allow supplied data to alter query structure
  • Deployment condition: The non-default plugin must be enabled and connected to an external database

Why this happens

The plugin insufficiently sanitizes data used in external database queries. If input is incorporated into SQL in a way that allows it to change the query's intended structure, an attacker may be able to perform SQL injection. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command.

Potential impact

  • An attacker may view sensitive records in the connected external database.
  • An attacker could modify or delete records, depending on the queries and database permissions available to the plugin.
  • Data integrity or availability in systems relying on the external database may be affected.

General mitigation guidance

Defensive approaches generally focus on ensuring input cannot change SQL query structure and limiting the consequences of a compromised query.

  • Use parameterized queries or prepared statements rather than constructing SQL from input.
  • Validate inputs against expected formats and reduce reliance on user-controlled data in database operations.
  • Apply least-privilege permissions to the database account used by the plugin.
  • Keep the plugin disabled when it is not needed, and restrict access to course editing capabilities to appropriate users.
  • Separate sensitive data and operations where practical to limit the impact of database access.

How teams detect issues like this

  • Use static analysis to identify query construction that concatenates or interpolates data into SQL.
  • Review database access code for parameter binding, input validation, and appropriate use of database APIs.
  • Monitor application and database activity for unexpected query patterns or unusual access, modification, and deletion of records.
  • Enforce secure coding policies that require parameterized queries and least-privilege database credentials.
  • Automated code review tools may help identify unsafe query construction patterns.

Sources

SourceLink
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-133062
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2576520
github.comgithub.com/moodle/moodle/commit/2547dea31069f97e762f8e2ae68a96d329867b5f
github.comgithub.com/moodle/moodle/commit/bf8f2215bdd0bd53fde1773b64a354a95fa666dc
github.comgithub.com/moodle/moodle/commit/e2767bf3924756d58c63b53c9d11b818f70914c1

Frequently asked

questions

The described conditions require an authenticated user with course editing permissions, and the external database enrolment plugin must be enabled.

The described SQL injection targets queries against the connected external database. The potential effects depend on the plugin's database permissions and the data accessible through those queries.

Use parameterized queries or prepared statements so that supplied data is treated as values rather than SQL instructions.

Validate inputs, review database query construction, enforce least-privilege database access, and use static analysis and code review policies that discourage dynamic SQL.

Find out what's already
exploitable in your codebase.