PHP tempname()函数绕过safe_mode安全限制漏洞
BUGTRAQ ID: 36555
CVE ID: CVE-2009-3557
PHP是广泛使用的通用目的脚本语言,特别适合于Web开发,可嵌入到HTML中。
PHP的tempnam()中的错误可能允许绕过safe_mode限制。以下是ext/standard/file.c中的有漏洞代码段:
PHP_FUNCTION(tempnam)
{
char *dir, *prefix;
int dir_len, prefix_len;
size_t p_len;
char *opened_path;
char *p;
int fd;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &dir, &dir_len,
&prefix, &prefix_len) == FAILURE) {
return;
}
if (php_check_open_basedir(dir TSRMLS_CC)) { [1]
RETURN_FALSE;
}
php_basename(prefix, prefix_len, NULL, 0, &p, &p_len TSRMLS_CC);
if (p_len > 64) {
p[63] = '\0';mud pump
}
if ((fd = php_open_temporary_fd(dir, p, &opened_path TSRMLS_CC)) >= 0) {
close(fd);
RETVAL_STRING(opened_path, 0);
}
efree(p);
}
在[1]处tempnam()函数仅检查了open_basedir值。
<*参考
http://securityreason.com/securityalert/6601
http://secunia.com/advisories/37412/
*>
SEBUG安全建议:
厂商补丁:
PHP
---
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_2/ext/standard/file.c?view=log
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/ext/standard/file.c?view=log
铸铝件 磨煤喷粉机 风机叶轮 铸铜件
相关文档:
PHP 5.2 及以上版本提供了 json_encode 和 json_decode 函数,相当好用。
而之前的版本则需要下载网友们自行开发的库(有兴趣的可以看下 http://code.itlearner.com/php/JSON-class.html )
可以参考如下这个方法来在低版本上扩充这两个函数:
if (!function_exists('json_encode') && !function_exists('j ......
http://hi.baidu.com/honfei/blog/item/5e992bfb2704542b4f4aea1a.html
NuSoap介绍 (php调用webservice)
2009年07月04日 星期六 09:41
NuSOAP 是 PHP 环境下的 WEB 服务编程工具,用于创建或调用 WEB 服务。它是一个开源软件,当前版本是 0.7.2 ,支持 SOAP1.1 、 WSDL1.1 ,可以与其他支持 SOAP1.1 和 WSDL1.1 的 ......
java的写法
/**
*
* @param location
* @param nameList保存结果的!
*/
public void listDict(String location, List<String> nameList) {
File fileList = new File(location);
if (fileList.isDirectory()) {
File[] files = fileList.listFiles();
for (File f : files) {
i ......
OpenX adserver version 2.8.1 and lower is vulnerable to remote code
execution. To be exploited, this vulnerability requires banner / file
upload permissions, such as granted to the 'advertiser' and
'administrator' roles.
This vulnerability is caused by the (insecure) file upload mechanism of
af ......