Beginners learning brute-forcing attacks against WPA handshakes are often let down by the limitations of default wordlists like RockYou based on stolen passwords. The science of brute-forcing goes beyond using these default lists, allowing us to be more efficient by making customized wordlists. Using the Mentalist, we can generate millions of likely passwords based on details about the target.
Password cracking is a long-established art, relying on a combination of brute-force processing power and the ability to refine your list down to likely options based on what you know about a target. Many security protocols are vulnerable to brute-forcing attacks, which at its core relies on a few key principals.
First, you must be allowed to try different passwords many times very quickly. Second, you need to be able to determine the difference between a password success and failure. Third, you need a list of passwords to automatically try very quickly. And finally, the password must be present in the list in order for the attack to succeed. As password lists get bigger, CPU and GPU performance becomes more important as the rate at which passwords can be attempted is sped up.
Most wireless networks are secured by WPA or WPA2 encryption, which is able to be cracked by capturing a network handshake and using your computer's CPU to brute-force the password. Beside WPA, protocols like SSH and FTP are also vulnerable to brute-forcing, although the methods of brute-forcing can be differentiated between online and offline type attacks.
In an online attack, we connect directly to a service and send password attempts in a way that can be logged. An example of this would be Reaver or SSHtrix, which need to be connected to the network the host is on in order to send password guesses. In these attacks, the limiting factor is often how many incoming connections the FTP or SSH server can accept and the amount of time you must spend connected to the host while cracking.
In an offline attack, the major limiting factor is your CPU or GPU's ability to try different passwords quickly. Examples of this can be brute-forcing a WPA handshake, a WPS-Pixie dust attack after collecting the necessary information, or cracking password hashes from a stolen database. In general, this is the only time you need to be worried about your GPU or CPU performance while brute-forcing.
Rather than simply start with a dictionary-style attack, a smart attacker will often first look for lists that contain real passwords. These lists are generally regarded as the starting point for these sorts of techniques, as they will work against anyone with a truly awful or common password. In the wild, you can expect success rates of around 15% for these sorts of password audits. Obviously, if you are targeting a specific account or network, this is a pretty small chance of success.
That being said, you can still use these lists as a seed for a more refined attack based on information you know about the target. The reason these lists are effective is that you can think of them as a statistical survey of the most common passwords people use in the wild. Since the average user will reuse these passwords in multiple accounts, we can use the most common passwords as a seed to change small things, like adding or removing numbers, in a program called a word mangler.
Fortunately for hackers, a wealth of information exists online when trying to crack a specific target. A brute-force attack by the average script-kiddie may not be a substantial threat to an organization that enforces using strong passwords. A well-researched brute-force attack, however, can cut down the number of guesses and present only relatively strong guesses based on available information about the target and any password requirements. This can make a brute-force attack effective against selected, well-researched parts of a target's infrastructure.
With some research, we can supply the data for wordlist creator programs which takes information learned about a target and generates a custom wordlist based on details it's likely the user may have created their password from.
There are a number of options for creating wordlists besides a simple dictionary, and the one we'll explore today is Common User Passwords Profiler (or CUPP). A lightweight, simple Python program, CUPP is capable of generating an impressive seed of personalized password guesses. Other tools, like CeWL, allow for target websites to be scraped for unique words in order to use words that are common across the organization.
With a little bit of knowledge gleaned from social media and other public documents, running CUPP in the user interactive mode allows an interview-style approach to creating a custom password list.
The example above produced 14,301 words in our test file, which is a great start, but nowhere near enough to wage an effective brute-force attack. However, we can use this output to use a more sophisticated wordlist creator called a word mangler to apply certain rules to these initial seeds to make a much larger password list to pull from.
A word mangler creates new password guesses from a list of "seed" passwords, according to preset rules. This can be a very simple change, like applying a single change to the end of each seed password, or a more complex one, like adding every number from 0-9 to the end of each seed password. The latter would yield 10 new passwords guesses for every one password that goes into the program, so these lists can get large very quickly.
To manage these rules easily, we'll be using a graphical program called the Mentalist that will allow us to create a "chain" of these rules to apply to our seed password list. We can also throw in other seeds besides our password list, like the words in the English dictionary. In general, the major "nodes" that can be applied to the base word list will append, prepend, change the case, or substitute letters from the words passed through them.
As you can see in the example below, applying only a few rules to the chain can lead to a huge increase in the size of your password list. This isn't necessarily good, as we'll need to to have a processor capable of actually chewing threw these password guesses. This password list of over a billion guesses is probably overkill. The size of the list depends on the number and type of nodes you apply, but we'll go through each of them.
The Mentalist is easy to run even for absolute beginners, so we can download it for Windows, macOS, or Linux. To do so, you can head to the download link on GitHub and select the version that matches your operating system. After downloading it, install the application following the on-screen prompts, then open the Mentalist.
To create our seed list, we'll use CUPP. Aside from making sure you have Python installed and updated on your computer, it shouldn't require additional dependencies to run. You can download CUPP by running the following in a terminal window.
git clone github.com/Mebus/cupp.git
Once you've downloaded CUPP, you'll be ready to use the data you've gathered on a target to generate a custom list. Navigate to the directory CUPP was cloned into by typing cd CUPP into your terminal window. Next, type python ./cupp.py -i to run CUPP in the interactive-user mode.
You'll see a series of prompts asking for information about the target. If you don't know, you can skip the particular question, but it's best to answer as many questions as you can find the information for.
Once you enter the information you know, you'll be given the opportunity to add additional keywords you know about the target that can be thrown into the mix. At this point, you can also select the option to add special characters at the end of a password guess or add random numbers at the end. Finally, if your target thinks using leetspeak is clever, you can select a substitution rule that will convert password guesses to 1337 formatting.
Once this is complete, the output should be a text file with thousands of password guesses. While this is a great start, it's time to expand our guesses with the Mentalist.
To get started, open the Mentalist application you downloaded and installed previously. Once you see the GUI window, click on the plus in the "Base Words" node, and you'll see the option to add a custom file. Select "Custom File," and then open the TXT file we created with CUPP. We can also delete the English dictionary default node by clicking the minus button to the right of it.
Once we have the base words added from CUPP, we can start adding our word mangling nodes. To create a chain, we will need to apply all of the rules we'd like to apply to our password guesses in sequence. We can explore the four main types of nodes we can add by clicking on the plus button in the top-right corner. This will give us a list of case modification, substitution, prepend, or append.
For our first node, we can apply a "Case" node to modify the case of our generated password guesses. Once we select the node, we can click the plus button next to the node we created to see a list of options. We have the ability to modify uppercase or lowercase in different ways. Here, we'll set the first letter to uppercase, and all following letters to lowercase. Since this operation only creates one output per word from our base list, you won't see the size of the wordlist file change yet.
Next, we can add a "Substitution" node by clicking the plus icon in the top-right corner again. This will give us the option to substitute letters, and in this case, we'll choose to substitute the letters "i" and "a" for their leetspeak counterpart.
Next, we can add a "Prepend" node, which will add something to the beginning of each password guess. By clicking the plus icon next to the node we created, we can do things like incorporate zip codes by city or state. This will increase the size of our file by creating many outputs for each base word that goes into the node.
Finally, we can add an "Append" node, which will put something at the end of our word guesses. By again clicking on the plus icon next to the node we created, we can see there are many options preinstalled for what we can add to our chain. In this case, I chose to add telephone area codes from the city of Los Angeles. This will increase our output even more, as for each guess passing into this node, there will be many outputs.
We've produced a wordlist with a lot of outputs! This file would be 8.3 GB of password guesses to save. While this may be fine for some scenarios, we can also compress this with the option to save these options instead as a set of rules to dynamically generate the same list with tools like Hashcat or John the Ripper. To save your wordlist as either a wordlist file or as a set of rules, click the "Process" icon in the top-right corner, and select if you'd like to output the wordlist or rules.
Once you save your final list, you've created a large, customized set of password guesses tailored to the individual user. This wordlist should be much more effective at brute-forcing a target you know more information about, and can benefit even more if you have examples of the password policy for the account you're trying to hack or a previously breached password.
These attacks target users who attempt to create stronger passwords using details around them that can be easily memorized. By using details like names of pets or family, significant dates, or another password "seeds" that can be researched, a word mangler can create many different variations using the same seed, increasing the likelihood of brute-forcing the password.
To defend against this, users should never pick a password derived from easily researched details, especially if adding a number or modifying the case is the only thing modifying it. Instead, pick an acronym for a long phrase you can remember, or use a password manager to generate a completely random and secure password. By using a password manager, you can sidestep needing to always remember your password in the first place.
Creating a custom password list of several million potential guesses based on details about the target is easy and requires only a small amount of research. I hope this guide has given you a window into the science of password cracking, and encourage you to explore how much further you can go with increasing the performance of brute-force attacks.
If you have any questions or comments, feel free to leave a comment or reach me on Twitter @KodyKinzie.
Want to start making money as a white hat hacker? Jump-start your hacking career with our 2020 Premium Ethical Hacking Certification Training Bundle from the new Null Byte Shop and get over 60 hours of training from cybersecurity professionals.
Other worthwhile deals to check out: