|
本帖最后由 Kovaao 于 2012-7-19 22:25 编辑
原文作者:北北原文链接:http://yaonie.org/archives/165
刚群里黑哥丢出个乌云的链接:http://www.wooyun.org/bugs/wooyun-2012-06420
问谁上,我说我上吧,职业病,看到discuz dede啥的漏洞一下就精神了,哈哈……过程简单说下,记的有点乱不贴太多代码了diff一下看
123456789101112131415161718192021222324252627
| @@ -4,7 +4,7 @@ * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms *- * $Id: helper_seo.php 28028 2012-02-21 04:41:41Z chenmengshu $+ * $Id: helper_seo.php 29370 2012-04-09 04:39:11Z chenmengshu $ */ 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行附近的:
1 | $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了。
1234 | function_core.php 1925function parse_related_link($content, $extent) {return helper_seo::parse_related_link($content, $extent);} |
看正则1 | "/(.*?)|()|(\[attach\](\d+)\[\/attach\])/ies" |
那么利用方式还用说么? 各种地方比如 source/include/space/space_blog.php,懂的都懂了
到处结束。。。 |
|