John the Ripper (JtR) is one of the hacking tools the Varonis IR Team used in the first Live Cyber Attack demo, and one of the most popular password cracking programs out there. In this blog post, we are going to dive into John the Ripper, show you how it works, and explain why it’s important.
John the Ripper is an Open Source password security auditing and password recovery tool available for many operating systems. John The Ripper: Cracking a.DMG Let's cut to the chase right now: Cracking encrypted disk image, AKA DMG is feasible, but, and there are many buts, is extremely, extremely time consuming.
Notes about hacking: Hacking is a pursuit of knowledge about systems, design, and humans. In this case, we are talking about software and operating systems.
John The Ripper: Cracking a.DMG Let's cut to the chase right now: Cracking encrypted disk image, AKA DMG is feasible, but, and there are many buts, is extremely, extremely time consuming. John the Ripper is an actively developing program. John the Ripper (community jumbo version) comes with a lot of helper utilities. Among these utilities are programs for generating (extracting) a hash. This hash is used to crack the password in John the Ripper.
Get the Free Pen Testing Active Directory Environments EBook
Hacking is not necessarily criminal, although it can be a tool used for bad intentions. We advocate for ethical hacking. Stay in the light side of the Force.
How Does John the Ripper Work?
JtR supports several common encryption technologies out-of-the-box for UNIX and Windows-based systems. (ed. Mac is UNIX based). JtR autodetects the encryption on the hashed data and compares it against a large plain-text file that contains popular passwords, hashing each password, and then stopping it when it finds a match. Simple.
In our amazing Live Cyber Attack demo, the Varonis IR team demonstrates how to steal a hashed password, use JtR to find the true password, and use it to log into an administrative account. That is a very common use case for JtR!
JtR also includes its own wordlists of common passwords for 20+ languages. These wordlists provide JtR with thousands of possible passwords from which it can generate the corresponding hash values to make a high-value guess of the target password. Since most people choose easy-to-remember passwords, JtR is often very effective even with its out-of-the-box wordlists of passwords.
JtR is included in the pentesting versions of Kali Linux.
What is John the Ripper Used for?
JtR is primarily a password cracker used during pentesting exercises that can help IT staff spot weak passwords and poor password policies.
Here is the list of encryption technologies found in JtR:
- UNIX crypt(3)
- Traditional DES-based
- “bigcrypt”
- BSDI extended DES-based
- FreeBSD MD5-based (linux and Cisco IOS)
- OpenBSD Blowfish-based
- Kerberos/AFS
- Windows LM (DES-based)
- DES-based tripcodes
- SHA-crypt hashes (newer versions of Fedora and Ubuntu)
- SHA-crypt and SUNMD5 hashes (Solaris)
That’s the “official” list. JtR is open-source, so if your encryption of choice isn’t on the list do some digging. Someone might have already written an extension for it.
How to Download John the Ripper
JtR is an open-source project, so you can either download and compile the source on your own, download the executable binaries, or find it as part of a penetration testing package.
The official website for John the Ripper is on Openwall. You can grab the source code and binaries there, and you can join the GitHub to contribute to the project.
JtR is available on Kali Linux as part of their password cracking metapackages.
Tutorials for Using John the Ripper
We are going to go over several of the basic commands that you need to know to start using John the Ripper. To get started all you need is a file that contains a hash value to decrypt.
If you ever need to see a list of commands in JtR, run this command:
Cracking Passwords
John the Ripper’s primary modes to crack passwords are single crack mode, wordlist mode, and incremental. The single crack mode is the fastest and best mode if you have a full password file to crack. Wordlist mode compares the hash to a known list of potential password matches. Incremental mode is the most powerful and possibly won’t complete. This is your classic brute force mode that tries every possible character combination until you have a possible result.
The easiest way to try cracking a password is to let JtR go through a series of common cracking modes. This command below tells JtR to try “simple” mode, then the default wordlists containing likely passwords, and then “incremental” mode.
You can also download different wordlists from the Internet, and you can create your own new wordlists for JtR to use with the –wordlist parameter.
John The Ripper Mac Dmg Torrent
If you want to specify a cracking mode use the exact parameter for the mode.
Word Mangling Rules
Mangling is a preprocessor in JtR that optimizes the wordlist to make the cracking process faster. Use the –rules parameter to set the mangling rules.
Viewing Your Output
When you want to see the list of passwords that you have cracked, use the –show parameter.
If your cracked password list is long, you can filter the list with additional parameters. You can also redirect the output using basic redirection in your shell. For example, if you want to see if you cracked any root users (UID=0) use the –users parameter.
Or if you want to show users from privileged groups use –groups.
Below is the JtR command from our Live Cyber Attack Webinar. In this scenario, our hacker used kerberoast to steal a Kerberos ticket granting ticket(TGT) containing the hash to be cracked, which was saved in a file called ticket.txt. In our case, the wordlist used is the classic rockyou password file from Kali Linux, and the command was set to report progress every 3 seconds.
If you want to see some cool pentesting and defense tactics using Varonis, check out the Live Cyber Attack Webinars! Pick any time that works for you!
John The Ripper is a free and open-source software for fast password cracking. Cracking DMG, RAR and other types of passwords is made easier using magnumripper's 'jumbo' version of John The Ripper.
Install John
Install John The Ripper using brew
Find John The Ripper Utilities Folder
John comes with extra utilities to help generate hashes. By default brew
does not install/symlink john's extra utilities to the PATH folder /usr/local/bin
. The path can be found in a variety of ways:
- Using
ls
and following the path will eventually return/usr/local/Cellar/john-jumbo/1.9.0/share/john/
or similar:
- If you have
readlink
installed, it's even easier:
Generating Hashes
When cracking files, John cracks the hash of the password rather than the file itself. To generate the hash files, we use the extra utilities from the folder in the last step.
For DMG files, we'll pass the encrypted-files.dmg
file to the dmg2john
command and output the hash to a .hash
file.
The other tools available to generate hash files are:
- RAR:
rar2john_cmd
- PDF:
pdf2john.pl
- ZIP:
zip2john
- 7Z:
7z2john.pl
Crack the Hash
The last step is to crack the hash. We use the john
tool directly for this step.
To ensure the GPU instead of the CPU is doing the cracking, specify a format with -opencl
in its suffix. For example, dmg
will be significantly slower than using dmg-opencl
.
John The Ripper Mac Dmg Free
You can see the password above is abc_123
. If it's not clear you can run john --show encrypted-files.dmg.hash
to present it clearer.
To make things even faster, if you have an idea of what the password is, you can pass a regular expression to john using the --mask
flag.
Another thing I like to do at the end is remove the password on the DMG file and keep it empty:
Now when you open it, click the OK button.
Script
John The Ripper Download
To put all the above together, I use this script to set aliases to crack DMG files