Oracle DBA – A lifelong learning experience

Posts Tagged ‘security’

What does the SQL92_SECURITY parameter actually do?

Posted by John Hallas on November 23, 2009

Whilst looking at our Grid Control I noticed that we had a few policy violations in the security configuration stating that SQL92_SECURITY=FALSE. These were against some of our older databases as we set it to true on all new builds. I thought I knew what this parameter did but had a look around and determined the following :-

It stops anyone being able to update or delete rows from a table owned by another user if you were using a where clause and did not have select on that table. Fair enough I thought, it sounds like it is some form of ANSI 92 standard and it is all a bit meaningless. I could not see what the issue was but I was intrigued as to why it was an Oracle security recommendation.

I set up the following test case on both a 10G and 11G database where SQL92_SECURITY was set to TRUE. Very simple but I had no failures other than the select statement which had insufficient privileges.

create user usera identified by usera;
create user userb identified by userb;

grant create session,create table to usera;
grant create session to userb;
alter user usera quota unlimited on users;
alter user userb quota unlimited on users;
show parameter sql92_security
connect usera/usera
create table tab1 as select * from all_objects where rownum <101;
select count(*) from tab1;
grant update,delete on tab1 to userb;

connect userb/userb
update usera.tab1 set object_type = 'WAS PACK' where object_type='PACKAGE';
commit;
select distinct status from usera.tab1;
prompt fails as no select privilege on usera.tab1
prompt SQL92 set to true and yet update is allowed ??
prompt now let's try a delete
delete from usera.tab1 where rownum <21;

prompt delete with a where clause works as well

select count(*) from
prompt end of case study

So what is all that about, where was I going wrong and why were my updates and deletes allowed when they shouldn’t have been.

This parameter is meant to prevent you from deleting a table when you specify a condition based on table’s columns. Conditions that are not checking the values stored in the table are allowed(rownum < X, etc.)

In my testcase I deleted the table rows without a condition which read one of the the tables columns. If instead of executing delete from usera.tab1 where rownum =21 I had executed delete from usera.tab1 where object_name = ‘TEST’; I would get an error.

The purpose of this parameter is to allow a user one to delete table data without giving them the possibility of guessing what values are stored in that table. Imagine that there is a table with contacts and I only have delete rights on that table. If I am able to delete the table with a condition based on table columns I can find out via multiple attempts the contents of the table. I can for example find out whether ‘John Smith’ is a contact or not :

SQL> delete from contacts where contact_first_name='John' and contact_family_name='Smith'; 

1 row deleted
SQL> rollback;
Rollback complete.

Since the row was deleted I know now that John Smith is a contact. Then I do a rollback of the transaction and the table is as it was before the delete. If the parameter is set to TRUE I cannot make use of this trick and I can only delete the rows blindly. I will be able to delete without knowing what I am going to delete.

Once I understood what could be done I understood the reason for the init.ora parameter to be enabled. However there is very little information out on the web which explains the reasons and that is why I think the parameter can be misunderstood.

Prior to enabling it on a database that is in use I would check that nobody had update or delete privileges ona table that they did not own where they did not have select privilege.

select *
from dba_tab_privs a
where privilege in ('UPDATE','DELETE')
and not exists (select null 
                from   dba_tab_privs b
                where  privilege = 'SELECT'
                and    a.grantor = b.grantor
                and    a.grantee = b.grantee
                and    a.table_name = b.table_name);

Posted in Oracle, security | Tagged: , | 4 Comments »

First trip to UKOUG

Posted by John Hallas on December 2, 2008

I have never made it to UKOUG as I have been to mean to take time out from contracting. This year was different. I have been booked in for the first 3 days and this is my half-time report.

It is big, very, very big with, I think, 6 parallel streams ongoing at the same time.

The age range is pretty wide with many of the visitors aged 40 or over. (that suits me fine, being in that category myself).

The breadth of talks is tremendous, with everyone giving their best and obviously having spent much time on their presentations.

I am not sure how much business the exhibitors gain though. Perhaps it is just a good means of getting their names known.

The presentations. The one that I did not like was spoilt for me by the constant reference to  his peers ( ‘I was talking to Jonathan’, ‘Connor is here’, ‘Tom said to me’). No names no pack drill

Carl Dudley spoke very well on Flashback features, although it was a bit confusing as to which was available in each release. He was very well prepared and had some very good examples.

Tom Kite was another who obviously has much experience and had prepared some good examples. I heard his talks on encryption and ‘the best way’ and enjoyed them both very much. Jonathan Lewis was very professional as well.

The Tuesday morning keynote speech was about Exadata and that does seem a major leap forward in technology (for Oracle at least). Bad news if you work for Terradata.

I attended a talk by Slavic Markovich about protecting the database from sql injection attacks. Quite interesting but it lost me a little towards the end. I was interested about the concepts and will be viewing his site (Sentrigo) to check out some of his downloadable (is that a genuine word?) scripts.

Patrick Hurley talked about Data Pump and whilst I don’t think there was anything new to me it did remind me to write a wiki page at work containing sample parameter files for various types of expdp/impdp jobs. He started off a bit nervously but got into his stride well and I am sure could have talked for much longer. A very good session.

The best talk I have seen so far was from Pete Finnegan on security basics. I have done some work recently on setting up procedures for the production databases (which I may post soon) but he reminded how much there was still to do. My first job when I get back is to ensure that the *.ora files do not have world read on them.

Off to a talk on clusterware from Alex Gorbachev now.  More to follow tomorrow

Posted in Oracle | Tagged: , , | 3 Comments »

Hacking into an Oracle database

Posted by John Hallas on September 23, 2008

At a site I was working at they employed a security company to perform penetration testing on a new application (Oracle/Peoplesoft/Unix/Windows/NT). The test was from within the network  and they failed to breach Oracle database security directly. However …

Password guessing against a NT server resulted in the discovery of a domain admin account (db2admin), which resulted in full compromise of this host and also the remaining servers that are members of this domain.

When you build a Windows server you are asked for an initial password (which you are expected to change later on). This password is stored in a build file and as it had not been changed after the installation  it was then used to logon to the domain (any of  the servers as local administrator)This allowed searching of files on the NT server which produced a file containing the oracle account and password to the people account (peoplesoft admin user)

Once onto the database a reasonably privileged account with a weak password was discovered. From there the encrypted values of the users were captured from dba_users and were compared against a known list of passwords and permutations based on the current password i.e. a zero used instead of an ‘o’. This compromised an account with create procedure and from there they were into the OS.

 

These issues have all been resolved and we are much more secure than we were but it just shows how a lapse in security somewhere on the network can allow what appears to be innocuous access which eventually provides full ingress into what is supposed to be a secure system.

Posted in Oracle, security | Tagged: , , , , , | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 133 other followers