Page MenuHomePhabricator

CVE-2025-6591: HTML injection in API action=feedcontributions output from i18n message
Closed, ResolvedPublicSecurity

Description

This is basically the same issue as T386175: CVE-2025-32072: HTML injection in feed output from i18n message, except in the API's action=feedcontributions class.

This applies to:

Note that both are ->inContentLanguage(), so you'll need to set $wgLanguageCode = 'x-xss';, and then visiting a URL like http://localhost:4881/api.php?action=feedcontributions&format=json&user=Administrator&formatversion=2&uselang=x-xss, you'll see:

Screenshot 2025-04-17 at 22-26-26 .png (940×1 px, 174 KB)

in which the <title> and <description> both have unescaped script tags. I didn't research whether this would be exploitable in any feed reader (presumably feed readers should be defensive against this), but just copying T386175.

Fix should be as simple as using ->escaped() as the output format. I'll post a patch in a few minutes.

Event Timeline

Code review: in execute(), htmlspecialchars( $msg ) should probably be changed to just $msg now that $msg is already escaped? (But I haven’t tried this out locally.)

About the content language issue, I wonder if the x-xss language code should also set the content language, or if that would cause more problems…

For the patch, yes, you're right, htmlspecialchars( $msg ) should be just $msg as it will be encoded twice, needs a small tweak @Legoktm

Jly edited projects, added Patch-Needs-Improvement, Vuln-XSS; removed Patch-For-Review.

For the patch, yes, you're right, htmlspecialchars( $msg ) should be just $msg as it will be encoded twice, needs a small tweak @Legoktm

Fixed in rev 2:

sbassett changed the task status from Open to In Progress.Apr 28 2025, 4:21 PM
sbassett moved this task from Incoming to Security Patch To Deploy on the Security-Team board.
sbassett edited projects, added Patch-For-Review; removed Patch-Needs-Improvement.
sbassett added a parent task: Restricted Task.Apr 28 2025, 9:53 PM
sbassett removed a project: Patch-For-Review.

Deployed the rev2 patch to Wikimedia production: https://sal.toolforge.org/log/ImZtfpYBvg159pQrEcEf. All seems fine.

Reedy renamed this task from HTML injection in API action=feedcontributions output from i18n message to CVE-2025-6591: HTML injection in API action=feedcontributions output from i18n message.Jun 24 2025, 11:26 PM

Change #1165072 had a related patch set uploaded (by Reedy; author: Legoktm):

[mediawiki/core@REL1_43] SECURITY: API: Escape i18n messages in action=feedcontributions

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

Change #1165085 had a related patch set uploaded (by Reedy; author: Legoktm):

[mediawiki/core@REL1_39] SECURITY: API: Escape i18n messages in action=feedcontributions

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

Change #1165098 had a related patch set uploaded (by Reedy; author: Legoktm):

[mediawiki/core@REL1_44] SECURITY: API: Escape i18n messages in action=feedcontributions

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

Change #1165085 merged by jenkins-bot:

[mediawiki/core@REL1_39] SECURITY: API: Escape i18n messages in action=feedcontributions

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

Change #1165113 had a related patch set uploaded (by Reedy; author: Legoktm):

[mediawiki/core@master] SECURITY: API: Escape i18n messages in action=feedcontributions

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

Change #1165132 had a related patch set uploaded (by Reedy; author: Legoktm):

[mediawiki/core@REL1_42] SECURITY: API: Escape i18n messages in action=feedcontributions

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

Change #1165098 merged by jenkins-bot:

[mediawiki/core@REL1_44] SECURITY: API: Escape i18n messages in action=feedcontributions

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

Change #1165072 merged by jenkins-bot:

[mediawiki/core@REL1_43] SECURITY: API: Escape i18n messages in action=feedcontributions

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

Change #1165113 merged by jenkins-bot:

[mediawiki/core@master] SECURITY: API: Escape i18n messages in action=feedcontributions

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

Change #1165132 merged by jenkins-bot:

[mediawiki/core@REL1_42] SECURITY: API: Escape i18n messages in action=feedcontributions

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

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 Low.