balabalabala…..
if(!defined(‘IN_DISCUZ’)) {
@@ -89,7 +89,7 @@
}
}
if($searcharray && $replacearray) {
- $content = preg_replace(“/(.*?)|()|(\[attach\](\d+)\[\/attach\])/ies”, ‘helper_seo::base64_transform(“encode”, “”, “\\1\\2\\3″, “”)’, $content);
+ $content = preg_replace(“/(.*?)|()|(\[attach\](\d+)\[\/attach\])/ies”, “helper_seo::base64_transform(‘encode’, ”, ‘\\1\\2\\3′, ”)”, $content);
$content = preg_replace($searcharray, $replacearray, $content, 1);
$content = preg_replace(“/(.*?)/ies”, “helper_seo::base64_transform(‘decode’, ”, ‘\\1′, ”)”, $content);
}
@@ -100,7 +100,7 @@
public static function base64_transform($type, $prefix, $string, $suffix) {
if($type == ‘encode’) {
- return $prefix.base64_encode(str_replace(“\’”, “‘”, $string)).$suffix; // – -
+ return $prefix.base64_encode(str_replace(“\\\”", “\”", $string)).$suffix;
} elseif($type == ‘decode’) {
return $prefix.base64_decode($string).$suffix;
}
够清楚吧,问题在/source/class/helper/helper_seo.php 92行附近的:
$content = preg_replace(“/(.*?)|()|(\[attach\](\d+)\[\/attach\])/ies”, ‘helper_seo::base64_transform(“encode”, ““, “\\1\\2\\3″, ““)’, $content);
preg_replace 使用了e修正符,又是双引号,所以导致远程任意代码执行。
需要论坛支持个功能,啥功能看68行 $_G['cache']['relatedlink'],grep下relatedlink一路跟,具体代码先不贴,找到需要后台开个seo功能,在运营-关联链接 /admin.php?frames=yes&action=misc&operation=relatedlink,且至少需要设置一个链接,这功能不是所有管理员都开,但是我觉得大部分都会开,如果不开,它就只能是个后台拿shell的tips了。
function_core.php 1925
function parse_related_link($content, $extent) {
return helper_seo::parse_related_link($content, $extent);
}
看正则
“/(.*?)|()|(\[attach\](\d+)\[\/attach\])/ies”
来源:http://www.zhu.cm/discuz-x2-5-getwebshell-exp-xday.html
|