Call: +44 (0)7759 277220 Call
Forum

Welcome, Guest. Please Login.
Nov 21st, 2024, 6:39pm
News: If you would like to register contact the forum admin
Home | Help | Search | Members | Login
   Pete Finnigan's Oracle Security Forum
   Oracle Security
   Oracle Security
(Moderator: Pete Finnigan)
   Invoker & Definer used together, very confusin
« Previous topic | Next topic »
Pages: 1  Reply | Notify of replies | Send Topic | Print
   Author  Topic: Invoker & Definer used together, very confusin  (Read 3036 times)
Pete Finnigan
PeteFinnigan.com Administrator
*****




Oracle Security is easier if you design for it

   
View Profile | WWW | Email

Gender: male
Posts: 309
Invoker & Definer used together, very confusin
« on: Sep 5th, 2006, 9:18am »
Quote | Modify

Hello DBAs,
 
I am confusing with Invoker and Definer procedures used together: user U4 does not need the EXECUTE privilege on U2.def procs Huh  
 
Below is the code:
 
CREATE USER:
Quote:

drop user u1 cascade;
drop user u2 cascade;
drop user u3 cascade;
drop user u4 cascade;
create user u1 identified by u1;
create user u2 identified by u2;
create user u3 identified by u3;
create user u4 identified by u4;

 
 
GRANT permissions:
Quote:

grant create procedure to u1;
grant create procedure to u2;
grant unlimited tablespace to u3;
grant create table to u3;
grant create session to U1,U2,U3,U4;
 

 
 
CREATE TABLE:
Quote:

connect U3/U3
CREATE TABLE t1 (x number);
GRANT INSERT ON U3.t1 TO U2;

 
 
CREATE DEFINER procs in user U2:
Quote:

connect U2/U2
Create or replace procedure U2.def AS
Begin
 
INSERT INTO U3.t1 VALUES(1);
 
commit;
End;
/
show errors
grant EXECUTE on U2.def to U1;

 
 
CREATE INVOKER procs in user U1:
Quote:

connect U1/U1
Create procedure U1.inv_def  
 
AUTHID CURRENT_USER As

Begin
 
U2.def(); -- insert into U3.t1
End;
/
show errors
 
grant EXECUTE on U1.inv_def to U4;
 

 
 
Quote:

connect U4/U4
execute U1.inv_def;
show errors
 
connect U3/U3
select * from t1;

 
 
 
 
Executed Codes
Quote:

SQL> drop user u1 cascade;
 
User dropped.
 
SQL> drop user u2 cascade;
 
User dropped.
 
SQL> drop user u3 cascade;
 
User dropped.
 
SQL> drop user u4 cascade;
 
User dropped.
 
SQL> create user u1 identified by u1;
 
User created.
 
SQL> create user u2 identified by u2;
 
User created.
 
SQL> create user u3 identified by u3;
 
User created.
 
SQL> create user u4 identified by u4;
 
User created.
 
SQL> grant create procedure to u1;
 
Grant succeeded.
 
SQL> grant create procedure to u2;
 
Grant succeeded.
 
SQL> grant unlimited tablespace to u3;
 
Grant succeeded.
 
SQL> grant create table to u3;
 
Grant succeeded.
 
SQL> grant create session to U1,U2,U3,U4;
 
Grant succeeded.
 
SQL>  
SQL> connect U3/U3
Connected.
SQL> CREATE TABLE t1 (x number);
 
Table created.
 
SQL> GRANT INSERT ON U3.t1 TO U2;
 
Grant succeeded.
 
SQL>  
SQL> connect U2/U2
Connected.
SQL> Create or replace procedure U2.def AS
  2  Begin
  3  
INSERT INTO U3.t1 VALUES(1);
  4  
commit;
  5  End;
  6  /
 
Procedure created.
 
SQL> show errors
No errors.
SQL> grant EXECUTE on U2.def to U1;
 
Grant succeeded.
 
SQL>  
SQL> connect U1/U1
Connected.
SQL> Create procedure U1.inv_def
  2  
AUTHID CURRENT_USER As
  3  Begin
  4  
U2.def(); -- insert into U3.t1
  5  End;
  6  /
 
Procedure created.
 
SQL> show errors
No errors.
SQL>  
SQL>  
SQL> grant EXECUTE on U1.inv_def to U4;
 
Grant succeeded.
 
SQL> connect U4/U4
Connected.
SQL> execute U1.inv_def;
 
PL/SQL procedure successfully completed.
 
SQL> show errors
No errors.
SQL>  
SQL> connect U3/U3
Connected.
SQL> select * from t1
  2  /
 
    X                
----------                
    1                
 
SQL>  
SQL> spool off
 

 
 
IP Logged

Pete Finnigan (email:pete@petefinnigan.com)
Oracle Security Web site: http://www.petefinnigan.com
Forum: http://www.petefinnigan.com/forum/yabb/YaBB.cgi
Oracle security blog: http://www.petefinnigan.com/weblog/entries/index.html
Pete Finnigan
PeteFinnigan.com Administrator
*****




Oracle Security is easier if you design for it

   
View Profile | WWW | Email

Gender: male
Posts: 309
Re: Invoker & Definer used together, very conf
« Reply #1 on: Sep 6th, 2006, 12:30am »
Quote | Modify

download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14261/subprograms .htm#sthref1778  
 
Basically AUTHID CURRENT_USER covers objects referenced by SQL not other PL/SQL objects. (The documentation doesn't mention MERGE as one of the SQL statements, but I'd assume that's a documentation bug).
IP Logged

Pete Finnigan (email:pete@petefinnigan.com)
Oracle Security Web site: http://www.petefinnigan.com
Forum: http://www.petefinnigan.com/forum/yabb/YaBB.cgi
Oracle security blog: http://www.petefinnigan.com/weblog/entries/index.html
Pages: 1  Reply | Notify of replies | Send Topic | Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board
  • PFCLScan PFCLScan

    Simply connect PFCLScan to your Oracle database and it will automatically discover the security issues that could make your Oracle database vulnerable to attack and to the potential loss of your data.

  • PFCL Obfuscate PFCLObfuscate

    PFCLObfuscate is the only tool available that can automatically add license controls to your PL/SQL code. PFCLObfuscate protects your Intellectual Property invested in your PL/SQL database code.

  • PFCLCode PFCLCode

    PFCLCode is a tool to allow you to analyse your PL/SQL code for many different types of security issues. PFCLCode gives you a detailed review and reports and includes a powerful colour syntax highlighting code editor

  • PFCLForensics PFCLForensics

    PFCLForensics is the only tool available to allow you to do a detailed live response of a breached Oracle database and to then go on and do a detailed forensic analysis of the data gathered.

  • Products We resell PFCLReselling

    PeteFinnigan.com Limited has partnered with a small number of relevant companies to resell their products where they enhance or compliment what we do

  • PFCLATK PFCLATK

    PFCLATK is a toolkit that allows detailed pre-defined policy driven audit trails for your Oracle database. The toolkit also provides for a centralised audit trail and centralised activity reporting

  • PFCLCookie PFCLCookie

    PFCLCookie is a useful tool to use to audit your websites for tracking cookies. Scan websites in a natural way using powerful browser driven scanner

  • PFCL Training PFCLTraining

    PFCLTraining is a set of expert training classes for you, aimed at teaching how to audit your own Oracle database, design audit trails, secure code in PL/SQL and secure and lock down your Oracle database.

  • PFCL Services PFCLServices

    Choose PFCLServices to add PeteFinnigan.com Ltd to your team for your Oracle Security needs. We are experts in performing detailed security audits, data security design work and policy creation

  • PFCLConsulting PFCLConsulting

    Choose PFCLConsulting to ask PeteFinnigan.com Limited to set up and use our products on your behalf

  • PFCLCustom PFCLCustom

    All of our software products can be customised at a number of levels. Choose this to see how our products can be part of your products and services

  • PFCLCloud PFCLCloud

    Private cloud, public cloud, hybrid cloud or no cloud. Learn how all of our services, trainings and products will work in the cloud

  • PFCLUserRights PFCLUserRights

    PFCLUserRights allows you to create a very detailed view of database users rights. The focus of the reports is to allow you to decide what privileges and accounts to keep and which to remove.

  • PFCLSTK PFCLSTK

    PFCLSTK is a toolkit application that allows you to provide database security easily to an existing database. PFCLSTK is a policy driven toolkit of PL/SQL that creates your security

  • PFCLSFTK PFCLSFTK

    PFCLSFTK is a toolkit that solves the problem of securing third party applications written in PL/SQL. It does this by creating a thin layer between the application and database and this traps SQL Injection attempts. This is a static firewall.

  • PFCLSEO PFCLSEO

    PFCLSEO is a web scanner based on the PFCLScan technology so that a user can easily scan a website for technical SEO issues