## Offshore 2.0 Bespoke Testing and Security Services

Visit Shift Asia https://bit.ly/2CtLM83

promotedHow Hackers Can Brute-Force Passwords And Find A Correct Key? by@wagslane

Bitcoinist, libertarian, atheist, cryptography fan, and founder of http://qvault.io

Brute force attackers guess passwords, passphrases, and private keys in an attempt to eventually get the right answer and crack the security of a system, but how do they know when they have the right key?

It depends on the system.

Let's answer the question three times, one for three different common systems.

In this case, let's assume we have direct access to an encrypted hard drive (like that of a MacBook) that has been ciphered using AES-256-GCM. Because we have access to the raw encrypted data, we can't be locked out for too many failed attempts. ðŸ˜ˆ

Since we are free to guess as hard and as fast as we can, all we need to know is when to stop deciphering. This is easy if the encryption was done using an authentication tag as required by GCM mode. When we get the correct password, the authentication tag will check out.

Brute forcing your way through the front door of a web application will prove difficult if not impossible. The cryptosystem lives on a server you don't have control over. Due to this, they can lock you out after a number of failed guesses.

However, if the server doesn't have these kinds of protections in place, then it is easy to tell when you have the right password because you will likely be given an HTTP 200 response OK, and perhaps some form of login token.

We can encrypt any message using the public key that we have, and we can decrypt using the private key if we can find it. Then, we can man-in-the-middle attack other users and decrypt their messages that were meant for the server.

How do we know when we have the right answer?

Well, it depends a bit on the algorithm that was used to create the key pair. If we know the algorithm, then we can generate random private keys and check to see if the public key that we have is a valid match using the known algorithm.

If this isn't feasible because we don't have all the algorithm information, then we are likely stuck with encrypting a random string of text with the public key, generating private keys, and trying to decrypt with each private key until the decryption is successfulness.

A brute-force attack in cryptography is when an attacker guesses many passwords in succession hoping to *eventually *get one right.

For example, the most naive form of brute force attack would be to try every permutation of characters from length 0 to length n.

a, b, c ...aa, ab, ac, ... ba, bb, bcaaa, aab, aac, ... aba, abb, abc... bba, bbb, bbc...

Assuming 26 lowercase letters, 26 uppercase letters, 10 digits, and 10 special characters, it would take 66^10 (~1560000000000000000) guesses just to try all the combinations of exactly length 10. Assuming a modest 200 guesses per second, it would take ~247,336,377 years to crack the password.

Based on the math above, it certainly seems like 10 digit passwords are impervious to brute force attacks. While that may be true of the most naive attacks, there are other things to watch out for.

Instead of the attacker guess every single combination, instead, they may try every word in the English dictionary, with every three-digit combination appended to the end.

- apple001, apple002, apple003...
- baby001, baby002, baby003...

Assuming 50,000 words in the English dictionary, there are only 50,000,000 combinations! Again, assuming 200 guesses per second, it would take ~2.9 **days **to crack the password... that isn't very long. It is also trivial for the attacker to throw in special characters for corresponding letters. For example, "*@pp1e001*"

By Lane Wagner â€“Â @wagslaneÂ on Twitter

- Lane on Twitter:Â @wagslane
- Lane on Dev.to:Â wagslane
- Subscribe to Qvault:Â https://qvault.io