dedecms /member/mtypes.php SQL Injection Vul

來源:互聯網
上載者:User

標籤:

catalog

1. 漏洞描述2. 漏洞觸發條件3. 漏洞影響範圍4. 漏洞程式碼分析5. 防禦方法6. 攻防思考

 

1. 漏洞描述

Dedecms測試人員中樞注入漏洞

Relevant Link

http://www.yunsec.net/a/security/bugs/script/2012/1220/12127.html


2. 漏洞觸發條件

因為是update注入,並且用了>ExecuteNoneQuery所以不能採用benchmark延時注入,但是可以通過一個"返回狀態差異"判斷來進行忙注,如果條件成功那麼mtypename=‘$name‘就會被update了

1. 首先開啟: http://127.0.0.1/dedecms5.5/member/mtypes.php2. 添加一個分類,記住ID(1),和原來的分類名稱(fenlei)3. 然後開啟: http://127.0.0.1/dedecms5.5/member/mtypes.php?dopost=save&mtypename[1‘ or @`‘` AND 1%3D1 and (select ‘r‘)%3D‘r‘ and ‘1‘%3D‘1]=4//將其中的1改成你的分類ID4. 結束之後開啟之後返回: http://127.0.0.1/dedecms5.5/member/mtypes.php //如果(select ‘r‘)=‘r‘的話 那麼分類名稱就被改成了4! 這樣我們就能來判斷是否滿足條件了,二值判斷注入

Relevant Link

http://www.wooyun.org/bugs/wooyun-2010-048880http://www.0x50sec.org/0day-exp/2012/12/id/1482/comment-page-1/#comment-57057


3. 漏洞影響範圍
4. 漏洞程式碼分析

/member/mtypes.php

elseif ($dopost == ‘save‘){    if(isset($mtypeidarr) && is_array($mtypeidarr))    {        $delids = ‘0‘;        $mtypeidarr = array_filter($mtypeidarr, ‘is_numeric‘);        foreach($mtypeidarr as $delid)        {            $delids .= ‘,‘.$delid;            unset($mtypename[$delid]);        }        $query = "delete from `#@__mtypes` where mtypeid in ($delids) and mid=‘$cfg_ml->M_ID‘;";        $dsql->ExecNoneQuery($query);    }     //通過$mtypename進行key注入    foreach ($mtypename as $id => $name)    {        $name = HtmlReplace($name);        //未對索引值$id進行任何過濾就帶入查詢,導致注入        $query = "update `#@__mtypes` set mtypename=‘$name‘ where mtypeid=‘$id‘ and mid=‘$cfg_ml->M_ID‘";         $dsql->ExecuteNoneQuery($query);    }    ShowMsg(‘分類修改完成‘,‘mtypes.php‘);} 


5. 防禦方法

/member/mtypes.php

elseif ($dopost == ‘save‘){    if(isset($mtypeidarr) && is_array($mtypeidarr))    {        $delids = ‘0‘;        $mtypeidarr = array_filter($mtypeidarr, ‘is_numeric‘);        foreach($mtypeidarr as $delid)        {            $delids .= ‘,‘.$delid;            unset($mtypename[$delid]);        }        $query = "delete from `#@__mtypes` where mtypeid in ($delids) and mid=‘$cfg_ml->M_ID‘;";        $dsql->ExecNoneQuery($query);    }     //通過$mtypename進行key注入    foreach ($mtypename as $id => $name)    {        $name = HtmlReplace($name);        /* 對$id進行正常化處理 */        $id = intval($id);        /* */        $query = "update `#@__mtypes` set mtypename=‘$name‘ where mtypeid=‘$id‘ and mid=‘$cfg_ml->M_ID‘";         die(var_dump($query));        $dsql->ExecuteNoneQuery($query);    }    ShowMsg(‘分類修改完成‘,‘mtypes.php‘);} 

通過intval規範互處理,使得駭客注入的盲注語句失效,即不管任何時候,返回結果都是能成功修改為4,即盲注的二值條件不存在了


6. 攻防思考

Copyright (c) 2015 LittleHann All rights reserved

 

dedecms /member/mtypes.php SQL Injection Vul

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.