乌云(WooYun.org)历史漏洞查询---http://wy.zone.ci/
乌云 Drops 文章在线浏览--------http://drop.zone.ci/
2013-12-19: 细节已通知厂商并且等待厂商处理中 2013-12-20: 厂商已经确认,细节仅向厂商公开 2013-12-23: 细节向第三方安全合作伙伴开放 2014-02-13: 细节向核心白帽子及相关领域专家公开 2014-02-23: 细节向普通白帽子公开 2014-03-05: 细节向实习白帽子公开 2014-03-19: 细节向公众公开
Thinksaas SQL注入#1
/app/article/action/edit.php
case "do" : $articleid = intval ( $_POST ['articleid'] ); $cateid = intval ( $_POST ['cateid'] ); $title = tsClean ( $_POST ['title'] );//过滤 $content = tsClean ( $_POST ['content'] );//过滤 if ($TS_USER ['user'] ['isadmin'] == 0) { // 过滤内容开始 aac ( 'system' )->antiWord ( $title );//过滤垃圾词 aac ( 'system' )->antiWord ( $content );//过滤过滤垃圾词 // 过滤内容结束 } if ($title == '' || $content == '') qiMsg ( "标题和内容都不能为空!" ); $new ['article']->update ( 'article', array ( 'articleid' => $articleid ) , array ( 'cateid' => $cateid, 'title' => $title, 'content' => $content ) );
跟进tsClean,/thinksaas/tsFunction.php:
function tsClean($text) { $text = cleanJs ( $text ); return $text;}function cleanJs($text) { $text = trim ( $text ); $text = stripslashes ( $text ); // 完全过滤注释 $text = preg_replace ( '/<!--?.*-->/', '', $text ); // 完全过滤动态代码 $text = preg_replace ( '/<\?|\?>/', '', $text ); // 完全过滤js $text = preg_replace ( '/<script?.*\/script>/', '', $text ); // 过滤多余html $text = preg_replace ( '/<\/?(html|head|meta|link|base|body|title|style|script|form|iframe|frame|frameset)[^><]*>/i', '', $text ); // 过滤on事件lang js while ( preg_match ( '/(<[^><]+)(lang|onfinish|onmouse|onexit|onerror|onclick|onkey|onload|onchange|onfocus|onblur)[^><]+/i', $text, $mat ) ) { $text = str_replace ( $mat [0], $mat [1], $text ); } while ( preg_match ( '/(<[^><]+)(window\.|javascript:|js:|about:|file:|document\.|vbs:|cookie)([^><]*)/i', $text, $mat ) ) { $text = str_replace ( $mat [0], $mat [1] . $mat [3], $text ); } return $text;}
最后是cleanjs函数进行过滤。最后进入update函数:
public function update($table, $conditions, $row) { $where = ""; if (empty ( $row )) return FALSE; if (is_array ( $conditions )) { $join = array (); foreach ( $conditions as $key => $condition ) { $condition = $this->escape ( $condition );//转义 $join [] = "{$key} = {$condition}"; } $where = "WHERE " . join ( " AND ", $join ); } else { if (null != $conditions) $where = "WHERE " . $conditions; } foreach ( $row as $key => $value ) { $vals [] = "`$key` = '$value'";//未转义,直接带入,注入 } $values = join ( ", ", $vals ); $sql = "UPDATE " . dbprefix . "{$table} SET {$values} {$where}"; return $this->db->query ( $sql ); }
而且从这里看出,在修改文章时,没有判断文章的用户属性,即此文章是谁发表的。导致任意用户文章修改。
我们注册一个用户222222.修改用户111111发表的文章。
查看结果
111111发表的文章被我们修改了,且成功注入。
加强过滤。
危害等级:高
漏洞Rank:20
确认时间:2013-12-20 22:07
非常感谢反馈。已经再积极处理中。
暂无