Cracking the Hashes
Hack Responsibly.
Always ensure you have explicit permission to access any computer system before using any of the techniques contained in these documents. You accept full responsibility for your actions by applying any knowledge gained here.
Password Hashes
Identifying Hashes
Find the type of hash:
Find hash type at https://hashkiller.co.uk
Running john
with no parameters will attempt to tell you the hash type:
Hash Cracking
Hashcat basic syntax:
John the Ripper basic syntax:
Convert hashes from /etc/shadow
to a crackable format (then use john to crack):
/etc/shadow
to a crackable format (then use john to crack):Generating wordlists
Online rainbow tables:
https://crackstation.net/
http://www.cmd5.org/
https://hashkiller.co.uk/md5-decrypter.aspx
https://www.onlinehashcrack.com/
http://rainbowtables.it64.com/
http://www.md5online.org
https://www.cmd5.org/
http://hashes.org
https://gpuhash.me/
https://crack.sh/
https://hash.help/
https://passwordrecovery.io/
http://cracker.offensive-security.com/
https://md5decrypt.net/en/Sha256/
https://weakpass.com/wordlists
Hashcat Cheatsheet
Hashcat Cheatsheet for OSCP https://hashcat.net/wiki/doku.php?id=hashcat
Identify Hashes
hash-identifier
Example Hashes: https://hashcat.net/wiki/doku.php?id=example_hashes
MOAR POWAR!
I have found that I can squeeze some more power out of my hash cracking by adding these parameters:
These will force Hashcat to use the CUDA GPU interface which is buggy but provides more performance (–force) , will Optimize for 32 characters or less passwords (-O) and will set the workload to "Insane" (-w 4) which is supposed to make your computer effectively unusable during the cracking process. Finally "--opencl-device-types 1,2 " will force HashCat to use BOTH the GPU and the CPU to handle the cracking.
Using a dictionary
Hashcat example: cracking Linux md5crypt passwords (identified by $1$) using a wordlist:
hashcat --force -m 500 -a 0 -o $out_cracked_passes $hash_file $pass_list
Hashcat example cracking WordPress passwords using a wordlist: hashcat --force -m 400 -a 0 -o $out_cracked_passes $hash_file $pass_list
Sample Hashes http://openwall.info/wiki/john/sample-hashes
One Rule to Rule Them All
@NotSoSecure has built a custom rule that combines many of the most popular Hashcat rules: https://www.notsosecure.com/one-rule-to-rule-them-all/
The rule can be downloaded from GitHub: https://github.com/NotSoSecure/password_cracking_rules
Put the OneRuleToRuleThemAll.rule
file into the /usr/share/hashcat/rules/
folder and run it:
Using Hashcat for brute-forcing
Predefined character sets:
?u?l?d is the same as: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
Brute-force all passwords of length 1-8 with these possible characters: A-Z a-z 0-9 hashcat -m 500 $hash_file -a 3 --increment -1 ?l?d?u ?1?1?1?1?1?1?1?1
Cracking Linux Hashes from /etc/shadow
file
/etc/shadow
fileCracking Windows Hashes
Cracking Common Application Hashes
Cracking Common File Password Protections
Cracking Commmon Database Hash Formats
Cracking NTLM hashes
After grabbing or dumping the NTDS.dit
and SYSTEM
registry hive or dumping LSASS memory from a Windows machine:
Using Impacket
to dump the hashes:
You can crack the NTLM hash dump usign the following hashcat syntax:
Cracking KRB5TGS Hashes - "Kerberoasting"
A service principal name (SPN) is a unique identifier of a service instance. SPNs are used by Kerberos authentication to associate a service instance with a service logon account. This allows a client application to request that the service authenticate an account even if the client does not have the account name. These SPNs cat be collected by using a username list and Impacket's example scripts. After gathering a list of valid usernames that have the property ‘Do not require Kerberos pre-authentication’ set (UF_DONT_REQUIRE_PREAUTH), you can get the SPN hash for cracking, replay, or creating of Kerberos tickets using the example below.
Hashcat supports multiple versions of the KRB5TGS hash which can easily be identified by the number between the dollar signs in the hash itself.
13100 - Type 23 - $krb5tgs$23$
19600 - Type 17 - $krb5tgs$17$
19700 - Type 18 - $krb5tgs$18$
KRB5TGS Type 23 - Crackstation humans only word list with OneRuleToRuleThemAll mutations rule list.
To crack Linux hashes with John you must first unshadow
them
unshadow
themCrack a zip password
zip2john Zipfile.zip | cut -d ':' -f 2 > hashes.txt
hashcat -a 0 -m 13600 hashes.txt /usr/share/wordlists/rockyou.txt
Hashcat appears to have issues with some zip hash formats generated from zip2john. You can fix this by editing the zip hash contents to align with the example zip hash format found on the hash cat example page: $zip2$*0*3*0*b5d2b7bf57ad5e86a55c400509c672bd*d218*0**ca3d736d03a34165cfa9*$/zip2$
John seems to accept a wider range of zip formats for cracking.
John the ripper: john --wordlist=/usr/share/wordlists/rockyou.txt <hash_file>
Jumbo John = Better than original john
Hashes.org: large database of pre-cracked hashes
Many password lists to download at skullsecurity
21.1GB wordlist of passwords! (Smaller samples available too) https://md5decrypt.net/en/Password-cracking-wordlist-download/
Hash formats list for hashcat
Brute-force crack password with known format:
Create wordlist of 'words' with known character-set & length:
Generate password for insertion directly into /etc/passwd
(assumes write privilege to that file):
/etc/passwd
(assumes write privilege to that file):Custom Code Examples
Decrypt LDAP Passwords
https://dotnetfiddle.net/2RDoWz
Decodes to: w3lc0meFr31nd
If you like this content and would like to see more, please consider buying me a coffee!
Last updated