r104506 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104505‎ | r104506 | r104507 >
Date:23:28, 28 November 2011
Author:reedy
Status:ok
Tags:
Comment:
* (bug 32276) Skins were generating output using the internal page title which would allow anonymous users to determine wheter a page exists, potentially leaking private data. In fact, the curid and oldid request parameters would
allow page titles to be enumerated even when they are not guessable.
* (bug 32616) action=ajax requests were dispatched to the relevant internal functions without any read permission checks being done. This could lead to data leakage on private wikis
Modified paths:
  • /branches/REL1_17/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_17/phase3/includes/AjaxDispatcher.php (modified) (history)
  • /branches/REL1_17/phase3/includes/DefaultSettings.php (modified) (history)
  • /branches/REL1_17/phase3/includes/SkinTemplate.php (modified) (history)
  • /branches/REL1_17/phase3/includes/Wiki.php (modified) (history)

Diff [purge]

Index: branches/REL1_17/phase3/includes/AjaxDispatcher.php
@@ -74,7 +74,7 @@
7575 * request.
7676 */
7777 function performAction() {
78 - global $wgAjaxExportList, $wgOut;
 78+ global $wgAjaxExportList, $wgOut, $wgUser;
7979
8080 if ( empty( $this->mode ) ) {
8181 return;
@@ -90,6 +90,13 @@
9191 'Bad Request',
9292 "unknown function " . (string) $this->func_name
9393 );
 94+ } elseif ( !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true )
 95+ && !$wgUser->isAllowed( 'read' ) )
 96+ {
 97+ wfHttpError(
 98+ 403,
 99+ 'Forbidden',
 100+ 'You must log in to view pages.' );
94101 } else {
95102 wfDebug( __METHOD__ . ' dispatching ' . $this->func_name . "\n" );
96103
Index: branches/REL1_17/phase3/includes/Wiki.php
@@ -149,10 +149,21 @@
150150 * @return boolean true if successful
151151 */
152152 function preliminaryChecks( &$title, &$output ) {
 153+ global $wgTitle;
153154 // If the user is not logged in, the Namespace:title of the article must be in
154155 // the Read array in order for the user to see it. (We have to check here to
155156 // catch special pages etc. We check again in Article::view())
156157 if( !is_null( $title ) && !$title->userCanRead() ) {
 158+ // Bug 32276: allowing the skin to generate output with $wgTitle
 159+ // set to the input title would allow anonymous users to
 160+ // determine whether a page exists, potentially leaking private data. In fact, the
 161+ // curid and oldid request parameters would allow page titles to be enumerated even
 162+ // when they are not guessable. So we reset the title to Special:Badtitle before the
 163+ // permissions error is displayed.
 164+ $badtitle = SpecialPage::getTitleFor( 'Badtitle' );
 165+ $output->setTitle( $badtitle );
 166+ $wgTitle = $badtitle;
 167+
157168 $output->loginToUse();
158169 $this->finalCleanup( $output );
159170 $output->disable();
Index: branches/REL1_17/phase3/includes/SkinTemplate.php
@@ -549,11 +549,22 @@
550550
551551 /* set up the default links for the personal toolbar */
552552 $personal_urls = array();
553 - $page = $wgRequest->getVal( 'returnto', $this->thisurl );
554 - $query = $wgRequest->getVal( 'returntoquery', $this->thisquery );
555 - $returnto = "returnto=$page";
556 - if( $this->thisquery != '' )
557 - $returnto .= "&returntoquery=$query";
 553+
 554+ # Due to bug 32276, if a user does not have read permissions,
 555+ # $wgOut->getTitle() will just give Special:Badtitle, which is
 556+ # not especially useful as a returnto parameter. Use the title
 557+ # from the request instead, if there was one.
 558+ $page = Title::newFromURL( $wgRequest->getVal( 'title', '' ) );
 559+ $page = $wgRequest->getVal( 'returnto', $page );
 560+ $returnto = '';
 561+ if( strval( $page ) !== '' ) {
 562+ $returnto = "returnto=$page";
 563+ $query = $wgRequest->getVal( 'returntoquery', $this->thisquery );
 564+ if( $query != '' ) {
 565+ $returnto .= "&returntoquery=$query";
 566+ }
 567+ }
 568+
558569 if( $this->loggedin ) {
559570 $personal_urls['userpage'] = array(
560571 'text' => $this->username,
Index: branches/REL1_17/phase3/includes/DefaultSettings.php
@@ -34,7 +34,7 @@
3535 /** @endcond */
3636
3737 /** MediaWiki version number */
38 -$wgVersion = '1.17.0';
 38+$wgVersion = '1.17.1';
3939
4040 /** Name of the site. It must be changed in LocalSettings.php */
4141 $wgSitename = 'MediaWiki';
Index: branches/REL1_17/phase3/RELEASE-NOTES
@@ -5,8 +5,19 @@
66
77 == MediaWiki 1.17.1 ==
88
9 -This a maintenance release of the MediaWiki 1.17 branch.
 9+2011-11-24
1010
 11+This a maintenance and security release of the MediaWiki 1.17 branch.
 12+
 13+=== Security changes ===
 14+* (bug 32276) Skins were generating output using the internal page title which
 15+ would allow anonymous users to determine wheter a page exists, potentially
 16+ leaking private data. In fact, the curid and oldid request parameters would
 17+ allow page titles to be enumerated even when they are not guessable.
 18+* (bug 32616) action=ajax requests were dispatched to the relevant internal
 19+ functions without any read permission checks being done. This could lead to
 20+ data leakage on private wikis.
 21+
1122 === Summary of selected changes in 1.17 ===
1223
1324 Selected changes since MediaWiki 1.16 that may be of interest:

Follow-up revisions

RevisionCommit summaryAuthorDate
r104508* (bug 32276) Skins were generating output using the internal page title whic...reedy23:30, 28 November 2011
r104509* (bug 32276) Skins were generating output using the internal page title whic...reedy23:31, 28 November 2011
r104510Tagging REL1_17_1 from r104506reedy23:35, 28 November 2011
r106170Bug 32709: private Wiki users were always taken to Special:Badtitle on login...hashar09:41, 14 December 2011
r106171Bug 32709: private Wiki users were always taken to Special:Badtitle on login...hashar09:41, 14 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104505* (bug 32276) Skins were generating output using the internal page title whic...reedy23:18, 28 November 2011

Status & tagging log