Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit a4c87da

Browse files
GrunnyOwen Davis
authored and
Owen Davis
committed
(MAIN-4265) Apply MediaWiki 1.19.24 security release to core
1 parent ca48c27 commit a4c87da

12 files changed

+397
-89
lines changed

RELEASE-NOTES-1.19

+14
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
Security reminder: MediaWiki does not require PHP's register_globals
44
setting since version 1.2.0. If you have it on, turn it '''off''' if you can.
55

6+
== MediaWiki 1.19.24 ==
7+
8+
This is a security and maintenance release of the MediaWiki 1.19 branch.
9+
10+
== Changes since 1.19.23 ==
11+
12+
* (T85848, T71210) SECURITY: Don't parse XMP blocks that contain XML entities,
13+
to prevent various DoS attacks.
14+
* (T88310) SECURITY: Always expand xml entities when checking SVG's.
15+
* (T73394) SECURITY: Escape > in Html::expandAttributes to prevent XSS.
16+
* (T85855) SECURITY: Don't execute another user's CSS or JS on preview.
17+
* (T85349, T85850, T86711) SECURITY: Multiple issues fixed in SVG filtering to
18+
prevent XSS and protect viewer's privacy.
19+
620
== MediaWiki 1.19.23 ==
721

822
This is a security and maintenance release of the MediaWiki 1.19 branch.

includes/DefaultSettings.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/** @endcond */
3434

3535
/** MediaWiki version number */
36-
$wgVersion = '1.19.23';
36+
$wgVersion = '1.19.24';
3737

3838
/** Name of the site. It must be changed in LocalSettings.php */
3939
$wgSitename = 'MediaWiki';

includes/EditPage.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -2083,14 +2083,19 @@ protected function showHeader() {
20832083
if ( $this->isWrongCaseCssJsPage ) {
20842084
$wgOut->wrapWikiMsg( "<div class='error' id='mw-userinvalidcssjstitle'>\n$1\n</div>", array( 'userinvalidcssjstitle', $this->mTitle->getSkinFromCssJsSubpage() ) );
20852085
}
2086+
if ( $this->getTitle()->isSubpageOf( $wgUser->getUserPage() ) ) {
20862087
if ( $this->formtype !== 'preview' ) {
2087-
if ( $this->isCssSubpage )
2088+
if ( $this->isCssSubpage ) {
20882089
$wgOut->wrapWikiMsg( "<div id='mw-usercssyoucanpreview'>\n$1\n</div>", array( 'usercssyoucanpreview' ) );
2089-
if ( $this->isJsSubpage )
2090+
}
2091+
2092+
if ( $this->isJsSubpage ) {
20902093
$wgOut->wrapWikiMsg( "<div id='mw-userjsyoucanpreview'>\n$1\n</div>", array( 'userjsyoucanpreview' ) );
20912094
}
20922095
}
20932096
}
2097+
}
2098+
}
20942099

20952100
if ( $this->mTitle->getNamespace() != NS_MEDIAWIKI && $this->mTitle->isProtected( 'edit' ) ) {
20962101
# Is the title semi-protected?

includes/Html.php

+30-6
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ public static function expandAttributes( $attribs ) {
450450
'class', // html4, html5
451451
'accesskey', // as of html5, multiple space-separated values allowed
452452
// html4-spec doesn't document rel= as space-separated
453-
// but has been used like that and is now documented as such
453+
// but has been used like that and is now documented as such
454454
// in the html5-spec.
455455
'rel',
456456
);
@@ -463,7 +463,7 @@ public static function expandAttributes( $attribs ) {
463463
// values. Implode/explode to get those into the main array as well.
464464
if ( is_array( $value ) ) {
465465
// If input wasn't an array, we can skip this step
466-
466+
467467
$newValue = array();
468468
foreach ( $value as $k => $v ) {
469469
if ( is_string( $v ) ) {
@@ -523,10 +523,34 @@ public static function expandAttributes( $attribs ) {
523523
$ret .= " $key=\"$key\"";
524524
}
525525
} else {
526-
// Note: It's important to encode < and >, even if its not
527-
// required in this context, due to how language converter
528-
// works.
529-
$ret .= " $key=$quote" . Sanitizer::encodeAttribute( $value ) . $quote;
526+
# Apparently we need to entity-encode \n, \r, \t, although the
527+
# spec doesn't mention that. Since we're doing strtr() anyway,
528+
# we may as well not call htmlspecialchars().
529+
# @todo FIXME: Verify that we actually need to
530+
# escape \n\r\t here, and explain why, exactly.
531+
#
532+
# We could call Sanitizer::encodeAttribute() for this, but we
533+
# don't because we're stubborn and like our marginal savings on
534+
# byte size from not having to encode unnecessary quotes.
535+
# The only difference between this transform and the one by
536+
# Sanitizer::encodeAttribute() is '<' is only encoded here if
537+
# $wgWellFormedXml is set, and ' is not encoded.
538+
$map = array(
539+
'&' => '&amp;',
540+
'"' => '&quot;',
541+
'>' => '&gt;',
542+
"\n" => '&#10;',
543+
"\r" => '&#13;',
544+
"\t" => '&#9;'
545+
);
546+
if ( $wgWellFormedXml ) {
547+
# This is allowed per spec: <http://www.w3.org/TR/xml/#NT-AttValue>
548+
# But reportedly it breaks some XML tools?
549+
# @todo FIXME: Is this really true?
550+
$map['<'] = '&lt;';
551+
}
552+
553+
$ret .= " $key=$quote" . strtr( $value, $map ) . $quote;
530554
}
531555
}
532556
return $ret;

includes/OutputPage.php

+4
Original file line numberDiff line numberDiff line change
@@ -3115,6 +3115,10 @@ public function userCanPreview() {
31153115
if ( !$this->getTitle()->isJsSubpage() && !$this->getTitle()->isCssSubpage() ) {
31163116
return false;
31173117
}
3118+
if ( !$this->getTitle()->isSubpageOf( $this->getUser()->getUserPage() ) ) {
3119+
// Don't execute another user's CSS or JS on preview (T85855)
3120+
return false;
3121+
}
31183122

31193123
return !count( $this->getTitle()->getUserPermissionsErrors( 'edit', $this->getUser() ) );
31203124
}

0 commit comments

Comments
 (0)