오라클 12c 부터 DB 유저의 패스워드 저장 알고리즘이 SHA512를 사용하게 되었습니다.

Oracle 11g 는 SHA1 11g password algorithm 을 사용 하였습니다.

https://docs.oracle.com/cd/E25054_01/network.1111/e16543/authentication.htm#CHDEFIHB

Ensuring Against Password Security Threats by Using the SHA-1 Hashing Algorithm

“The SHA-1 cryptographic hashing algorithm protects against password-based security threats by including support for mixed case characters, special characters, and multibyte characters in passwords. In addition, the SHA-1 hashing algorithm adds a salt to the password when it is hashed, which provides additional protection. This enables your users to create far more complex passwords, and therefore, makes it more difficult for an intruder to gain access to these passwords. Oracle recommends that you use the SHA-1 hashing algorithm.”

 

The procedure for generating a 11g hash

  • An 10 bytes SALT gets generated by Oracle (looks random)
  • Password (case-sensitive) and SALT (10 bytes) value become concatinated
  • A SHA1 hash gets generated for the concatinated value
  • 11g password hash becomes: “S:” plus <SHA1 hash – readable hex representation> plus <SALT – readable hex representation, 20 characters>

 

Oracle 10g 는 3DES password  algorithm 을 사용 하였습니다.

The procedure used for generating a 10g hash

  • Convert username to uppercase version of username (username sys becomes SYS)
  • Convert password to uppercase version of password (password test becomes TEST)
  • Capatilized username and password gets concatinated (username SYS with password TEST becomes SYSTEST)
  • Encrypt (using 3DES algorithm) concatinated value with a (permanent – always the same) secret key
  • Encrypt (using 3DES algorithm) concatinated value with a secret key (this key are the last 8 bytes of the first encryption)
  • The actual password hash value will be the last 8 bytes of the second encryption round, stored in a readable hex representation of these 8 bytes – so 16 characters)

Oracle 12c 테스트

https://www.trustwave.com/Resources/SpiderLabs-Blog/Changes-in-Oracle-Database-12c-password-hashes/

 

Oracle has made improvements to user password hashes within Oracle Database 12c. By using a PBKDF2-based SHA512 hashing algorithm, instead of simple SHA1 hash, password hashing is more secure. With this post, I’ll explain some of the changes and their security implications.

With Oracle Database 11g, the spare4 column from the sys.user$ table stores user password hashes.

This is an example of the sys.user$.spare4 entry for user ‘ demo’ with password ‘ epsilon’ (pluggable database):

S:8F2D65FB5547B71C8DA3760F10960428CD307B1C6271691FC55C1F56554A;H:DC9894A01797D91D92ECA1DA66242209;T:23D1F8CAC9001F69630ED2DD8DF67DD3BE5C470B5EA97B622F757FE102D8BF14BEDC94A3CC046D10858D885DB656DC0CBF899A79CD8C76B788744844CADE54EEEB4FDEC478FB7C7CBFBBAC57BA3EF22C

Step-by-step:

SQL&gt; create user demo identified by epsilon;
User created.
SQL&gt; select spare4 from sys.user$ where name = 'DEMO';
SPARE4
--------------------------------------------------------------------------------
S:8F2D65FB5547B71C8DA3760F10960428CD307B1C6271691FC55C1F56554A;H:DC9894A01797D91D92ECA1DA66242209;T:23D1F8CAC9001F69630ED2DD8DF67DD3BE5C470B5EA97B622F757FE102D8BF14BEDC94A3CC046D10858D885DB656DC0CBF899A79CD8C76B788744844CADE54EEEB4FDEC478FB7C7CBFBBAC57BA3EF22C

sys.user$.password value for the same user:

SQL&gt; select password from sys.user$ where name = 'DEMO';
PASSWORD
--------------------------------------------------------------------------------
2B7983437FE9FEB6

This will omit the password value discussion: it is calculated using the same algorithm (uppercase and concatenate username and password then do 3DES hashing) as in previous Oracle Database versions.

The spare4 column’s value has three parts (“ S:”, “ H:”, and “ T:”) separated by semicolons.

The “ S:” part length is 60 characters or 30 bytes:

8F2D65FB5547B71C8DA3760F10960428CD307B1C6271691FC55C1F56554A

The “ H:” part length is 32 characters or 16 bytes:

DC9894A01797D91D92ECA1DA66242209

Finally, the “ T:” part length is 160 characters or 80 bytes:

23D1F8CAC9001F69630ED2DD8DF67DD3BE5C470B5EA97B622F757FE102D8BF14BEDC94A3CC046D10858D885DB656DC0CBF899A79CD8C76B788744844CADE54EEEB4FDEC478FB7C7CBFBBAC57BA3EF22C

So what do they mean exactly?

The S part

In Oracle Database 11g there is “ S:” part and it is created as follows:

password hash (20 bytes) = sha1(password + salt (10 bytes))

(Visit http://marcel.vandewaters.nl/oracle/security/password-hashesfor more detail.)

The same is true of Oracle Database 12c: the simple test below proves that.

For the S value from above ( 8F2D65FB5547B71C8DA3760F10960428CD307B1C6271691FC55C1F56554A):

hash is 8F2D65FB5547B71C8DA3760F10960428CD307B1Csalt is 6271691FC55C1F56554A

Password is “ epsilon”, so let’s calculate SHA1 hash from 'epsilon' + 0x6271691FC55C1F56554A:

import hashlib
sha1 = hashlib.sha1()
sha1.update("epsilon")
sha1.update('\x62\x71\x69\x1f\xc5\x5c\x1f\x56\x55\x4a')
sha1.hexdigest().upper()

That calculation produces:

8F2D65FB5547B71C8DA3760F10960428CD307B1C

This is identical to the 11g algorithm.

The H part

When looking through SQL files under $ORACLE_HOME/rdbms/admin one can spot this:

create or replace view DBA_DIGEST_VERIFIERS
  (USERNAME, HAS_DIGEST_VERIFIERS, DIGEST_TYPE) as
select u.name, 'YES', 'MD5' from user$ u where instr(spare4, 'H:')&gt;0
union
select u.name, 'NO', NULL from user$ u where not(instr(spare4, 'H:')&gt;0) or spare4 is null
/

So it appears to be a MD5 hash.

Note that there is SQL code under $ORACLE_HOME/rdbms/admin that modifies the spare4 column’s value to remove the H: on downgrade.

This is how spare4.H is calculated: the username is uppercased, then the MD5 hash is calculated from it, and ‘ XDB’ and password are separated by colons:

import hashlib
m = hashlib.md5()
m.update('DEMO:XDB:epsilon')
m.hexdigest().upper()
'DC9894A01797D91D92ECA1DA66242209'

This makes it possible to attack built-in user passwords using pre calculated hashes for dictionary words prefixed with constants like ‘ SYSTEM:XDB:’.

The H value seems to be used for digest authentication in XDB.

The T part

This applies to 12.1.0.2 only. For previous 12c versions the T part is not available.

Let’s enable 12c passwords hashes only by updating the sqlnet.ora file (assuming the client is from 12.1.0.2 distribution too):

# sqlnet.ora
SQLNET.ALLOWED_LOGON_VERSION_SERVER = 12a

Then re-create the demo user (reconnect the client first):
drop user demo;
create user demo identified by epsilon;
select spare4 from sys.user$ where name = 'DEMO';
H:DC9894A01797D91D92ECA1DA66242209;T:E3243B98974159CC24FD2C9A8B30BA62E0E83B6CA2FC7C55177C3A7F82602E3BDD17CEB9B9091CF9DAD672B8BE961A9EAC4D344BDBA878EDC5DCB5899F689EBD8DD1BE3F67BFF9813A464382381AB36B

Note that the spare4 value no longer has the S: part, only the H: and T: components are there.
In Oracle Database 12c documentation we can find this:

About the 12C Verifier

… is based on a de-optimized algorithm involving PBKDF2 and SHA512…

So the password should be processed via PBKDF2 followed by SHA512 to produce T.

During authentication the server sends so called AUTH_VFR_DATA (which matches the last 16 bytes of the spare4.T value) to the client:

-- Server to client packet snippet
39 39 39 00 00 00 00 0D-00 00 00 0D 41 55 54 48 999.........AUTH
5F 56 46 52 5F 44 41 54-41 20 00 00 00 20 38 44 _VFR_DATA.....8D
44 31 42 45 33 46 36 37-42 46 46 39 38 31 33 41 D1BE3F67BFF9813A
34 36 34 33 38 32 33 38-31 41 42 33 36 42 15 48 464382381AB36B.H

So we can divide the T value into two parts (first 64 bytes and the AUTH_VFR_DATA):

E3243B98974159CC24FD2C9A8B30BA62E0E83B6CA2FC7C55177C3A7F82602E3BDD17CEB9B9091CF9DAD672B8BE961A9EAC4D344BDBA878EDC5DCB5899F689EBD (first 128 chars or 64 bytes)
8DD1BE3F67BFF9813A464382381AB36B (last 32 chars or 16 bytes – AUTH_VFR_DATA)

Let’s assume that the AUTH_VFR_DATA is randomly generated when a password is set/reset. Thus Python code to produce the first 64 bytes of T is (requires PBKDF2 Python module):

import pbkdf2, hashlib
AUTH_VFR_DATA = b'\x8d\xd1\xbe\x3f\x67\xbf\xf9\x81\x3a\x46\x43\x82\x38\x1a\xb3\x6b' # This is received from the server once the latest protocol is negotiated
salt = AUTH_VFR_DATA + b'AUTH_PBKDF2_SPEEDY_KEY'
key = pbkdf2.PBKDF2("epsilon", salt, 4096, hashlib.sha512) # Password
key_64bytes = key.read(64) # This 64-byte derived key is encrypted by the client and sent to the server as AUTH_PBKDF2_SPEEDY_KEY
t = hashlib.sha512() # This happens on the server after they key is decrypted from the AUTH_PBKDF2_SPEEDY_KEY value
t.update(key_64bytes)
t.update(AUTH_VFR_DATA)
t.hexdigest().upper() # First 64 bytes of spare4.T: value if password is correct

This produces:

E3243B98974159CC24FD2C9A8B30BA62E0E83B6CA2FC7C55177C3A7F82602E3BDD17CEB9B9091CF9DAD672B8BE961A9EAC4D344BDBA878EDC5DCB5899F689EBD

Summing up

Oracle has added MD5 hash and PBKDF2-based SHA512 hash in 12c. A quote from Oracle documentation:

The cryptographic hash function used for generating the 12C verifier is based on a de-optimized algorithm involving PBKDF2 and SHA-512. The PBKDF2 algorithm is used to introduce computational asymmetry in the challenge facing an intruder seeking to recover the original password when in possession of the 12C verifier.

When the MD5 hash is there it weakens security since it is easier to brute force than the PBKDF2-based SHA512 alone.

By haisins

오라클 DBA 박용석 입니다. haisins@gmail.com 으로 문의 주세요.

92 thoughts on “[Oracle 12c] Oracle DB 유저의 패스워드 저장 암호화 알고리즘 변경”
  1. Let the diamonds emeralds sapphires and rubies do all of the speaking.
    People will get to know you with out you even opening your mouth.

  2. I am therefore passionate about all pets. I found the documentary, unlike you,
    become haunting.

  3. Do you feel such as you by no means get to the end of your to-do checklist?
    Canadian residing in London. Moreover, they’re low-cost on fuel and easy to
    park.

  4. As we speak I have to point out to you some beaded pendants.
    Just a web based mortgage application form must be filled
    up. The mortgage will get accredited inside 24
    hours.

  5. The recurring iconography of a Minoan goddess descending on a throne seems to became a key image of
    the legitimization of the brand new social order.

  6. Your use of the Site is the acceptance of the terms. on Google.
    Plus personal individual websites are Distasteful?

  7. Use anti-tarnish paper for wrapping your costume jewelry before storing it
    for long intervals of time. 2. Soak your gold jewelry , in heat water.

  8. Then, they put flashing lights and long red and white striped hands
    that drop dow to block traffic when a train crossing is imminent.

  9. Check out this short article for some guidelines that may help you improve worker retention and keep your very best skill close.

  10. Whenever you elect to freelance, additionally, you will be in control
    of your personal schedule. Instead of being bound
    to the 9-to-five work day of most regulation workplaces, both your every
    day schedule and your calendar as a complete shall be
    largely as much as you. Whether you have to take break day, or whether or
    not you want to tackle a heavier workload, freelancing will meet your needs.

  11. In Australia, businesses are generally well prepared the festive season by late August, early September.

  12. This bonus thing must stop, we constantly worked difficult however now
    I’m frightened to attend work too.

  13. An individual can locate 3 groups of inorganic sprays available inside the marketplace to your single purpose
    of exterminating unwelcome mattress parasites.

  14. I think Sirdent tried to start a chat space but I do not think it went over well.

    It is is the forums.

  15. I would like to make every guest pleased, but sometimes the needs are nearly impossible.
    on Bing. Plus my personal personal web sites are Anyways, happy we’d
    a great discussion and debate.

  16. I basically accept you, nonetheless it appears your need to be positively right
    in every things has caught you up, poorly.

  17. She had been associated with a personal scandal that involved dating and consuming but she’s
    now become a group captain!

  18. Which brings some further look amongst other brand?
    If you do, the jewellery retailer will probably be additional keen to cut back his
    price for you.

  19. In this post the beauty professionals of KTD Team s.m..
    necklaces supplier can speak about the required equipment every bride
    ought to have.

  20. In a while solely Simba was used, and sometimes REGD was added.
    The third most necessary factor to do is to show the piece over and look at the again of
    the piece.

  21. Under we see a closer have a look at the earrings.

    Therefore, when you could have used the ring, maintain it in velvet pouch jewelry field.

  22. Dude, i’m contaminated with the over-smartness a few of my buddies reveal in their FB statuses.

  23. Cover the surface that you need to use as a mould in Vaseline.
    The most effective part? The gold alone weighed three,4
    kilos!

  24. I think, that wedding dessert image of the bride and groom ought
    to be the standard cake design for all wedding cakes.

  25. Almost 30 days ago and eve associated with President taking the to begin 2 oaths of office in their second
    term.

  26. These are typically willing to let the majority of this
    nation starve and perish (medical) so that their masters happy.

  27. Right away I am going away to do my breakfast, after having my breakfast coming over again to read further news.

  28. Hi there to all, how is everything, I think
    every one is getting more from this web site, and your views are good designed for new
    visitors.

  29. Have you ever thought about publishing an e-book or guest authoring on other blogs?
    I have a blog based upon on the same subjects you discuss and would really like to have you share some stories/information. I know my visitors would value your work.
    If you are even remotely interested, feel free to shoot me an email.

  30. I know this if off topic but I’m looking into starting
    my own weblog and was wondering what all is needed to get set up?
    I’m assuming having a blog like yours would cost a pretty
    penny? I’m not very web savvy so I’m not 100%
    positive. Any suggestions or advice would be greatly appreciated.
    Thank you

  31. Excellent blog here! Additionally your site a lot up fast!
    What host are you using? Can I get your associate link for your host?
    I desire my site loaded up as fast as yours lol

  32. Hi there would you mind letting me know which web host you’re utilizing?
    I’ve loaded your blog in 3 completely different web browsers and I must say this blog
    loads a lot quicker then most. Can you suggest a good web hosting provider at
    a honest price? Many thanks, I appreciate it!

  33. I believe everything said made a great deal of sense. But, think
    about this, suppose you added a little information? I mean,
    I don’t want to tell you how to run your website, but suppose you added a title to possibly get
    people’s attention? I mean [Oracle 12c] Oracle DB 유저의 패스워드 저장
    암호화 알고리즘 변경 – DBA 의 정석 is a little boring.
    You ought to look at Yahoo’s home page and note how they write article titles to grab viewers to open the links.
    You might add a related video or a related picture or two to grab readers interested about everything’ve got to say.
    Just my opinion, it could make your website a little bit more interesting.

  34. Howdy! I could have sworn I’ve been to this site before but after reading through some of the post I realized
    it’s new to me. Anyways, I’m definitely happy I found
    it and I’ll be bookmarking and checking back frequently!

  35. Your style is really unique compared to other folks
    I’ve read stuff from. Thanks for posting when you’ve got the opportunity, Guess I’ll just bookmark this web site.

  36. Really no matter if someone doesn’t understand afterward its
    up to other users that they will assist, so here it takes place.

  37. I believe this is one of the such a lot important information for me.
    And i am glad reading your article. But should commentary on few general issues, The website taste is great, the articles is truly great : D.
    Just right process, cheers

  38. My brother suggested I might like this web site.
    He was entirely right. This post truly made my day.

    You cann’t imagine just how much time I had spent for
    this info! Thanks!

  39. Thanks for the marvelous posting! I certainly enjoyed reading
    it, you might be a great author. I will remember to bookmark your blog and will
    eventually come back later in life. I want to encourage you to
    continue your great posts, have a nice day!

  40. The office assists Members in tabling Parliamentary Questions (PQs) and Early Day Motions (EDMs).

  41. Carpal tunnel syndrome is typically identified based on symptoms and the
    outcomes of bodily examinations.

  42. I’m not that much of a online reader to be honest but your sites really nice, keep it up!
    I’ll go ahead and bookmark your website to come back later on. Many thanks

  43. Hellߋ, i thіnk that i saw yօu visited mу website thus i cаme
    tо “return the favor”.I am attempting tto fіnd
    things t᧐ improve my website!I suppose its ok to usee a fеw of ʏⲟur ideas!!

  44. fantastic submit, very informative. I wonder why the opposite
    experts of this sector do not realize this. You should proceed your writing.
    I am sure, you’ve a huge readers’ base already!

  45. Just desire to say your article is as amazing. The
    clarity in your post is simply spectacular and i
    could assume you are an expert on this subject.
    Fine with your permission allow me to grab your RSS feed to keep up to date with
    forthcoming post. Thanks a million and please carry on the enjoyable work.

  46. Link exchange is nothing else however it is just placing the other person’s webpage link on your page
    at proper place and other person will also do same in support
    of you.

  47. Heya just wanted to give you a brief heads up and let you know a
    few of the images aren’t loading properly. I’m not sure why but I think its a linking issue.
    I’ve tried it in two different web browsers and both show the same outcome.

  48. Thanks for finally talking about >[Oracle 12c] Oracle DB 유저의 패스워드
    저장 암호화 알고리즘 변경 – DBA의 정석 <Liked it!

  49. I don’t even understand how I stopped up right here, however
    I thought this publish was once good. I do not recognise who you are
    but definitely you’re going to a famous blogger should you are not already.
    Cheers!

Comments are closed.