yuange http://hi.baidu.com/yuange1975 影响版本: php5.2.3不影响版本: 其它版本 php5.2.3在处理CGI的时候,由于一编程错误(缺少括号),错误计算一字符串长度,导致堆缓冲溢出,可能远程执行任意代码。触发方式:配置.php到php.exe的CGI映射,请求GET /test.php/aa HTTP/1.1 错误发生在php-5.2.3\sapi\cgi\cgi-man.c line 886: int path_translated_len = ptlen + env_path_info ? strlen(env_path_info) : 0; 程序应该是 int path_translated_len = ptlen + (env_path_info ? strlen(env_path_info) : 0); 程序处理流程: main(){......init_request_info(TSRMLS_C);...... } static void init_request_info(TSRMLS_D){......int path_translated_len = ptlen + env_path_info ? strlen(env_path_info) : 0;......path_translated = (char *) emalloc(path_translated_len + 1);......if (env_path_info) {memcpy(path_translated + ptlen, env_path_info, path_translated_len - ptlen);} }