thinkphp3有漏洞嗎?
thinkphp3是有漏洞的,但是在北京時(shí)間 2018年8月23號11:25分 星期四,tp團(tuán)隊(duì)對于已經(jīng)停止更新的thinkphp 3系列進(jìn)行了一處安全更新,經(jīng)過分析,此次更新修正了由于select(),find(),delete()方法可能會(huì)傳入數(shù)組類型數(shù)據(jù)產(chǎn)生的多個(gè)sql注入隱患。
0x01 漏洞復(fù)現(xiàn)
下載源碼: git clone https://github.com/top-think/thinkphp.git
使用git checkout 命令將版本回退到上一次commit:git checkout 109bf30254a38651c21837633d9293a4065c300b
使用phpstudy等集成工具搭建thinkphp,修改apache的配置文件httpd-conf
DocumentRoot "" 為thinkphp所在的目錄。
重啟phpstudy,訪問127.0.0.1,輸出thinkphp的歡迎信息,表示thinkphp已正常運(yùn)行。
搭建數(shù)據(jù)庫,數(shù)據(jù)庫為tptest,表為user,表里面有三個(gè)字段id,username,pass
修改ApplicationCommonConfconfig.php配置文件,添加數(shù)據(jù)庫配置信息。
之后在ApplicationHomeControllerIndexController.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()方法 ,有很多地方可注,這里主要列舉三個(gè)table,alias,where,