/

CVE-2026-57440

Severity:

HIGH RISK

(7.5)

Cross-Site Scripting (CWE-79) in MediaWiki EmbedVideo

CVE-2026-57440

Deferred

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79, CWE-80

Impact:

Client-side code execution and arbitrary HTML injection

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

The EmbedVideo Extension for MediaWiki can allow cross-site scripting when video URL or identifier input is inserted into an iframe src attribute without sufficient sanitization. When consent enforcement is disabled and a malformed value is processed, an attacker may inject HTML or JavaScript into pages containing the affected embedding functionality.

Affected context

The issue occurs in EmbedVideo deployments using a version before the patched release where $wgEmbedVideoRequireConsent is disabled. Under those conditions, URLs supplied to the #ev parser function or related parser tags may reach an iframe src attribute without adequate output encoding, allowing specially formed values to alter the surrounding markup.

Exploit preconditions

  • Attack surface: MediaWiki pages that use EmbedVideo parser functions or tags
  • Required access: Ability to submit or influence video URL or identifier input that is rendered by the extension
  • Configuration condition: $wgEmbedVideoRequireConsent must be disabled
  • Trigger point: Rendering an iframe from a malformed video URL or identifier
  • Why exploitation is possible: Untrusted input can escape the quoted src attribute when output is not properly sanitized or encoded

Why this happens

The vulnerability results from inserting externally influenced URL data into an HTML attribute without applying context-appropriate output encoding and validation. A malformed value containing quote characters can terminate the intended src attribute and introduce additional markup or script-capable content. This is consistent with CWE-79: Improper Neutralization of Input During Web Page Generation, with CWE-80: Improper Neutralization of Script-Related HTML Tags also describing the broader HTML and script injection risk.

Potential impact

  • An attacker may execute JavaScript in the context of a victim's MediaWiki session
  • Malicious content could be injected into pages that render affected embeds
  • Session data or page-accessible information could be exposed
  • User actions may be performed without the victim's intent
  • Site content or administrative workflows could be altered, depending on privileges

General mitigation guidance

Mitigation generally focuses on enforcing safe output handling at the HTML attribute boundary and reducing trust in user-controlled embedding data.

Common defensive patterns include:

  • Apply context-aware HTML attribute encoding to all video URLs and identifiers
  • Validate URLs against an explicit allowlist of permitted schemes, hosts, and URL formats
  • Reject malformed identifiers before template rendering
  • Prefer structured URL construction over string concatenation
  • Keep consent and security-related configuration enabled by default where practical
  • Apply restrictive Content Security Policy controls as defense in depth
  • Render embedded content with the least privilege and isolation supported by the platform

How teams detect issues like this

Organizations can identify similar issues through:

  • Static analysis for unescaped values inserted into HTML attributes
  • Code review checks for string concatenation involving iframe or other tag attributes
  • Tests using quote characters, malformed URLs, unexpected schemes, and encoded delimiters
  • Dynamic scanning of pages that render user-controlled embedding parameters
  • Policy enforcement requiring centralized HTML escaping and URL validation helpers
  • Automated security review tools configured to detect cross-site scripting and HTML injection patterns

Sources

SourceLink
github.comgithub.com/StarCitizenWiki/mediawiki-extensions-EmbedVideo/commit/370156335b325bb81d14d89edf0a1f2643d50a84
github.comgithub.com/StarCitizenWiki/mediawiki-extensions-EmbedVideo/security/advisories/GHSA-v65j-hff3-753c

Frequently asked

questions

It can be exploitable through a web request or page-editing workflow when an attacker can influence a video URL or identifier that is rendered by the affected EmbedVideo functionality.

The described behavior requires $wgEmbedVideoRequireConsent to be disabled, which is not the default setting. The attacker must also reach an affected embedding path with input that is rendered into the iframe attribute.

Treat video URLs and identifiers as untrusted data, validate them against an allowlist, construct URLs safely, and apply context-specific HTML attribute encoding before rendering.

Centralize output encoding, test malformed and delimiter-containing inputs, enforce secure configuration defaults, and use code review or automated analysis rules for dynamic HTML generation.

Find out what's already
exploitable in your codebase.