BUGTRAQ ID: 29796
CVE ID:CVE-2008-2666
CNCVE ID:CNCVE-20082666
PHP 5是一款开放源代码的网络编程语言。
PHP 5 'chdir()'和'ftok()'函数存在'safe_mode绕过问题,远程攻击者可以利用漏洞在未授权位置检测文件是否存在等敏感信息。
问题代码如下:
- ---
PHP_FUNCTION(chdir)
{
char *str;
int ret, str_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str,
&str_len) == FAILURE) {
RETURN_FALSE;
}
if ((PG(safe_mode) && !php_checkuid(str, NULL,
CHECKUID_CHECK_FILE_AND_DIR)) || php_check_open_basedir(str TSRMLS_CC))
{
RETURN_FALSE;
}
ret = VCWD_CHDIR(str);
if (ret != 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)",
strerror(errno), errno);
RETURN_FALSE;
}
RETURN_TRUE;
}
- ---
str由safe_mode检查,如:
- ---
Warning: chdir(): SAFE MODE Restriction in effect. The script whose uid
is 80 is not allowed to access / owned by uid 0 in /www/mb/mb.php on
line 8
- ---
在当前目录中,可建立子目录"http:",如chdir("http://../../../../../../"),那么就处于/目录中。
原因是:
TRUE==((PG(safe_mode) && !php_checkuid(str, NULL,
CHECKUID_CHECK_FILE_AND_DIR)) || php_check_open_basedir(str
TSRMLS_CC)))
for
str="http://../../../../../../"
safe_mode会忽略http://中的所有路径。
ftok()也存在相同情况。
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
+ Ubuntu Ubuntu Linux 7.04 sparc
+ Ubuntu Ubuntu Linux 7.04 powerpc
+ Ubuntu Ubuntu Linux 7.04 i386
+ Ubuntu Ubuntu Linux 7.04 amd64
PHP PHP 5.1.6
+ Ubuntu Ubuntu Linux 6.10 sparc
+ Ubuntu Ubuntu Linux 6.10 powerpc
+ Ubuntu Ubuntu Linux 6.10 i386
+ Ubuntu Ubuntu Linux 6.10 amd64
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
+ Ubuntu Ubuntu Linux 6.06 LTS sparc
+ Ubuntu Ubuntu Linux 6.06 LTS powerpc
+ Ubuntu Ubuntu Linux 6.06 LTS i386
+ Ubuntu Ubuntu Linux 6.06 LTS amd64
PHP PHP 5.1.1
PHP PHP 5.1
PHP PHP 5.0.5
PHP PHP 5.0.4
PHP PHP 5.0.3
+ Trustix Secure Linux 2.2
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
+ Debian Linux 4.0 sparc
+ Debian Linux 4.0 s/390
+ Debian Linux 4.0 powerpc
+ Debian Linux 4.0 mipsel
+ Debian Linux 4.0 mips
+ Debian Linux 4.0 m68k
+ Debian Linux 4.0 ia-64
+ Debian Linux 4.0 ia-32
+ Debian Linux 4.0 hppa
+ Debian Linux 4.0 arm
+ Debian Linux 4.0 amd64
+ Debian Linux 4.0 alpha
+ Debian Linux 4.0
目前没有解决方案提供:
<a href=http://www.php.net/ target=_blank>http://www.php.net/</a>
暂无评论