What Does This Mean For Me? The SHA1 Collision Attack
Though overshadowed by the Cloudflare Leak announced the same day, the SHA1 collision has far reaching implications for developers and software products worldwide. Developers were warned to start moving away from the technology, towards newer hashing algorithms years ago; nevertheless, many pieces of software still rely on it, even its predecessor MD5 in some cases. Recently, Google announced the first known collision attack on the algorithm, which is a death-knell for a hash function. If those words mean nothing to you, I’ll ask it for you: What does this mean for me? To explain we’ll have to take a shallow dive into how login systems work in the modern world.
Almost everyone has entered their username and password into a website to login at some point in their online career. While some newer technologies are emerging, Username and Password combos are among the easiest security systems to implement, offering small barriers to entry from users. It’s easy to have a person remember a password. But what happens to your password when you first create your account?
You might imagine the site stores your username and password in a list somewhere and when you type it in again, it checks the list to see if you have two matching entries. This is called storing your passwords in plain text. While I’m sure some sites do this, it has massive security consequences. If any hacker were to find the sites list, they would be able to log in as any of the users! So, what engineers do instead is store a one-way hash of the password.
What’s a One-Way Hash?
A one-way hash is a way to change a list of characters (this is called a “string” in the software world), and turn it into a fixed length string by doing a lot of complicated math. The math is done in such a way once you’ve finished, it becomes nearly impossible to reverse the math and get your string back. Yet, every time you enter the same original string, you’re guaranteed to get the same fixed length string back (2 + 2 always equals 4, and this math works the same way). The best hash functions can be quickly completed by computer so there isn’t much performance hit in using them.
So what happens when you choose a password? The web site will take the password you entered upon creating an account and perform the hash function, getting a fixed length string and storing it alongside your username. When you go to log in, the hash function is performed on whatever you enter for the password, then compared against what was stored. If the hashes match it means you entered the password correctly and you’re successfully logged in; therefore, if hackers find your web sites user list, they can’t figure out your password! Perfect, right?
One way hashes are effective and used in all sorts of functions. However, they all have one major drawback: The Collision.
What Happened With SHA1?
Imagine I created my own hash function that turned any length password into a 2 character fixed length hash. I enter my password, which is, “HeyDummyDontGiveOutYourPasswordToPeople”, and it saves that in the password list as “E4”, a 2 character string. Every time I type in my password, it will hash out to E4, allowing me to log in. What happens if I enter another string? Maybe I type “WaitThisIsntMyPassword”, and it also evaluates to “E4”? There are only so many possibilities: there’s 1296 possible hashes and an infinite number of strings, so this is bound to happen eventually. If I enter, “WaitThisIsntMyPassword”, that will also allow me to log in, thus someone can break into my account without even knowing my password!
All hashes have this collision issue, though not nearly as pronounced. It generally takes years, even decades to find these collision values, making it significant when we do. The software community has known for years this was likely to take place with SHA1, leading many shops to preemptively move on to the more complex, longer SHA256 or other algorithms.
So What Should I Do?
If you’re working in a place with software developers, it might not be a bad idea to ask them if they’ve read up on it. As of right now there’s no immediate cause for alarm: you’re not any less secure today than you were a few weeks ago. It is still imperative the engineers rapidly find a solution, as it does cause security issues for teams.