In this short security post-it, I explain how SHA-1 can be broken and why it has no impact on the robustness of HMAC.
Dec 13, 2019 by Nicolas Béguier
SHA-1 and HMAC are not broken by a brute-force attack
In a real-life scenario, let's calculate the minimum length of an HMAC key to be breakable in more than 10 years, which is 315360000 seconds. I will theoretically take eight Nvidia GTX 1080s, using this
performance sheet.
By approximating, we consider that HMAC performs two SHA-1s and one XOR (0.5 times the number of SHA-1 per second). With this configuration, it is possible to generate about \(6.87 \times 10^{10}\) SHA-1 per second.
Let k be the length in bit of an HMAC key. The number of possibilities is \(2^k\) and we will take an average of \(2^{k-1}\) keys tested before recovering the HMAC key.
We are currently working on further improvements (unpublished yet), and we evaluate now that one can find a chosen-prefix collision for SHA-1 with a budget of less than $100,000, which is really practical.
Thomas Peyrin, May 10, 2019
HMAC is still ok?
First SHA1 was shattered. https://t.co/CnnYJiLtxP
Now it's reduced to shambles.
It's time to stop using SHA1. (HMAC-SHA1 is still okay.)
Scott Arciszewski (@CiPHPerCoder) May 10, 2019
The compression function of HMAC successively applies several SHA-1s. Having the power to make collisions of SHA-1 does not predict the output of an HMAC.
A much deeper break of SHA-1's round function would be needed to break HMAC. M. Bellare's New Proofs for NMAC and HMAC:
Security without Collision-Resistance shows that the security of HMAC holds assuming only weaker properties on
its round function than needed for collision resistance of the corresponding hash.
If you enjoyed this story, please recommend and share to help others find it! Feel free to contact me if you have any questions.