1

We are using an application which offers single sign to their systems which is then embedded as an iframe (i.e. the URL is visible in the source of the page)

The SSO security comes from using MD5 to hash a number of components together and the resulting hash is then used in the URL.

For example, there is a server key and that gets mixed with the user email address and the current date so assuming the server key is ABCDEF, the date is 20161007125600 and the email is [email protected]

When this gets hashed it creates a hash of 973897b9cdc4381ae4202a162d28052d and the URL for the iframe is then something like:

https://server.com?hash=973897b9cdc4381ae4202a162d28052d

Assuming I can decrypt the hash I end up with:

[email protected]

As all the strings use the exact same layout I can pretty easily split this into the email address, the date and the key. By doing so I can now create a hash of [email protected] and pass the MD5 of that into the URL and login as [email protected]

Is this "secure"? Am I over analyzing this? They are quite a large and established company so I would assume they have tested this extensively but I am so averse to MD5 that it has set my senses tingling and I want to find out if it is something to worry about.

4
  • when verifying the hash how can I know the date that was used when generating it?
    – kaidentity
    Oct 7, 2016 at 12:05
  • Fair point - I am not including the whole URL but the date gets passed as a non hashed element in the URL as well
    – bhttoan
    Oct 7, 2016 at 12:18
  • MD5 is not encryption. MD5 will never provide any sort of security. Use SSL if you want to transmit personal data
    – BlueWizard
    Oct 8, 2016 at 9:57
  • There are actually two security components: The secure generation of the "access key", and keeping that confidential. So for your system, is it intended that a user can bookmark the URL to use "passwordless login"? Or if an attacker can copy the URL, no further "secrets" are needed.
    – U. Windl
    Jun 29, 2023 at 13:15

2 Answers 2

2

You are absolutely not over-analyzing. What they are doing is not secure. The reason doesn't have only to do with the fact that they're using MD5. It is rather that so called "keyed hashes" (which is basically what you describe) are not considered secure. The alternative method is HMAC. See the description on wikipedia. The flaw I'm referring to above is described in the paragraph "design principles".

1

Key derivation function

I would recommend to remove the e-mail field and use a PBKDF2 key derivation function to generate your hash with a few thousand rounds with a secure hashing algorithm like SHA-256 or SHA-512.

Random Initialization Vector

Use a random IV (16 bytes or more) generated by a cryptography secure random number generator (like /dev/urandom) and send the IV along with the other data.

Secure hashing function

MD5 is 32 characters long, 16 bytes long. SHA2-256 is 64 characters long, 32 bytes, SHA-512 is 128 characters long, 64 bytes. So another reason to move to SHA-256 or SHA-512 is that the hash itself is harder to brute force.

2
  • I should point out this is NOT my application so I cannot directly control what gets passed such as the email field etc - I just want to understand if it is secure and it appears it may not be
    – bhttoan
    Oct 7, 2016 at 14:04
  • Hi bhttoan, I understood that, I just wanted to take this opportunity to point out some improvements for the company. ;-) Oct 7, 2016 at 14:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .