MDN

Go Back   Mambo - Forums Closed for posting > Mambo Announcements Forum > Security Announcements

Closed Thread
 
Thread Tools Search this Thread Display Modes
Old November 18th, 2005, 07:56   #1
counterpoint
 
counterpoint's Avatar
 
Join Date: Sep 2005
Location: Yorkshire, England
Posts: 1,372
counterpoint is on a distinguished road
Default Possible security threat - globals overwrite

People have recently realised that there is a weakness in some versions of PHP that can be exploited to execute arbitrary PHP. You can find details of the problem at http://www.hardened-php.net/index.76.html and there is a good discussion about the issue at Sitepoint http://www.sitepoint.com/forums/showthread.php?t=312884. So far as we can tell, the vulnerability does not affect PHP 4.4.1 or PHP 5.0.4 or later.

The exploit will be blocked in Mambo 4.5.3 to be released later this month. If you would like to fix any version of Mambo before the release is available, then you should insert the following code in the index.php and index2.php files in the Mambo document root. The code should go just after the line of actual code, which is the DEFINE of _VALID_MOS. The code is:

PHP Code:
$protects = array('_REQUEST''_GET''_POST''_COOKIE''_FILES''_SERVER''_ENV''GLOBALS''_SESSION');

foreach (
$protects as $protect) {
    if ( 
in_array($protect array_keys($_REQUEST)) ||
         
in_array($protect array_keys($_GET)) ||
         
in_array($protect array_keys($_POST)) ||
         
in_array($protect array_keys($_COOKIE)) ||
         
in_array($protect array_keys($_FILES))) {
        die(
"Invalid Request.");
    }

This solution is probably overkill, but should block any attack of this nature.

EDIT NOTE: Sorry, there was an error when this was first posted. The array $protect should contain 'GLOBALS' as shown now, and not '_GLOBALS' as it did when first posted. My apologies for the error.

SECOND EDIT NOTE: We have struggled to get this right, partly through not having a live example of the exploit until this morning. The code above has been changed again, and has been tested against live versions of the exploit. It blocks them.

For the record, I should add some further points. The vulnerability does seem to affect ALL versions of PHP. It is not specific to Mambo and has not been totally blocked in Joomla, as can be verified in the Joomla forum. The fix given above can be applied at the entry point to any PHP application that may be vulnerable, including Joomla.

The core team has worked hard to solve this problem, and is very sympathetic to anyone who has been hacked. For those people who have been hacked, please check your site extremely carefully. Since the exploit allows the execution of arbitrary PHP code, you must assume that information may have been stolen or back doors left in your system. If in doubt, please change all critical passwords and reinstall the Mambo code.

Last edited by counterpoint : November 21st, 2005 at 05:05.
counterpoint is offline  
Old November 21st, 2005, 05:11   #2
counterpoint
 
counterpoint's Avatar
 
Join Date: Sep 2005
Location: Yorkshire, England
Posts: 1,372
counterpoint is on a distinguished road
Default

For the benefit of people who are not very comfortable editing the Mambo files, modified versions of the index.php and index2.php files for Mambo 4.5.2.3 are attached here. You should unzip the package into the Mambo root of your web site, replacing the existing files.

All other versions should be modified using the code posted above. If you have problems or need advice, please post in the forums.
Attached Files
File Type: zip mambo4523_security_fix.zip (4.2 KB, 569 views)
counterpoint is offline  
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Turning Register Globals Off in .htaccess brucesenator Installation Questions 4 October 16th, 2005 03:40
Zlib Security Flaw Exposes Swath of Programs kenmcd Security & Performance 2 August 16th, 2005 15:12
Upgrade Security Levels PLEASE! Adrian_A Wishlist & Feature Requests 7 July 11th, 2005 15:00
Mambo security management mambo dancer General Questions 2 July 6th, 2005 15:37


All times are GMT -7. The time now is 07:16.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.