CVE ID: CVE-2010-2100 PHP是广泛使用的通用目的脚本语言,特别适合于Web开发,可嵌入到HTML中。 PHP的htmlentities()及htmlspecialchars()函数中存在信息泄露漏洞: static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) { char *str, *hint_charset = NULL; int str_len, hint_charset_len = 0; int len; long quote_style = ENT_COMPAT; char *replaced; zend_bool double_encode = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!b", &str, &str_len, &quote_style, &hint_charset, &hint_charset_len, &double_encode) == FAILURE) { return; } replaced = php_escape_html_entities_ex(str, str_len, &len, all, quote_style, hint_charset, double_encode TSRMLS_CC); RETVAL_STRINGL(replaced, len, 0); } zend_parse_parameters()函数将4个参数拷贝到了本地变量,破坏了这些变量与原始ZVAL之间的联系。问题是任何对ZVAL的修改都不会反映在本地变量上,因此任何中断都可能修改ZVAL,导致本地变量指向已释放和重新使用的内存。此外由于 zend_parse_parameters()支持对象的__toString()方式,只要以 htmlentities()/htmlspecialchars()第三个参数的形式传送对象就可以中断参数解析。由于PHP的call time pass by...
CVE ID: CVE-2010-2100 PHP是广泛使用的通用目的脚本语言,特别适合于Web开发,可嵌入到HTML中。 PHP的htmlentities()及htmlspecialchars()函数中存在信息泄露漏洞: static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) { char *str, *hint_charset = NULL; int str_len, hint_charset_len = 0; int len; long quote_style = ENT_COMPAT; char *replaced; zend_bool double_encode = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!b", &str, &str_len, &quote_style, &hint_charset, &hint_charset_len, &double_encode) == FAILURE) { return; } replaced = php_escape_html_entities_ex(str, str_len, &len, all, quote_style, hint_charset, double_encode TSRMLS_CC); RETVAL_STRINGL(replaced, len, 0); } zend_parse_parameters()函数将4个参数拷贝到了本地变量,破坏了这些变量与原始ZVAL之间的联系。问题是任何对ZVAL的修改都不会反映在本地变量上,因此任何中断都可能修改ZVAL,导致本地变量指向已释放和重新使用的内存。此外由于 zend_parse_parameters()支持对象的__toString()方式,只要以 htmlentities()/htmlspecialchars()第三个参数的形式传送对象就可以中断参数解析。由于PHP的call time pass by reference功能,之后攻击者可以从__toString()方式杀死第一个参数并重新用于哈希表。这导致 php_escape_html_entities_ex()作用于哈希表的内存而不是字符串的内存,攻击者可以泄露重要的内部内存偏移。 PHP PHP <= 5.3.2 PHP PHP <= 5.2.13 临时解决方法: * 禁用call time pass by reference功能。 厂商补丁: PHP --- 目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本: http://www.php.net