中危 PHP 5.3.5 grapheme_extract size null 指针取消引用漏洞
CVE编号
CVE-2011-0420利用情况
POC 已公开补丁情况
官方补丁披露时间
2011-02-19漏洞描述
PHP是一款流行的编程语言。grapheme_extract()存在空指针应用错误,代码如下:- -grapheme_extract()--...if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|llz", (char**)&str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) { <=== str='a' and size='-1'.../* if the string is all ASCII up to size+1 - or str_len whichever is first- then we are done.(size + 1 because the size-th character might be the beginning of agrapheme cluster)*/if ( -1 != grapheme_ascii_check(pstr, size + 1 < str_len ? size + 1 :str_len ) ) { <=== ( size=-1+1=0 ) ===long nsize = ( size < str_len ? size : str_len ); <=== nsize = -1if ( NULL != next ) {ZVAL_LONG(next, start+nsize);}RETURN_STRINGL(((char *)pstr), nsize, 1); <=== CRASH POINT}...- -grapheme_extract()--如果可以调用grapheme_ascii_check(pstr,0):- -grapheme_ascii_check()--/* {{{ grapheme_ascii_check: ASCII check */int grapheme_ascii_check(const unsigned char *day, int32_t len) <====len=0{int ret_len = len;while ( len-- ) {if ( *day++ > 0x7f )return -1;}return ret_len; <=== return 0}- -grapheme_ascii_check()--就会导致get (int)0并且long nsize = ( size < str_len ? size : str_len );为-1,因此:RETURN_STRINGL(((char *)pstr), nsize, 1);会触发空指针引用。解决建议
用户可参考如下供应商提供的安全公告获得补丁信息:http://svn.php.net/viewvc?view=revision&revision=306449受影响软件情况
# | 类型 | 厂商 | 产品 | 版本 | 影响面 | ||||
1 | |||||||||
---|---|---|---|---|---|---|---|---|---|
运行在以下环境 | |||||||||
应用 | php | php | 5.3.5 | - | |||||
运行在以下环境 | |||||||||
系统 | suse_12 | apache2-mod_php5 | * | Up to (excluding) 5.5.14-4 |
- 攻击路径 本地
- 攻击复杂度 困难
- 权限要求 普通权限
- 影响范围 有限影响
- EXP成熟度 POC 已公开
- 补丁情况 官方补丁
- 数据保密性 无影响
- 数据完整性 N/A
- 服务器危害 无影响
- 全网数量 N/A
CWE-ID | 漏洞类型 |
NVD-CWE-Other |
Exp相关链接
- avd.aliyun.com
版权声明
本站原创文章转载请注明文章出处及链接,谢谢合作!
评论