Skip to main content
3 of 10
added 37 characters in body
Peter
  • 3.6k
  • 4
  • 15
  • 24

I disagree with the accepted answer. Let's look at 2 scenarios, one is we have 10'000 passwords and want to crack as many as possible, the other is one password and we want to crack it. In both scenarios the difference turns out to be significant. As usual, all information can be abused in an attack, even if it doesn't seem so at first sight.

Scenario 1: Crack many out of 10'000 passwords with limited resources.

We can just try bruteforce attacks on all of the passwords with no way of distinguishing them if we don't know the password length. On the other hand, if we do know the length we can order the passwords based on the length, going after the short passwords first. If we use an exhaustive bruteforce attack (which is guaranteed to find the password) sorting the passwords will only offer a very minimal gain. Why? Bruteforcing all 7 digit passwords takes about 1-2% as long as brute forcing all 8 bit passwords. The only thing we gain by knowing the length is that we don't need to brute force all 7 digit (and smaller) passwords if we already know that the password has 8 digits. If we need to crack all passwords with bruteforce attacks, knowing the length of each password gives us <5% advantage. Except that a bruteforce attack is not what we do. A bruteforce attack requires near infinite time and therefore isn't something we can or will do.

Instead we try a series of "likely" keys for each length, one way to do this is with a dictionary attack. Testing likely keys is several orders of magnitude cheaper than using exhaustive brute force, but it has a huge disadvantage: Once we tried all "likely" 7 digit keys on a password, yet did not crack the password, we do not know if the password is longer than 7 digits. So unless we know for sure the password is no longer than 7 digits, we still have to test that password against all "likely" 8 digit keys, 9 digit keys, 10 digit keys - and like bruteforce, the cost of testing longer keys increases exponentially. Since we now know the password is 7 digits long, we don't have to test it against likely 8, 9, 10, 11, 12 digit and even longer keys, saving a truly massive amount of work.

It gets better. Once we tested all likely keys up to a length of, say, 20 digits, we can now spend our remaining resources on a brute force attack on those passwords with a small length which our previous search for "likely" keys did not crack. Say we have 2'000 keys remaining and 100 are less than 6 digits. Keep in mind we have a limited budget. 6 digit passwords are cheap to crack. But because we know which 100 are 6 digit or smaller, we now need to brute force 100 6 digit passwords in order to crack 100, instead of brute forcing 2000 passwords to crack 100 6 digit passwords. That's 20 times less work.

If we look at all the benefits combined, the exact gain we receive from knowing the password lengths depends on the speed of our method to test "likely" keys, the respective success rate of our method to test likely keys for each password length, the distribution of password lengths in the password collection we want to crack, and the amount of resources we have available (calculation speed, time). But by knowing the lengths of the passwords we can easily increase the number of passwords we find with a given amount of resources several times over - if the numbers work strongly in our favor, we can possibly reduce the resource cost to crack 30% of the passwords by an order of magnitude or more.

Scenario 2: Crack a single password in a targeted attack

Not knowing the length of the password, we need to distribute our resources between brute forcing all keys with a short length and testing likely passwords with a longer length. Assuming we spend half our resources on each, knowing the password length allows us to completely pass on one of the 2 and therefore double our available resources.

We also gain additional information. For example if the password is short enough to brute force it, we can give an upper bound on how long it takes us to get the password. We also can calculate a likelihood of cracking the password at all. Since we are talking about a targeted attack, if we know we are unlikely to crack the password we can also spend our resources on finding other ways to compromise the system.

Peter
  • 3.6k
  • 4
  • 15
  • 24