r55807 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55806‎ | r55807 | r55808 >
Date:06:51, 4 September 2009
Author:tstarling
Status:ok
Tags:
Comment:
Fix potential arbitrary script execution vulnerability. Doesn't seem to be exploitable with a default install of PHP, but it might be possible with third-party extensions enabled.
Modified paths:
  • /trunk/phase3/maintenance/Maintenance.php (modified) (history)
  • /trunk/phase3/maintenance/doMaintenance.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/doMaintenance.php
@@ -26,11 +26,16 @@
2727 * @ingroup Maintenance
2828 */
2929
 30+if ( !defined( 'DO_MAINTENANCE' ) ) {
 31+ echo "This file must be included after Maintenance.php\n";
 32+ exit( 1 );
 33+}
 34+
3035 error_reporting( E_ALL | E_STRICT );
3136
32 -if( !isset( $maintClass ) || !class_exists( $maintClass ) ) {
 37+if( !$maintClass || !class_exists( $maintClass ) ) {
3338 echo "\$maintClass is not set or is set to a non-existent class.";
34 - die();
 39+ exit( 1 );
3540 }
3641
3742 if( defined( 'MW_NO_SETUP' ) ) {
@@ -60,7 +65,7 @@
6166 # Maybe a hook?
6267 global $cluster;
6368 $wgWikiFarm = true;
64 - $cluster = 'pmtma';
 69+ $cluster = 'pmtpa';
6570 require_once( "$IP/includes/AutoLoader.php" );
6671 require_once( "$IP/includes/SiteConfiguration.php" );
6772 require( "$IP/wgConf.php" );
Index: trunk/phase3/maintenance/Maintenance.php
@@ -1,6 +1,7 @@
22 <?php
33 // Define this so scripts can easily find doMaintenance.php
44 define( 'DO_MAINTENANCE', dirname( __FILE__ ) . '/doMaintenance.php' );
 5+$maintClass = false;
56
67 // Make sure we're on PHP5 or better
78 if( version_compare( PHP_VERSION, '5.0.0' ) < 0 ) {

Status & tagging log