Skip to main content
Vulnerability Database/CVE-2026-113608

CVE-2026-113608: Moodle Configurable Reports SQL Injection

CVE-2026-113608 is an SQL injection flaw in Moodle Configurable Reports block that enables low-privileged users to execute database queries and extract sensitive data including password hashes. This article covers technical details, affected versions, security impact, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-113608 Overview

CVE-2026-113608 is a SQL injection vulnerability in the Configurable Reports block for Moodle (moodle-block_configurablereports) in versions prior to 5.3.1. The flaw resides in the report_sql::prepare_sql() function and is triggered through the filter_var request parameter of viewreport.php. Low-privileged users who are permitted to view reports containing the %%FILTER_VAR%% placeholder can inject subqueries or UNION SELECT statements. This allows attackers to read arbitrary database tables, including Moodle user password hashes. The vulnerability is classified under CWE-89 (Improper Neutralization of Special Elements used in an SQL Command).

Critical Impact

Authenticated low-privileged Moodle users can extract arbitrary database contents, including stored password hashes, via SQL injection in the filter_var parameter.

Affected Products

  • Configurable Reports block for Moodle (moodle-block_configurablereports) versions before 5.3.1
  • Confirmed vulnerable release: 5.2.0
  • Confirmed vulnerable release: 5.3.0

Discovery Timeline

  • 2026-10-20 - CVE-2026-113608 published to NVD
  • 2026-10-21 - Last updated in NVD database

Technical Details for CVE-2026-113608

Vulnerability Analysis

The Configurable Reports block allows Moodle administrators to define custom SQL reports that include a %%FILTER_VAR%% placeholder. At runtime, the plugin substitutes this placeholder with a user-supplied clause taken from the filter_var HTTP request parameter in viewreport.php. In the vulnerable implementation inside reports/sql/report.class.php, the parsing regular expression accepted overly broad input for the left-hand clause capture group. This allowed attackers to supply arbitrary SQL text that was then concatenated directly into the executed query. Because the clause content was not treated as parameterized data, attackers could append UNION SELECT statements or nested subqueries. The result is unauthorized read access to any table the Moodle database user can query, including mdl_user password hashes.

Root Cause

The root cause is improper neutralization of SQL syntax in the filter_var parameter during clause reconstruction. The pre-patch regex permitted free-form input in the clause named group, which was then inlined into the final SQL string. Only the right-hand param value was later bound as a parameter, leaving the left side exposed to injection.

Attack Vector

Exploitation requires an authenticated Moodle session with permission to view a report that uses the %%FILTER_VAR%% placeholder. The attacker crafts a malicious filter_var value and submits it to viewreport.php over the network. No user interaction is required beyond the attacker's own request.

php
// Patch excerpt from reports/sql/report.class.php
// Source: https://github.com/jleyva/moodle-block_configurablereports/commit/1a9fea4b98b093912c6432ea3705c7b1eff4efc0
if (strpos($sql, '%%FILTER_VAR%%') !== false) {
    // Make sure the filtervar is a valid sql clause, otherwise remove from sql.
    $clause = '';
    // The left side comes from the URL and is inserted as SQL, so it must be a plain column
    // ("id", "u.city"), optionally wrapped in one whitelisted function ("LOWER(u.city)").
    // Only the value is free text, and it is always bound as a parameter.
    $identifier = '[a-z_][a-z0-9_]*(?:\.[a-z_][a-z0-9_]*)?';
    $field = "(?:(?:LOWER|UPPER|TRIM|LENGTH)\s*\(\s*{$identifier}\s*\)|{$identifier})";
    if (
        !empty($filtervar)
        && preg_match(
            '/^\s*(?<conj>AND|OR)\s+(?<field>' . $field . ')\s*' .
            '(?<op><=|>=|<>|!=|=|<|>|\bNOT\s+LIKE\b|\bLIKE\b|\bNOT\s+IN\b|\bIN\b|\bBETWEEN\b)\s*' .
            '(?<param>\S(?:.*\S)?)\s*$/is',
            $filtervar,
            $output,
        )
    ) {
        global $DB;
        $output['clause'] = strtoupper($output['conj']) . ' ' . $output['field'];

The patch replaces the permissive clause group with a strict field grammar that only accepts a plain column identifier (optionally wrapped in a whitelisted LOWER, UPPER, TRIM, or LENGTH function). The value side remains bound as a parameter.

Detection Methods for CVE-2026-113608

Indicators of Compromise

  • HTTP requests to /blocks/configurable_reports/viewreport.php containing filter_var values with UNION, SELECT, --, /*, or nested parentheses outside of expected operator positions.
  • Database query logs showing UNION SELECT statements referencing mdl_user, mdl_user_preferences, or other sensitive tables originating from the Configurable Reports block.
  • Unexpected report rendering errors or unusually large result sets returned to low-privileged accounts.

Detection Strategies

  • Inspect Moodle web server access logs for filter_var parameter values that deviate from the expected AND|OR <field> <operator> <value> grammar.
  • Correlate authenticated session IDs with report-view activity to identify low-privileged users querying reports that use %%FILTER_VAR%%.
  • Review database audit logs for queries issued by the Moodle service account that reference password-hash columns outside of normal authentication flows.

Monitoring Recommendations

  • Enable Moodle event logging for report_viewed events and forward them to a centralized log store for review.
  • Monitor outbound traffic from the Moodle application server for anomalous data volumes that could indicate database exfiltration.
  • Alert on repeated 500-series errors from viewreport.php, which often accompany SQL injection probing.

How to Mitigate CVE-2026-113608

Immediate Actions Required

  • Upgrade moodle-block_configurablereports to version 5.3.1 or later on all Moodle instances.
  • Audit existing custom SQL reports that use the %%FILTER_VAR%% placeholder and review which roles can view them.
  • Rotate Moodle user password hashes and session tokens if logs indicate suspicious use of filter_var.

Patch Information

The fix is included in release moodle-block_configurablereports 5.3.1. The relevant hardening commits are 1a9fea4b, which restricts the filter_var clause grammar inside report_sql::prepare_sql(), and 86968997, which updates callers to accept the new [$sql, $params] return tuple so values are bound as parameters. See the VulnCheck advisory for additional context.

Workarounds

  • Remove or disable any custom SQL reports that reference the %%FILTER_VAR%% placeholder until the plugin is upgraded.
  • Restrict the capability to view Configurable Reports to trusted administrator roles only.
  • Deploy a web application firewall rule that rejects filter_var values containing SQL meta-characters such as UNION, SELECT, ;, --, or /*.
bash
# Example WAF rule concept for blocking suspicious filter_var payloads
# Reject requests to viewreport.php with SQL keywords in filter_var
SecRule REQUEST_URI "@contains /blocks/configurable_reports/viewreport.php" \
    "chain,id:1026113608,phase:2,deny,status:403,msg:'CVE-2026-113608 filter_var SQLi attempt'"
    SecRule ARGS:filter_var "@rx (?i)(union\s+select|--|/\*|;|\bselect\b.*\bfrom\b)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.