之前也有人爆wps的sql注入,其实wps用的是这个系统
详细说明:在control/question.php 的onajaxsearch函数中
function onajaxsearch() {
$title = urldecode($this-> get[2]);
$questionlist = $_ENV[ 'question']->search_title($title, 2, 1, 0, 5);
include template('ajaxsearch' );
}
由get[2]传入的参数经过了urldecode再进入到question模块中的search_title函数里。
//根据标题搜索问题
function search_title ($title, $status='1,2,6' , $addbestanswer=0, $start=0, $limit=20) {
$questionlist = array();
$search_words = $this->get_words($title);
$sql = $search_words ? "SELECT * FROM " . DB_TABLEPRE . "question WHERE MATCH(search_words) AGAINST(' $search_words') AND status IN($status)" : "SELECT * FROM " . DB_TABLEPRE . "question WHERE STATUS IN ($status) AND title LIKE '%$title %' ";
$sql .= " LIMIT $start, $limit";
$query = $this-> db->query($sql);
file_put_contents( "sql.txt", $sql);
while ($question = $this->db->fetch_array($query) ) {
$question[ 'category_name'] = $this->base->category [$question['cid']]['name'];
$question[ 'format_time'] = tdate($question['time' ]);
$question[ 'url'] = url('question/view/' . $question['id'], $question['url']);
$addbestanswer && $question[ 'bestanswer'] = $this->db->result_first("SELECT content FROM `" . DB_TABLEPRE . "answer` WHERE qid=" . $question['id'] . " AND adopttime>0 ");
// $question['description'] = highlight(strip_tags($question['description']), $search_words);
// $question['title'] = highlight($question['title'], $search_words);
$question[ 'description'] = strip_tags($question['description' ]);
$questionlist[] = $question;
}
return $questionlist;
} www.2cto.com
最终没有过滤进入sql查询。
官方演示站ooxx成功
修复方案:
过滤吧。。好多地方都没有过滤