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

CVE-2026-113683: VPL for Moodle XSS Vulnerability

CVE-2026-113683 is a reflected cross-site scripting flaw in Virtual Programming Lab for Moodle that lets attackers inject malicious scripts via crafted URLs. This article covers technical details, affected versions, and mitigation.

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-113683 Overview

CVE-2026-113683 is a reflected cross-site scripting (XSS) vulnerability in VPL (Virtual Programming Lab) for Moodle versions before 5.0.0. The flaw resides in similarity/diff.php, which fails to encode the filename1 and filename2 request parameters before reflecting them into the HTML response. A remote attacker can craft a malicious diff.php URL containing a JavaScript payload. The script executes in the browser of any user holding the mod/vpl:similarity capability who opens the link. The weakness is tracked under CWE-79.

Critical Impact

An attacker can execute arbitrary JavaScript in the session of a privileged VPL grader, enabling actions and data disclosure under that user's authenticated context.

Affected Products

  • VPL (Virtual Programming Lab) for Moodle, versions prior to 5.0.0
  • Specifically affected component: similarity/diff.php / similarity/diff.class.php
  • Fixed release: VPL for Moodle V5.0.0

Discovery Timeline

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

Technical Details for CVE-2026-113683

Vulnerability Analysis

The vulnerability stems from unencoded output in the similarity diff viewer of VPL for Moodle. The diff.class.php component reads attacker-controlled filename1 and filename2 parameters and concatenates them directly into an HTML header string. Because Moodle's output-sanitization helper s() is not applied, any HTML or JavaScript present in the parameter is reflected verbatim into the page. A grader with the mod/vpl:similarity capability who follows a crafted link triggers execution of the attacker's payload. The payload runs in the authenticated Moodle session, inheriting that user's privileges across the course and plugin.

Root Cause

The root cause is missing output encoding (CWE-79) in the construction of the $htmlheader string within diff.class.php. The filename parameter is retrieved with PARAM_RAW, which does not sanitize, and then written directly into HTML markup. No contextual escaping is performed before the content reaches the browser.

Attack Vector

Exploitation requires an attacker to craft a diff.php URL containing a JavaScript payload in the filename1 or filename2 query parameter. The attacker delivers the link through phishing, chat, forum posts, or any channel that reaches a grader. When the target—who must hold mod/vpl:similarity—opens the link while authenticated, the browser renders the attacker-supplied script in the Moodle origin.

php
// Patch from similarity/diff.class.php (commit 5dd7fe0)
$vpl->require_capability(VPL_SIMILARITY_CAPABILITY);
$zipname = required_param('zipfile' . $f, PARAM_RAW);
$filename = required_param('filename' . $f, PARAM_RAW);
- $htmlheader .= $filename . ' ' . optional_param('username' . $f, '', PARAM_TEXT);
+ $htmlheader .= s($filename) . ' ' . optional_param('username' . $f, '', PARAM_TEXT);
$ext = strtoupper(pathinfo($zipname, PATHINFO_EXTENSION));
if ($ext != 'ZIP') {
    throw new moodle_exception('wrongzipfilename');

Source: GitHub Commit 5dd7fe0. The fix wraps $filename with Moodle's s() helper to HTML-escape the value before it reaches the response.

Detection Methods for CVE-2026-113683

Indicators of Compromise

  • Web server access logs showing requests to /mod/vpl/similarity/diff.php with filename1 or filename2 parameters containing HTML tags such as <script>, <img, <svg, or event handlers like onerror= and onload=.
  • URL-encoded payload markers in query strings (for example %3Cscript%3E, %22onerror%3D).
  • Unusual outbound requests from grader browsers immediately after visiting a diff.php URL, indicating payload execution and data exfiltration.

Detection Strategies

  • Deploy a Web Application Firewall rule that inspects diff.php query parameters for angle brackets, JavaScript URI schemes, and known XSS payload fragments.
  • Hunt historical web and proxy logs for referrers or links that embed Moodle diff.php URLs with suspicious filename values.
  • Correlate authenticated session activity against anomalous diff.php requests from external referrers or short-lived tokens.

Monitoring Recommendations

  • Enable verbose Moodle access logging and forward it to a centralized analytics platform for pattern matching on filename1/filename2 parameter values.
  • Monitor browser-side Content Security Policy (CSP) violation reports from Moodle users for inline script execution attempts.
  • Alert on new or unusual administrative actions performed by accounts that recently visited the similarity viewer.

How to Mitigate CVE-2026-113683

Immediate Actions Required

  • Upgrade VPL for Moodle to version 5.0.0 or later as published in the GitHub Release V5.0.0.
  • Review which accounts hold the mod/vpl:similarity capability and remove it from users who do not require similarity analysis.
  • Instruct graders to avoid opening unsolicited diff.php links until the patch is deployed.

Patch Information

The fix is contained in commit 5dd7fe0 and shipped in VPL V5.0.0. The patch applies Moodle's s() HTML-escaping function to the $filename value before concatenating it into $htmlheader. Additional details are documented in the VulnCheck Advisory.

Workarounds

  • Enforce a strict Content Security Policy on the Moodle site that blocks inline scripts and restricts script sources to trusted origins.
  • Block or filter requests to /mod/vpl/similarity/diff.php at the reverse proxy or WAF when filename1/filename2 parameters contain HTML metacharacters.
  • Temporarily disable the VPL similarity feature or restrict the mod/vpl:similarity capability until the upgrade to 5.0.0 is complete.
bash
# Example ModSecurity rule to block XSS payloads in VPL diff.php parameters
SecRule REQUEST_URI "@contains /mod/vpl/similarity/diff.php" \
    "chain,phase:2,deny,status:403,id:1026113683,msg:'CVE-2026-113683 VPL diff.php XSS attempt'"
    SecRule ARGS:filename1|ARGS:filename2 "@rx (?i)(<script|onerror=|onload=|javascript:|<svg|<img)" \
        "t:none,t:urlDecodeUni,t:htmlEntityDecode"

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.