沈阳网站制作公司思路,wordpress图文并排,无代码系统搭建平台,可信网站验证CVE-2012-2311
这个漏洞被爆出来以后#xff0c;PHP官方对其进行了修补#xff0c;发布了新版本5.4.2及5.3.12#xff0c;但这个修复是不完全的#xff0c;可以被绕过#xff0c;进而衍生出CVE-2012-2311漏洞。
PHP的修复方法是对-进行了检查#xff1a;
if(query_str…CVE-2012-2311
这个漏洞被爆出来以后PHP官方对其进行了修补发布了新版本5.4.2及5.3.12但这个修复是不完全的可以被绕过进而衍生出CVE-2012-2311漏洞。
PHP的修复方法是对-进行了检查
if(query_string getenv(QUERY_STRING)) {decoded_query_string strdup(query_string);php_url_decode(decoded_query_string, strlen(decoded_query_string));if(*decoded_query_string - strchr(decoded_query_string, ) NULL) {skip_getopt 1;}free(decoded_query_string);
}可见获取querystring后进行解码如果第一个字符是-则设置skip_getopt也就是不要获取命令行参数。
这个修复方法不安全的地方在于如果运维对php-cgi进行了一层封装的情况下
#!/bin/shexec /usr/local/bin/php-cgi $*通过使用空白符加-的方式也能传入参数。这时候querystring的第一个字符就是空白符而不是-了绕过了上述检查。
于是php5.4.3和php5.3.13中继续进行修改:
if((query_string getenv(QUERY_STRING)) ! NULL strchr(query_string, ) NULL) {/* weve got query string that has no - apache CGI will pass it to command line */unsigned char *p;decoded_query_string strdup(query_string);php_url_decode(decoded_query_string, strlen(decoded_query_string));for (p decoded_query_string; *p *p ; p) {/* skip all leading spaces */}if(*p -) {skip_getopt 1;}free(decoded_query_string);
}先跳过所有空白符小于等于空格的所有字符再判断第一个字符是否是-。