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 bob@acme.com

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


Assuming I can decrypt the hash I end up with:


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 ABCDEFjohn@test.com201610071257 and pass the MD5 of that into the URL and login as john@test.com

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.

  • when verifying the hash how can I know the date that was used when generating it? – kaidentity Oct 7 '16 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 '16 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 '16 at 9:57

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".


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.

  • 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 '16 at 14:04
  • Hi bhttoan, I understood that, I just wanted to take this opportunity to point out some improvements for the company. ;-) – swordsecurity Oct 7 '16 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.