Sep 17, 2026·6 min read·18 visits
A stored Cross-Site Scripting vulnerability in Grav CMS versions prior to 2.0.15 allows authenticated editors to insert arbitrary JavaScript via malicious audio/video file paths, which executes in the context of any user (including administrators) viewing the page.
Improper neutralization of input during web page generation in Grav CMS allows authenticated users with page modification privileges to execute stored Cross-Site Scripting (XSS) attacks. The flaw exists in AudioMediaTrait and VideoMediaTrait where media source URLs are concatenated directly into HTML templates without proper escaping.
The Stored Cross-Site Scripting (XSS) vulnerability, tracked as CVE-2026-75831 and GHSA-6qw9-4vv5-jr97, exists within the core media processing architecture of the Grav Content Management System (CMS). Grav utilizes a flat-file structure and processes Markdown elements through specialized traits that generate HTML structures. When handling audio and video file attachments, the system renders media elements via the Parsedown engine by invoking specific trait methods.
Specifically, the AudioMediaTrait and VideoMediaTrait components are responsible for transforming media markup into standard HTML <audio> and <video> tags. During this process, the system dynamically generates <source> elements using media path variables. If an authenticated user with page editing privileges submits a crafted path containing specific characters, those characters bypass standard encoding pipelines.
This vulnerability allows an attacker to insert arbitrary HTML and JavaScript directly into the rendered output of the page. Consequently, any subsequent user who accesses the compromised page will execute the injected script within their browser context. The vulnerability is classified under CWE-79 (Improper Neutralization of Input During Web Page Generation).
The primary defect resides in the implementation of the sourceParsedownElement method within both AudioMediaTrait and VideoMediaTrait. In vulnerable versions of Grav (prior to 2.0.15), this method constructs the HTML representing the media source by concatenating the unescaped path variable, $location, directly into a raw HTML template string.
While traditional image elements process source parameters through an attribute-escaping pipeline that filters special characters, the audio and video subsystems construct a hardcoded <source src="..."> string inside a rawHtml array key. This bypassed the standard security wrappers of the Parsedown engine. When a content editor uploads or links a media file, any query parameters or URL fragment structures appended to the filename are captured in the $location variable.
Although the core Grav architecture contains filtering logic to strip leading hash symbols (#) from parameters via the urlHash helper, it does not neutralize quotes, angle brackets, or script structures within the body of the URL fragment itself. This allows an attacker to craft a media reference where the fragment contains double quotes to break out of the HTML attribute value boundary.
A comparison of the vulnerable codebase and the patched implementation demonstrates how the unescaped path variable was processed. In vulnerable releases, the code directly concatenated the path variable into the HTML string.
// Vulnerable implementation in AudioMediaTrait.php
protected function sourceParsedownElement(array $attributes, $reset = true)
{
// ...
return [
'name' => 'audio',
'rawHtml' => '<source src="' . $location . '">Your browser does not support the audio tag.',
'attributes' => $attributes
];
}The fix, introduced in Grav version 2.0.15, wraps the $location variable in PHP's standard htmlspecialchars function with the ENT_QUOTES configuration flag. This ensures that any double or single quotes, as well as angle brackets, are fully encoded to their respective HTML entities before rendering.
// Patched implementation in AudioMediaTrait.php
protected function sourceParsedownElement(array $attributes, $reset = true)
{
// ...
return [
'name' => 'audio',
'rawHtml' => '<source src="' . htmlspecialchars($location, ENT_QUOTES, 'UTF-8') . '">Your browser does not support the audio tag.',
'attributes' => $attributes
];
}Because the browser parser treats encoded entity characters as literal strings rather than executable syntactic elements, the execution boundary remains intact. An attacker's attempt to break out of the src attribute is rendered inert.
Exploitation requires an attacker to possess privileges that allow the creation or modification of Markdown pages within the Grav CMS. Such roles typically include Authors, Editors, or Contributors. The attacker initiates the exploit by embedding a media attachment containing a malformed filename fragment.
The payload relies on appending a double-quote character, a closing angle bracket, and a scripting payload to the media URL. For example, inserting a payload like video.mp4#"><script>alert(document.cookie)</script> breaks the structural syntax of the <source> tag.
When the system renders this Markdown page, the output converts into the following HTML structure: <source src="video.mp4#"><script>alert(document.cookie)</script>">. The browser parses the script block as an independent DOM node and executes it immediately under the security origin of the hosting domain.
The impact of CVE-2026-75831 is significant due to the stored nature of the script. Once an administrative user views the page, the injected JavaScript executes with the permissions of that administrator's active session. This can lead to complete session hijacking, cookie theft, or administrative actions performed silently in the background.
Because Grav uses administrative tokens and REST APIs to manage user accounts and system configuration, the malicious script can trigger requests that create new super-administrator accounts or execute file upload commands. Such actions can result in arbitrary code execution on the server hosting the CMS.
The vulnerability is assigned a CVSS v3.1 score of 7.6, indicating high severity due to the potential for scope change and high confidentiality impact. The EPSS score indicates a low initial probability of active exploitation in the wild, but administrators should treat any instance of stored script injection as critical.
The primary remediation strategy is upgrading the Grav CMS core installation to version 2.0.15 or newer. This version implements comprehensive attribute escaping on all audio and video media rendering pathways.
For environments where immediate system upgrades are impractical, administrators should implement a Content Security Policy (CSP) header that restricts script execution. Specifically, enforcing a policy that forbids inline scripts or requires unique cryptographic nonces prevents the injected payload from running even if the HTML structure is compromised.
Additionally, security teams can audit the existing Markdown pages by querying the file system for media extensions followed by suspicious HTML characters. Running a system-wide search inside the user/pages/ directory using regular expressions assists in locating pre-existing malicious payloads.
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
Grav getgrav | < 2.0.15 | 2.0.15 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-79 |
| Attack Vector | Network (AV:N) |
| CVSS v3.1 Score | 7.6 (High) |
| EPSS Score | 0.00313 (0.31%) |
| Impact | Stored Cross-Site Scripting (XSS) |
| Exploit Status | Proof-of-Concept |
| KEV Status | Not Listed |
The product does not neutralize or incorrectly neutralizes user-controlled input before it is placed in output that is used as a web page that is served to other users.
CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.
The Natural Language Toolkit (NLTK) versions 3.6 through 3.10.3 contain an algorithmic complexity vulnerability in the LegalitySyllableTokenizer.tokenize method. When processing tokens composed of continuous runs of vowels, an unguarded string reversal and set membership lookup loop executes in quadratic time relative to the input token length. Remote attackers capable of submitting arbitrary text to applications utilizing this tokenizer can trigger sustained single-core CPU exhaustion and application-level denial of service.
CVE-2026-126304 is a symlink path traversal vulnerability (CWE-59) in the Natural Language Toolkit (NLTK) versions 3.10.0 prior to 3.10.4. The YCOECorpusReader class constructs internal sub-readers for the 'psd' and 'pos' subdirectories using FileSystemPathPointer.join(), which relies exclusively on lexical string-prefix validation rather than canonical path resolution. An attacker who supplies a crafted YCOE corpus containing symbolic links in place of the 'psd' or 'pos' subdirectories can bypass directory confinement and read arbitrary files from sibling corpora or sensitive directories within the NLTK data sandbox.
CVE-2026-128077 (GHSA-r99w-jh2x-3mg9) is an authorization bypass and interpretation conflict vulnerability affecting Nuxt and its underlying @nuxt/nitro-server package in versions 4.6.0 through 4.6.3. When an incoming HTTP request path begins with a double forward slash (e.g., //x/admin), the WHATWG URL parser within the Nuxt server-side page renderer interprets the initial segment as a network host/authority and resolves the remaining path (/admin) against the application's page router. Because Nitro server middleware, route-scoped serverHandlers, and Nitro routeRules evaluate the unparsed request path (//x/admin), path-based access controls, redirects, and security header policies configured for /admin fail to match and are bypassed.
Prior to version 2.10.2, the sqlite3-ruby gem explicitly cast 64-bit Ruby string lengths (long) to 32-bit signed integers (int) when invoking the underlying SQLite C API. On 64-bit platforms, providing a string of 4 GiB (2^32 bytes) or larger causes integer truncation, instructing SQLite to process only a prefix of the string. This flaw affects SQL query preparation, bound parameter values, and return values from custom Ruby-defined SQL functions and aggregates, allowing trailing SQL clauses such as WHERE restrictions to be silently dropped under specific conditions.
CVE-2026-128068 (GHSA-cpgf-5mjf-73p7) is a Regular Expression Denial of Service (ReDoS) vulnerability in the rails-html-sanitizer Ruby gem affecting versions 1.0.3 through 1.7.1. The flaw resides in the Rails::HTML::PermitScrubber#scrub_attribute method, which uses the multiline regular expression /^\s*[^#\s].*/m to enforce local-only URI fragment references on SVG elements. On Ruby runtimes prior to version 3.2 (CRuby <= 3.1 and JRuby), evaluating an attribute value composed of repeated newline and whitespace characters without a hash character triggers quadratic backtracking O(n^2). Applications are only vulnerable if their sanitization allowlist is explicitly configured to permit SVG reference elements such as <use> alongside href or xlink:href attributes.