audit.sql
-- -- audit.sql -- Pete Finnigan -- 15-Apr-2003 -- -- example code for the SQL injection article for www.securityfocus.com -- set serveroutput on size 1000000 spool audit.lis -- -- SQL to check if the audit has been enabled in the database and where the output will be -- written to. -- select name,value from v$parameter where name like 'audit%' / -- -- Test to see what audit actions are defined. Note:- doesn't include object audit actions. -- select * from dba_stmt_audit_opts union select * from dba_priv_audit_opts / -- -- Turn on audit for capturing logon and logoff attemempts for all users except -- privileged attempts. -- audit create session / -- -- check what audit privileges have been granted and to what users and roles. -- select * from dba_sys_privs where privilege like '%AUDIT%' -- -- SQL to generate audit actions to be enabled for changes to objects in the -- database schema. NOTE:- This is a sample set of commands and not all -- possible ones. Also the spool lines will stop the spool command at the start -- of this file. Cut and paste this section into another file to run it. -- set head off set feed off set pages 0 spool aud.lis select 'audit '||name||';' from system_privilege_map where (name like 'CREATE%TABLE%' or name like 'CREATE%INDEX%' or name like 'CREATE%CLUSTER%' or name like 'CREATE%SEQUENCE%' or name like 'CREATE%PROCEDURE%' or name like 'CREATE%TRIGGER%' or name like 'CREATE%LIBRARY%') union select 'audit '||name||';' from system_privilege_map where (name like 'ALTER%TABLE%' or name like 'ALTER%INDEX%' or name like 'ALTER%CLUSTER%' or name like 'ALTER%SEQUENCE%' or name like 'ALTER%PROCEDURE%' or name like 'ALTER%TRIGGER%' or name like 'ALTER%LIBRARY%') union select 'audit '||name||';' from system_privilege_map where (name like 'DROP%TABLE%' or name like 'DROP%INDEX%' or name like 'DROP%CLUSTER%' or name like 'DROP%SEQUENCE%' or name like 'DROP%PROCEDURE%' or name like 'DROP%TRIGGER%' or name like 'DROP%LIBRARY%') union select 'audit '||name||';' from system_privilege_map where (name like 'EXECUTE%INDEX%' or name like 'EXECUTE%PROCEDURE%' or name like 'EXECUTE%LIBRARY%') / spool off @@aud.lis -- -- check what audit actions the above SQL has enabled. -- select audit_option,success,failure from dba_stmt_audit_opts union select privilege,success,failure from dba_priv_audit_opts / -- -- SQL to print out details of all logon and logoff attempts in the audit trail. -- col username for a15 col terminal for a6 col timestamp for a15 col logoff_time for a15 col action_name for a8 col returncode for 9999 select username, terminal, action_name, to_char(timestamp,'DDMMYYYY:HHMISS') timestamp, to_char(logoff_time,'DDMMYYYY:HHMISS') logoff_time, returncode from dba_audit_session / -- -- SQL to test for failed logon attempts, grouped per day. -- select count(*),username,terminal,to_char(timestamp,'DD-MON-YYYY') from dba_audit_session where returncode<>0 group by username,terminal,to_char(timestamp,'DD-MON-YYYY') / -- -- Change to above SQL to show a little more details. -- select count(*),username,terminal,to_char(timestamp,'DD-MON-YYYY'),returncode from dba_audit_session group by username,terminal,to_char(timestamp,'DD-MON-YYYY'),returncode / -- -- SQL to check for attempts to access the database with non existant users. This could -- indicate someone trying to guess user names and passwords. -- select username,terminal,to_char(timestamp,'DD-MON-YYYY HH24:MI:SS') from dba_audit_session where returncode<>0 and not exists (select 'x' from dba_users where dba_users.username=dba_audit_session.username) / -- -- Check for access attempts to the database at unusual hours. The two times should -- be altered or passed in and if detail is needed for multiple days then group by -- the date as well. -- select username, terminal, action_name, returncode, to_char(timestamp,'DD-MON-YYYY HH24:MI:SS'), to_char(logoff_time,'DD-MON-YYYY HH24:MI:SS') from dba_audit_session where to_date(to_char(timestamp,'HH24:MI:SS'),'HH24:MI:SS') < to_date('08:00:00','HH24:MI:SS') or to_date(to_char(timestamp,'HH24:MI:SS'),'HH24:MI:SS') > to_date('19:30:00','HH24:MI:SS') / -- -- Check for users sharing database logons. -- select count(distinct(terminal)),username from dba_audit_session having count(distinct(terminal))>1 group by username / -- -- Check for multiple database accounts being used from one terminal. This could indicate -- wrong doing as each terminal should in theory be used by one person and one account? -- select count(distinct(username)),terminal from dba_audit_session having count(distinct(username))>1 group by terminal / -- -- Check the audit trail for any changes being made to the structure of the database schema. -- col username for a8 col priv_used for a16 col obj_name for a22 col timestamp for a17 col returncode for 9999 select username, priv_used, obj_name, to_char(timestamp,'DD-MON-YYYY HH24:MI') timestamp, returncode from dba_audit_trail where priv_used is not null and priv_used<>'CREATE SESSION' / spool off
-
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.
-
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 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 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.
-
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 is a useful tool to use to audit your websites for tracking cookies. Scan websites in a natural way using powerful browser driven scanner
-
PFCLSEO
We offer a number of web based services such as cookie audits, improving website ranking in search engines, locating broken links and hosting email and websites
-
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.
-
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
Choose PFCLConsulting to ask PeteFinnigan.com Limited to set up and use our products on your behalf
-
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
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 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 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 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.
-
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