Page MenuHomePhabricator

Messages userrights-expiry-current and userrights-expiry-none can contain raw html (CVE-2020-35475)
Closed, ResolvedPublicSecurity

Description

While working on T216348 I have found an issue with messages userrights-expiry-current and userrights-expiry-none

Added with https://gerrit.wikimedia.org/r/c/mediawiki/core/+/328377 back in 1.29

						if ( $currentExpiry ) {
							$expiryFormatted = $uiLanguage->userTimeAndDate( $currentExpiry, $uiUser );
							$expiryFormattedD = $uiLanguage->userDate( $currentExpiry, $uiUser );
							$expiryFormattedT = $uiLanguage->userTime( $currentExpiry, $uiUser );
							$expiryHtml = $this->msg( 'userrights-expiry-current' )->params(
								$expiryFormatted, $expiryFormattedD, $expiryFormattedT )->text();
						} else {
							$expiryHtml = $this->msg( 'userrights-expiry-none' )->text();
						}

The code is using Message::text here as many other places in the same function, but all the other places are passing the text through Xml::element or similiar and gets escaped.
The both message here does not gets escaped.

The leak can happen when a user visits Special:UserRights which does not have rights to change all userrights and the table on the left side has unchangeable groups in it. The right column with the changable groups is not effected and escape correctly.

Event Timeline

Reedy triaged this task as High priority.Nov 30 2020, 4:24 PM
Reedy moved this task from Incoming to Watching on the Security-Team board.

Similar to T268894, this should be low-risk enough where it can be fixed publicly in gerrit with a benign commit message.

Could be public from my point of view

Let's wait for the train deployments this week and then make this task public. Probably want to backport to 1.31 and 1.35 as well, if the patch applies.

Change 649520 had a related patch set uploaded (by Reedy; owner: Umherirrender):
[mediawiki/core@REL1_31] Use Xml::element in SpecialUserrights for sanity

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

Reedy subscribed.

Closing for ease of tracking. Can/will be made public later

Change 649520 merged by jenkins-bot:
[mediawiki/core@REL1_31] Use Xml::element in SpecialUserrights for sanity

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

Change 649519 merged by jenkins-bot:
[mediawiki/core@REL1_35] Use Xml::element in SpecialUserrights for sanity

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

Reedy renamed this task from Messages userrights-expiry-current and userrights-expiry-none can contains raw html to Messages userrights-expiry-current and userrights-expiry-none can contain raw html.Dec 15 2020, 4:11 PM
Reedy removed a project: Patch-For-Review.
Reedy renamed this task from Messages userrights-expiry-current and userrights-expiry-none can contain raw html to Messages userrights-expiry-current and userrights-expiry-none can contain raw html (CVE-2020-35475).Dec 16 2020, 12:35 PM
Reedy changed the visibility from "Custom Policy" to "Public (No Login Required)".Dec 18 2020, 12:24 AM
Reedy changed the edit policy from "Custom Policy" to "All Users".