Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 

 

Implementing the SHA1 Algorithm

Oracle Forensics tips by Paul Wright

DBMS_UTILITY.GET_HASH_VALUE should be used for low priority patch checking and quick checksumming of many packages. If there is a suspected incident then use DBMS_OBFUSCATION_TOOLKIT.MD5 on the suspect package or on 10g DBMS_CRYPTO. DBMS_CRYPTO is the most secure as it implements the SHA1 algorithm but it is not available on 9i.

This is an implementation of SHA1 using DBMS_CRYPTO:

dbms_crypto.hash.auto.sql

set wrap off
set linesize 400
set serveroutput on

create or replace procedure sha1sum(lvtype in varchar2,lvname in varchar2,lvschema in varchar2)

is

   l_hash raw(2000);

begin

   l_hash:=dbms_crypto.hash(dbms_metadata.get_ddl(lvtype, lvname, lvschema), dbms_crypto.hash_sh1);

   dbms_output.put_line('HashSHA1='||l_hash||' Name='||lvschema||'.'||lvname);

end;

/

SQL> create or replace procedure sha1sum(lvtype in varchar2,lvname in varchar2,lvschema in varchar2)

  2  is
  3     l_hash raw(2000);
  4  begin
  5     l_hash:=dbms_crypto.hash(dbms_metadata.get_ddl(lvtype, lvname,
lvschema), dbms_crypto.hash_sh1);
  6     dbms_output.put_line('HashSHA1='||l_hash||'
Name='||lvschema||'.'||lvname);
  7  end;
  8  /

Procedure created.

SQL> exec sha1sum('VIEW','DBA_USERS','SYS');
HashSHA1=9B99749CE9B88DE8183FEB8637ED564BAC1BC201 Name=SYS.DBA_USERS 

PL/SQL procedure successfully completed.

To recap, DBMS_UTILITY.GET_HASH_VALUE is available on 7, 8, 9, 10 and fast but has different implementation on 7 therefore a different checksum is returned. DBMS_OBFUSCATION.MD5 is on 9 and 10 but is slower though cryptographically stronger than DBMS_UTILITY and weaker than DBMS_CRYPTO HASH_SH1.
DBMS_CRYPTO HASH_SH1 is on 10 only and not fast but the most secure of the three. If you use MD5 and SHA1 together this is not susceptible to malicious use of a collision.

Therefore DBMS_UTILITY is useful for checking patches and day to day state checking where speed is important but for higher security MD5 or preferably SHA1 should be used. For high security purposes it is preferable to check integrity using both MD5 and SHA1 due to the fact that collisions in MD5 allow for two files with differing content to have the same checksum.

Also by using stripwire it is possible for an attacker to control the content of a malicious collision. Using both MD5 and SHA1 checksums, dual collisions become all but impossible (see scenario 6). This is a judgment call for the analyst. For the sake of these examples we will use SHA1 but please see later chapters for examples using MD5 and DBMS_UTILITY.



This is an excerpt from the book "Oracle Forensics: Oracle Security Best Practices", by Paul M. Wright, the father of Oracle Forensics.

 


 

 
��  
 
 

 
 
 
 
oracle dba poster
 

 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright ? 1996 -  2014

All rights reserved by Burleson

Oracle ? is the registered trademark of Oracle Corporation.