Oracle – Grant create any trigger vs grant create trigger

grantoracleoracle12c

In Oracle you can grant system privileges like

GRANT CREATE TRIGGER TO MY_USER;

But you can as well grant privileges this way

GRANT CREATE ANY TRIGGER TO MY_USER;

As system privileges are system-wide, where is the difference between the 2 statements above. Does the additional ANY-keyword grant anything else more than system? If I add a Grant ... ON SCHEMA ... it's no system privilege anymore, is it?

Assumption is that there are multiple schemas/objects in the database from different users one cannot access without these privileges.

EDIT:

SELECT *
FROM DBA_SYS_PRIVS
WHERE grantee = 'MY_USER';

returns

GRANTEE      PRIVILEGE                              
------------ -------------
MY_USER      CREATE ANY TRIGGER
MY_USER      CREATE TRIGGER

(I omitted the columns ADMIN_OPTION and COMMON)

And the result is the same when querying this with MY_USER, MY_USER2 or any other user. I see no connection to a schema here. And it is also possible to only have the CREATE ANY TRIGGER-privilege.

Best Answer

In most cases, the trigger owner is also the owner of the table (or view) on which the trigger is based. In those cases, the table owner, with CREATE TRIGGER can create create triggers on their own table.

CREATE ANY TRIGGER allows the user to create a trigger owned by any user on any table. It is a big security hole because they can create a trigger owned by a privileged user on a table that they own or can insert into. Because they can insert into that table, they can force the trigger to execute and the trigger executes with the privileges of the trigger owner. The effect is that a user with CREATE ANY TRIGGER privilege can create and execute code as a privileged user (similar to having CREATE ANY PROCEDURE plus EXECUTE ANY PROCEDURE).

Limit to as few as people as possible and audit appropriately.