Coding Challenge " Password Cracker "

This challenge is to build your own version of John the Ripper or CrackStation. These are password cracking tools that can be used to recover passwords, by penetration testers and of course bad guys. We’re going to take a look at them because they provide an interesting way of learning several different things - you can pick and choose where you focus from the list: 🇦 How to implement cryptographic hash functions - you can build these by hand if learning how to code them interests you, otherwise you can use the ones available for your programming language. 🇧 How and why certain approaches to storing passwords are insecure so you have a better understanding of how to build a secure system and to securely store passwords for the systems that you develop. 🇨 How to build and optimise a computationally expensive piece of software. The Challenge - Building A Password Cracker The evolution of user authentication in multi-user systems has progressed from storing plaintext passwords, which were insecure, to using hashed passwords for improved security. However, with the growth in the number of users, the problem of weak passwords became apparent, as users tended to choose common and easily guessable passwords. Attackers exploited this by using techniques such as dictionary attacks and brute force attacks on hashes. To address this, more complex hash functions and longer passwords with a mix of case, numbers, and symbols were introduced. However, attackers adapted by using rainbow tables, which are pre-computed tables of common passwords and their corresponding hashes. To counteract this, new algorithms and the technique of salting, adding unique random data to each password before hashing, were implemented. The challenge at hand involves building a password cracker that incorporates these techniques to enhance security in the face of evolving attack methods. Steps in comments below
John the Ripper password cracker
A fast password cracker for Unix, macOS, Windows, DOS, BeOS, and OpenVMS
2 Replies
nour_oud
nour_oud4mo ago
Step Zero In many programming languages we index arrays from zero onwards. Coding Challenges is the same, we start with Step 0. It’s the step where you setup your IDE / editor of choice and programming language of choice. Depending on whether you’re going to aim for more of a John the Ripper or a CrackStation you might pick a stack like C, C++, Rust or Go versus a stack like PHP, Python or JavaScript. The choice is yours! Step 1 In this step your goal is to implement the MD5 hash function. By doing so you will have an awareness of how password hashes are generated. Wikipedia has an explanation of the MD5 algorithm. You can test your implementation against the implementation in your programming languages standard library. In the event that it doesn’t have support you can compare to this Python that you could run locally or on one of the online IDEs.
from hashlib import md5
print(md5(b'password').hexdigest())
from hashlib import md5
print(md5(b'password').hexdigest())
Step 2 In this step your goal is to crack an MD5 password by brute force. To do that you’ll want to generate all the possible permutations of valid password characters up to a predefined length, then hash them and compare to a pre-determined hashed password. As a test case try some four letter passwords and brute force them. Here’s a couple you could try:
7a95bf926a0333f57705aeac07a362a2
08054846bbc9933fd0395f8be516a9f9
7a95bf926a0333f57705aeac07a362a2
08054846bbc9933fd0395f8be516a9f9
This is the equivalent of incremental mode in John the Ripper.
MD5
The MD5 message-digest algorithm is a widely used hash function producing a 128-bit hash value. MD5 was designed by Ronald Rivest in 1991 to replace an earlier hash function MD4, and was specified in 1992 as RFC 1321. MD5 can be used as a checksum to verify data integrity against unintentional corruption. Historically it was widely used as a cry...
nour_oud
nour_oud4mo ago
Step 3 In this step your goal is to use a word list to speed up the attack. Instead of generated every single possible permutation of letters we’ll use a word list of common passwords. You can get one such list from CrackStation here. Grab the Smaller Wordlist for now. Adapt your program to allow the user to specify whether to brute force or use a word list, allowing them to specify the path to the word list. See how quickly you can crack this hash: 2bdb742fc3d075ec6b73ea414f27819a Step 4 In this step your goal is to build your own rainbow table. A rainbow table is a set of pre-computed hashes. For this process you can read in the word list and/or generate all the possible permutations of valid password characters up to a set length, then compute the hash for them. Save that hash and the input ‘password’ used to generate the hash to a file. Step 5 In this step your goal is to crack an password using the rainbow table. Simply put, your code will now read in the pre-computed rainbow table and look up the hash to ‘crack’ in it. Step 6 (Bonus) In this step your goal is to add support for other common cryptographic hashing functions. After than read up on and learn about salting and key derivation functions (KDF).