☑️John-The-Ripper

John the Ripper (JTR or john) is an essential pentesting tool used to check the strength of passwords and crack encrypted (or hashed) passwords using either brute force or dictionary attacks. It is open-source software initially developed for UNIX-based systems and first released in 1996. It has become a staple of security professionals due to its various capabilities. The "Jumbo" variant is recommended for those in the security field, as it has performance optimizations and additional features such as multilingual word lists and support for 64-bit architectures. This version is more effective in cracking passwords with greater accuracy and speed.

Encryption Technologies

Encryption Technology

Description

UNIX crypt(3)

Crypt(3) is a traditional UNIX encryption system with a 56-bit key.

Traditional DES-based

DES-based encryption uses the Data Encryption Standard algorithm to encrypt data.

bigcrypt

Bigcrypt is an extension of traditional DES-based encryption. It uses a 128-bit key.

BSDI extended DES-based

BSDI extended DES-based encryption is an extension of the traditional DES-based encryption and uses a 168-bit key.

FreeBSD MD5-based (Linux & Cisco)

FreeBSD MD5-based encryption uses the MD5 algorithm to encrypt data with a 128-bit key.

OpenBSD Blowfish-based

OpenBSD Blowfish-based encryption uses the Blowfish algorithm to encrypt data with a 448-bit key.

Kerberos/AFS

Kerberos and AFS are authentication systems that use encryption to ensure secure entity communication.

Windows LM

Windows LM encryption uses the Data Encryption Standard algorithm to encrypt data with a 56-bit key.

DES-based tripcodes

DES-based tripcodes are used to authenticate users based on the Data Encryption Standard algorithm.

SHA-crypt hashes

SHA-crypt hashes are used to encrypt data with a 256-bit key and are available in newer versions of Fedora and Ubuntu.

SHA-crypt and SUNMD5 hashes (Solaris)

SHA-crypt and SUNMD5 hashes use the SHA-crypt and MD5 algorithms to encrypt data with a 256-bit key and are available in Solaris.

...

and many more.

Attack Methods

Dictionary

Dictionary attacks involve using a pre-generated list of words and phrases (known as a dictionary) to attempt to crack a password. This list of words and phrases is often acquired from various sources, such as publicly available dictionaries, leaked passwords, or even purchased from specialized companies.

Brute Force

Brute force attacks involve attempting every conceivable combination of characters that could form a password. This is an extremely slow process, and using this method is typically only advisable if there are no other alternatives.

Rainbow Table Attacks

Rainbow table attacks involve using a pre-computed table of hashes and their corresponding plaintext passwords, which is a much faster method than a brute-force attack. However, this method is limited by the rainbow table size – the larger the table, the more passwords, and hashes it can store. Additionally, due to the nature of the attack, it is impossible to use rainbow tables to determine the plaintext of hashes not already included in the table. As a result, rainbow table attacks are only effective against hashes already present in the table, making the larger the table, the more successful the attack.

Cracking Methods

Single Crack Mode

Single Crack Mode is one of the most common John modes used when attempting to crack passwords using a single password list.

If we have a file named hashes_to_crack.txt that contains SHA-256 hashes, the command to crack them would be:

When we run the command, John will read the hashes from the specified file, and then it will try to crack them by comparing them to the words in its built-in wordlist and any additional wordlists specified with the --wordlist option. Additionally, It will use any rules set with the --rules option (if any rules are given) to generate further candidate passwords.

John will output the cracked passwords to the console and the file "john.pot" (~/.john/john.pot) to the current user's home directory. Furthermore, it will continue cracking the remaining hashes in the background, and we can check the progress by running the john --show command. To maximize the chances of success, it is important to ensure that the wordlists and rules used are comprehensive and up to date.

Different Hash Formats Supported By JTR

Hash Format

Description

afs

AFS (Andrew File System) password hashes

bfegg

bfegg hashes used in Eggdrop IRC bots

bf

Blowfish-based crypt(3) hashes

bsdi

BSDi crypt(3) hashes

crypt(3)

Traditional Unix crypt(3) hashes

des

Traditional DES-based crypt(3) hashes

dmd5

DMD5 (Dragonfly BSD MD5) password hashes

dominosec

IBM Lotus Domino 6/7 password hashes

EPiServer SID hashes

EPiServer SID (Security Identifier) password hashes

hdaa

hdaa password hashes used in Openwall GNU/Linux

hmac-md5

hmac-md5 password hashes

hmailserver

hmailserver password hashes

ipb2

Invision Power Board 2 password hashes

krb4

Kerberos 4 password hashes

krb5

Kerberos 5 password hashes

LM

LM (Lan Manager) password hashes

lotus5

Lotus Notes/Domino 5 password hashes

mscash

MS Cache password hashes

mscash2

MS Cache v2 password hashes

mschapv2

MS CHAP v2 password hashes

mskrb5

MS Kerberos 5 password hashes

mssql05

MS SQL 2005 password hashes

mssql

MS SQL password hashes

mysql-fast

MySQL fast password hashes

mysql

MySQL password hashes

mysql-sha1

MySQL SHA1 password hashes

NETLM

NETLM (NT LAN Manager) password hashes

NETLMv2

NETLMv2 (NT LAN Manager version 2) password hashes

NETNTLM

NETNTLM (NT LAN Manager) password hashes

NETNTLMv2

NETNTLMv2 (NT LAN Manager version 2) password hashes

NEThalfLM

NEThalfLM (NT LAN Manager) password hashes

md5ns

md5ns (MD5 namespace) password hashes

nsldap

nsldap (OpenLDAP SHA) password hashes

ssha

ssha (Salted SHA) password hashes

NT

NT (Windows NT) password hashes

openssha

OPENSSH private key password hashes

oracle11

Oracle 11 password hashes

oracle

Oracle password hashes

pdf

PDF (Portable Document Format) password hashes

phpass-md5

PHPass-MD5 (Portable PHP password hashing framework) password hashes

phps

PHPS password hashes

pix-md5

Cisco PIX MD5 password hashes

po

Po (Sybase SQL Anywhere) password hashes

rar

RAR (WinRAR) password hashes

raw-md4

Raw MD4 password hashes

raw-md5

Raw MD5 password hashes

raw-md5-unicode

Raw MD5 Unicode password hashes

raw-sha1

Raw SHA1 password hashes

raw-sha224

Raw SHA224 password hashes

raw-sha256

Raw SHA256 password hashes

raw-sha384

Raw SHA384 password hashes

raw-sha512

Raw SHA512 password hashes

salted-sha

Salted SHA password hashes

sapb

SAP CODVN B (BCODE) password hashes

sapg

SAP CODVN G (PASSCODE) password hashes

sha1-gen

Generic SHA1 password hashes

skey

S/Key (One-time password) hashes

ssh

SSH (Secure Shell) password hashes

sybasease

Sybase ASE password hashes

xsha

xsha (Extended SHA) password hashes

zip

ZIP (WinZip) password hashes

Wordlist Mode

Wordlist Mode is used to crack passwords using multiple lists of words. It is a dictionary attack which means it will try all the words in the lists one by one until it finds the right one. It is generally used for cracking multiple password hashes using a wordlist or a combination of wordlists. It is more effective than Single Crack Mode because it utilizes more words but is still relatively basic. The basic syntax for the command is:

These rules generate candidate passwords using transformations such as appending numbers, capitalizing letters and adding special characters.

Incremental Mode

Incremental Mode is an advanced John mode used to crack passwords using a character set. It is a hybrid attack, which means it will attempt to match the password by trying all possible combinations of characters from the character set. This mode is the most effective yet most time-consuming of all the John modes. This mode works best when we know what the password might be, as it will try all the possible combinations in sequence, starting from the shortest one. This makes it much faster than the brute force attack, where all combinations are tried randomly. Moreover, the incremental mode can also be used to crack weak passwords, which may be challenging to crack using the standard John modes. The main difference between incremental mode and wordlist mode is the source of the password guesses. Incremental mode generates the guesses on the fly, while wordlist mode uses a predefined list of words. At the same time, the single crack mode is used to check a single password against a hash.

Using this command we will read the hashes in the specified hash file and then generate all possible combinations of characters, starting with a single character and incrementing with each iteration. It is important to note that this mode is highly resource intensive and can take a long time to complete, depending on the complexity of the passwords, machine configuration, and the number of characters set. Additionally, it is important to note that the default character set is limited to a-zA-Z0-9. Therefore, if we attempt to crack complex passwords with special characters, we need to use a custom character set.

Cracking Files

It is also possible to crack even password-protected or encrypted files with John. We use additional tools that process the given files and produce hashes that John can work with. It automatically detects the formats and tries to crack them. The syntax for this can look like this:

We can also include our personal wordlist. Here is the list of files options:

Tool

Description

pdf2john

Converts PDF documents for John

ssh2john

Converts SSH private keys for John

mscash2john

Converts MS Cash hashes for John

keychain2john

Converts OS X keychain files for John

rar2john

Converts RAR archives for John

pfx2john

Converts PKCS#12 files for John

truecrypt_volume2john

Converts TrueCrypt volumes for John

keepass2john

Converts KeePass databases for John

vncpcap2john

Converts VNC PCAP files for John

putty2john

Converts PuTTY private keys for John

zip2john

Converts ZIP archives for John

hccap2john

Converts WPA/WPA2 handshake captures for John

office2john

Converts MS Office documents for John

wpa2john

Converts WPA/WPA2 handshakes for John

Heres how to find them:

Last updated