/

CVE-2026-75831

Severity:

HIGH RISK

(7.6)

Stored XSS (CWE-79) in Grav Media Rendering Pipeline

CVE-2026-75831

Deferred

Vulnerability type

Category:

Cross-Site Scripting

CWE:

CWE-79

Impact:

Stored Cross-Site Scripting and Client-Side Code Execution

Severity:

HIGH RISK

(7.6)

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

Grav contains a stored cross-site scripting vulnerability in audio and video media rendering through the sourceParsedownElement method. When a media URL fragment is inserted into a raw HTML source element without escaping, an attacker who can store or influence the media reference may cause arbitrary HTML or JavaScript to execute in viewers' sessions.

Affected context

The vulnerability may affect Grav deployments that render audio or video media through the vulnerable sourceParsedownElement path. It becomes risky when attacker-controlled or insufficiently trusted media URL fragments are stored and later concatenated into HTML source elements without context-appropriate output encoding. The affected behavior is associated with Grav versions before 2.0.15.

Exploit preconditions

  • Attack surface: Grav content or media rendering functionality
  • Required access: Ability to submit, edit, or otherwise influence stored media references or URL fragments
  • Trigger point: A viewer accesses a page that renders the stored audio or video element
  • Why exploitation is possible: The media URL fragment is incorporated into raw HTML without sufficient escaping, allowing markup or script content to be interpreted by the browser

Why this happens

The underlying bug is a failure to apply context-appropriate output encoding when constructing HTML from stored media data. The sourceParsedownElement method concatenates a media URL fragment into a raw source element, allowing data intended as an attribute value to be interpreted as HTML or script content. This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation, commonly known as cross-site scripting.

Potential impact

  • Arbitrary JavaScript may execute in a viewer's browser session
  • Attackers could access data available to the affected user's session
  • Page content or media controls could be modified
  • Users could be redirected to malicious destinations
  • Administrative actions could be performed if a privileged user views the affected content

General mitigation guidance

Mitigation generally focuses on preserving the separation between data and executable markup.

Common defensive patterns include:

  • Applying context-aware HTML attribute encoding to media URL values
  • Using safe DOM or templating APIs that keep untrusted values as data
  • Allowing only approved URL schemes, hosts, and media path formats
  • Validating and canonicalizing media references before storage and again before rendering
  • Avoiding raw HTML concatenation for user-controlled values
  • Limiting content-editing privileges and reducing administrative session permissions
  • Applying browser security controls such as an appropriately restrictive Content Security Policy where practical

How teams detect issues like this

Organizations commonly detect this class of issue through:

  • Static analysis rules identifying string concatenation into HTML attributes or raw markup
  • Code review checks for media rendering paths that omit output encoding
  • Tests using harmless markup-like and delimiter characters in stored media fields
  • Runtime security testing of pages containing attacker-influenced audio and video elements
  • Content policies that restrict who can create or modify rendered media references
  • Automated review tools that flag untrusted data flowing into HTML generation APIs

Sources

SourceLink
github.comgithub.com/getgrav/grav/commit/aba291a59cab29ddce491175791888d8d0b65e20
github.comgithub.com/getgrav/grav/security/advisories/GHSA-6qw9-4vv5-jr97
vulncheck.comvulncheck.com/advisories/grav-before-stored-xss-via-audio-video-source-url

Frequently asked

questions

It can be exploitable through the application if an attacker can store or influence a media URL fragment and cause another user to view the resulting rendered content. The exact scope depends on Grav permissions and deployment controls.

Not necessarily in every deployment. Exploitation may require authenticated content-editing access, but an exposed submission or content-import path could provide the required input capability.

Treat media references as untrusted data, validate their allowed format and scheme, and apply context-appropriate HTML attribute encoding before rendering.

Avoid raw HTML concatenation, use safe templating or DOM APIs, restrict content-authoring privileges, and include stored-XSS cases in code review and security testing.

Find out what's already
exploitable in your codebase.