Page MenuHomePhabricator

CVE-2025-62659: CookieConsent should use reserved data attributes to avoid potential XSS vectors
Closed, ResolvedPublicSecurity

Description

While this is likely not an immediate security issue (unless there is an extension, which I'm currently not aware of, that allows what I've described below), I've still decided to file a private security task to report it, since extension code that would normally be safe can turn into an XSS vulnerability.

When reviewing the CookieConsent extension for a planned deployment to the Miraheze wiki farm, I stumbled upon this code. It sets the src attribute of all iframes that have the data-cookieconsent attribute to the value of the data-src attribute. However, a lot of tag extensions pass attributes that are provided by the user via wikitext to the HTML elements they create. While most extension tag implementations use the Sanitizer::validateAttributes function to remove attributes that could potentially be used for XSS, most data attributes, including data-src and data-cookieconsent are allowed by it. If there is an extension that creates iframes and adds user-provided attributes to the output, it is therefore possible to perform XSS by setting data-src to e.g. javascript:alert(1).

To avoid this, reserved data-attributes should be used. Sanitizer::isReservedDataAttribute disallows all data attributes starting with data-mw-.

Details

Risk Rating
Medium
Author Affiliation
Wikimedia Communities
Related Changes in Gerrit:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Thank you for your detailed report and the provided patch. I’ll check this out in detail coming Tuesday.

sbassett subscribed.

Added @Xxmarijnw as the extension maintainer.

Suggested patch:

Thanks for the report and patch. This should just go through gerrit for review. Once merged, we can track this within the current supplemental release.

Change #1188735 had a related patch set uploaded (by Xxmarijnw; author: Xxmarijnw):

[mediawiki/extensions/CookieConsent@master] Use reserved data attributes

https://gerrit.wikimedia.org/r/1188735

Change #1188735 merged by jenkins-bot:

[mediawiki/extensions/CookieConsent@master] SECURITY: Use reserved data attributes

https://gerrit.wikimedia.org/r/1188735

Xxmarijnw claimed this task.
sbassett triaged this task as Medium priority.Oct 20 2025, 8:08 PM
sbassett changed the visibility from "Custom Policy" to "Public (No Login Required)".
sbassett changed the edit policy from "Custom Policy" to "All Users".
sbassett changed Risk Rating from N/A to Medium.
SomeRandomDeveloper renamed this task from CookieConsent should use reserved data attributes to avoid potential XSS vectors to CVE-2025-62659: CookieConsent should use reserved data attributes to avoid potential XSS vectors.Oct 22 2025, 7:27 PM