Page MenuHomePhabricator

CVE-2025-53496: Stored XSS through a system message in MediaSearch
Closed, ResolvedPublicSecurity

Description

The mediasearch-empty-state system message is inserted as raw HTML by the MediaSearch extension, allowing for stored XSS by adding malicious HTML to the message.

Reproduction

  1. Edit MediaWiki:Mediasearch-empty-state to <img src="" onerror="alert('mediasearch-empty-state')"> (Note that <script> tags do not work here due to the way the HTML is inserted)
  2. Visit Special:MediaSearch

image.png (129×396 px, 6 KB)

Cause

mw.msg() returns the message using the text() output mode without escaping any HTML.
https://github.com/wikimedia/mediawiki-extensions-MediaSearch/blob/10530d9a7800784a09c8f062d19bd3269306b193/resources/components/EmptyState.vue#L32-L34

The message is then inserted as raw HTML via v-html:
https://github.com/wikimedia/mediawiki-extensions-MediaSearch/blob/10530d9a7800784a09c8f062d19bd3269306b193/resources/components/EmptyState.vue#L5-L6

Additional information

MediaWiki: 1.45.0-alpha (b6993c3)
MediaSearch: 10530d9

Event Timeline

Patch:


The non-JS template escapes the message too, so this should not cause any issues.

Patch:


The non-JS template escapes the message too, so this should not cause any issues.

LGTM. I suppose this is the same as changing the existing v-html attribute to v-text? At least AFAIK. Anyhow, we can get this deployed during today's security deployment window.

LGTM. I suppose this is the same as changing the existing v-html attribute to v-text? At least AFAIK. Anyhow, we can get this deployed during today's security deployment window.

According to the docs, it is the same, but I preferred using the mustache syntax here since it's easier to read.

The above patch has been deployed to Wikimedia production. I'll also add it to the next supplemental security release (T389312).

Jly renamed this task from Stored XSS through a system message in MediaSearch to CVE-2025-53486: Stored XSS through a system message in MediaSearch.Jun 30 2025, 7:22 PM
Jly renamed this task from CVE-2025-53486: Stored XSS through a system message in MediaSearch to CVE-2025-53496: Stored XSS through a system message in MediaSearch.Jun 30 2025, 7:26 PM

Change #1166030 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/MediaSearch@master] SECURITY: Insert message as text instead of HTML

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

Change #1166032 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/MediaSearch@REL1_44] SECURITY: Insert message as text instead of HTML

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

Change #1166033 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/MediaSearch@REL1_43] SECURITY: Insert message as text instead of HTML

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

Change #1166034 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/MediaSearch@REL1_42] SECURITY: Insert message as text instead of HTML

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

Change #1166035 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/MediaSearch@REL1_39] SECURITY: Insert message as text instead of HTML

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

Change #1166030 merged by Jly:

[mediawiki/extensions/MediaSearch@master] SECURITY: Insert message as text instead of HTML

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

Change #1166033 merged by Jly:

[mediawiki/extensions/MediaSearch@REL1_43] SECURITY: Insert message as text instead of HTML

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

Change #1166032 merged by Jly:

[mediawiki/extensions/MediaSearch@REL1_44] SECURITY: Insert message as text instead of HTML

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

Change #1166034 merged by Jly:

[mediawiki/extensions/MediaSearch@REL1_42] SECURITY: Insert message as text instead of HTML

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

Jly removed a project: Patch-For-Review.
Jly changed the visibility from "Custom Policy" to "Public (No Login Required)".
Jly changed the edit policy from "Custom Policy" to "All Users".
Jly changed Risk Rating from N/A to Low.

Change #1166035 merged by Jly:

[mediawiki/extensions/MediaSearch@REL1_39] SECURITY: Insert message as text instead of HTML

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