In the spirit of DEF CON and a week of hacking, Tech Talker covers one question he gets asked all the time: How do you "crack" a password?
I’m going to cover one question that I get asked all the time: How do you "crack" a password?
To answer that, I’m going to take you through the steps a hacker would use to break your password—so that you can avoid some of the pitfalls that would make you an easy target to any password cracker out there.
What's a Hash?
First, let’s talk about how passwords are stored. If a website or program is storing your password--like Google, Facebook or anywhere that you have an online account--the password is generally stored in the form of a hash. A hash is basically a secure way of storing passwords based upon math.
A hash is also a way of scrambling a password—so if you know the trick, you can easily unscramble it. It would be similar to hiding a key to your house in your front yard: if you knew where the key was, it would take you only a few seconds to find it. However, if you didn’t know where the key was it would probably take you a long time to find it.
The 2 Types of Hacker Attacks
Now, let’s break down password attacks into two different types: online and offline.
Offline attacks are where a hacker can take a password hash, copy it, and take it home with them to work on. Online attacks require the attacker trying to login to your online account to go to the specific website they are targeting.
Online attacks on secure websites are very difficult for a hacker, because these types of sites will limit the number of times an attacker can try a password. This has probably happened to you if you’ve forgotten your password and been locked out of your account. This system is actually designed to protect you from hackers who are trying billions of guesses to figure out your password.
An online attack would be like if you tried to search for someone’s hidden key in their front yard while they were home. If you looked in a few places, it probably wouldn’t look too odd; however, if you spent all day in front of the house, you’d be spotted and told to leave right away!
In the case of an online attack, a hacker would most likely do a lot of research on a particular target to see if they could find any identifying information about them, such as children’s names, birthdays, significant others, old addresses, etc. From there, an attacker could try a handful of targeted passwords that would have a higher success rate than just random guesses.
Offline attacks are much more sinister, and don’t offer this protection. Offline attacks take place when an encrypted file, such as a PDF or document, is intercepted, or when a hashed key is transferred (as is the case with WiFi.) If you copy an encrypted file or hashed password, an attacker can take this key home with them and try to crack it at their leisure.
Although this may sound awful, it’s not as bad as you may think. Password hashes are almost always "one-way functions." In English, this just means that you can perform a series of scrambles of your password that are next to impossible to reverse. This makes finding a password pretty darn difficult.
Essentially, a hacker has to be very very patient and try thousands, millions, billions, and sometimes even trillions of passwords before they find the right one. There are a few ways hackers go about this to increase the probability that they can find your password. These include:
Mask/Character Set Attacks
Let's talk more about each of these.
Dictionary attacks are just what they sound like: you use the dictionary to find a password. Hackers basically have very large text files that include millions of generic passwords, such as password, iloveyou, 12345, admin, or 123546789. (If I just said your password, change it now!!!)
Hackers will try each of these passwords --which may sound like a lot of work, but it’s not. Hackers use really fast computers (and sometimes even video game graphics cards) in order to try zillions of passwords. As an example, while competing at DEFCON this last week, I used my graphics card to break an offline password, at a speed of 500,000 passwords a second!
Mask/Character Set Attacks
If a hacker can’t guess your password from a dictionary of known passwords, their next option will be to use some general rules to try a lot of combinations of specified characters. This means that instead of trying a list of passwords, a hacker would specify a list of characters to try.
For example, if I knew your password was just numbers, I would tell my program to only try number combinations as passwords. From here, the program would try every combination of numbers until it cracked the password. Hackers can specify a ton of other settings, like minimum and maximum length, how many times to repeat a specific character in a row, and many more. This decreases the amount of work the program would need to do.
So, let's say I had an 8 character password made up of just numbers. Using my graphics card, it would take about 200 seconds--just over 3 minutes--to crack this password. However, if the password included lowercase letters and numbers, the same 8 character password would take about 2 days to decode.
If an attacker has had no luck with these two methods, they may also "bruteforce" your password. A bruteforce tries every character combination until it gets the password. Generally, this type of attack is impractical, though--as anything over 10 characters would take millions of years to figure out!
As you can see, cracking a password isn’t as hard as you may think, in theory--you just try trillions of passwords until you get one right! However, it's important to remember that finding that one needle in the haystack is sometimes next to impossible.
Your best safety bet is to have a long password that is unique to you, and to whatever service you’re using. I’d highly recommend checking out my episodes on storing passwords and creating strong passwords for more info.