resources:
Hashcat Wiki
oclHashcat Details
Mask Attack
Hybrid Attack
?l - lowercase letters - 26 possibilities - a - z
?u - uppercase letters - 26 possibilities - A - Z
?s - symbols - 35 possibilities - " - ~
?d - numbers - 10 possibilities - 0 - 9
The combination of your placeholders creates your mask. By using a mask instead of a dictionary you can thoroughly
attack a specific keyspace combination. The passwords we want to crack with a mask must match the specifications
of the placeholders, as well as the length of the mask itself.
?l?l?l?l aaaa --valid
abcd --valid
abc --invalid
A mask attack is ran in a very similar way to a dictionary attack, the attack mode simply needs to be
changed and the dictionary needs to be swapped with a mask.
./hashcat64.bin -m <hashing algo> -a 3 <file of hashes> <your mask>
In this way masks replace a dictionary file when using hashcat. Each string of numbers/letters/symbols is hashed and
compared, rather than each line of a word list.
For example, if you use your hash.sh script to create a SHA1 password with salt, you'd use the following commands to
create the hashed password file and to test the mask on the hashed password file:
./hash.sh sha1sum 3e 56 a9 89 1234 >> test_mask.hash ./hashcat64.bin -m 120 --hex-salt -a 3 test_mask.hash ?d?d?d?d
Password Mask File
PassWord ?l?l?l?l?l?l?l?l --will try all lowercase letters and fail
?u?l?l?l?l?l?l?l --will try an uppercase letter followed by lowercase letters and fail
?u?l?l?l?u?l?l?l --success
With these mask files effective groups of masks can be saved and reused many times. This can be extremely useful
when popular patterns in passwords are discovered. The convenience of these files can come at a steep price. Having a lengthy
mask file, or a mask file with numerous long masks, will lead to a massive increase in the number of hashes performed by
hashcat per password hash.
For example, if your mask file is called mask_list.txt, you'd use the following command:
./hashcat64.bin -m 120 --hex-salt -a 3 test_mask.hash mask_list.txt
Hashcat Arguments Output
-a 3 -1 ?l?d ?1?1?1?1 aaaa - zzzz
In this example the 2 placeholder mask ?l?d is being stored in 1. Now by using the custom charset 1 for the placeholder instead,
you can represent ?l?d.
Hashcat Arguments Output
?a?a?a ?l?u?d?s
?b?b?b 0x00 - 0xff
Taking a look at hashcat's ?a placeholder, you can see that it was implemented in much the same way. The lowercase, uppercase,
digit, and symbol placeholders can all be represented by this custom charset. The ?b placeholder is an often overlooked
placeholder as well, it can be used to represent hex numbers in a password.
Mask Incrementing Through Mask
?d?d?d?d?d ?d
?d?d
?d?d?d
?d?d?d?d
?d?d?d?d?d
This process elimates the problem of a mask having to fit the exact same length of a password, as long as the password
is smaller than the total size of your mask. The --increment flag is the most basic form of incrementing through your mask,
--increment-min and --increment-max can be used to hone in on a certain area.
Mask min=4, max=7
?u?l?l?d?d?d?d ?u?l?l?d
?u?l?l?d?d
?u?l?l?d?d?d
?u?l?l?d?d?d?d
By narrowing down the increment range, you drastically reduce the number of iterations your mask will go through, and thus
greatly reduce the number of hashes performed per password.
(1) What are some of the limitations of mask attacks?