Follow us on Twitter!
Don't judge the unknown - Grindordie
Wednesday, April 16, 2014
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Members Online
Total Online: 10
Guests Online: 10
Members Online: 0

Registered Members: 82800
Newest Member: santana1744
Latest Articles

Breaking the Code

Arrow Image MD5 Collisions and how to Form Them

Before I begin, I would like to mention that HBH does not allow formatting for articles.
I recommend that you read the PDF version instead, which is available at: http://xxx/articles/md5_collisions/article.pdf

The Message Digest 5 algorithm, more widely known as MD5, was first developed by RSA Laboratories around 1991. The purpose was to Ã¢â‚¬ËœFingerprint&#39;, or give a signature to documents and other extended texts, this would aid in the verification of those documents and could be used in court to prove a document was authentic (or fake) because the fingerprint matched (or didn&#39;t) when the document was encrypted using the MD5 algorithm.

However, this encryption method ultimately became most popular in the encryption of users&#39; passwords on various websites. Since the encryption was intended for lengthy documents and to serve only as a fingerprint, it was developed so that encrypting certain text would always return the same result. This was sufficient for long documents, but when the encryption was used for user passwords that were usually between 4 and 8 characters long, it began to pose a problem and became a threat to many websites that contained sensitive data.

Currently, the only known way to Ã¢â‚¬Ëœreverse&#39;, or break an MD5 is to form a collision. This is when a number of possible passwords are encrypted and checked against the MD5 hash being attacked eventually resulting in some plaintext that when encrypted matches the MD5 hash. The two most popular ways of doing this are by brute-force, which is trying every possible combination of a string with a given length and charset (creating permutations of the string), and by a dictionary attack, where a list of words, usually stored in a text file, is checked against the MD5 hash at hand.

For the purpose of this article, the hashes Ã¢â‚¬Ëœ098f6bcd4621d373cade4e832627b4f6&#39; and Ã¢â‚¬Ëœ5f4dcc3b5aa765d61d8327deb882cf99&#39; will be used. A MD5 hash will always be 32 characters in length and only consists of the characters (charset) a-f and 0-9 (hex).

The first method mentioned, brute-force, could easily be used on the first hash. The first thing we need to do would be to determine a charset and possible lengths which we believe the plaintext could be. The most common charset is alphanumeric, or a-z and 0-9, while the most common lengths of the plaintext are 1-8 (we will use 1-4 since the plaintext is known to me). Next, we will need to develop a program (using pre-made programs without understanding them is just cheating yourself.). The easiest language [for me] to write the program in would be PHP, it is somewhat slower than C++ but you don&#39;t need to compile any libraries for the MD5 Algorithm since it already comes as a pre-installed function. Here is an application that I have already coded, feel free to use it and modify it, as long as you don&#39;t remove the copyright and use it for personal use only:

Original Version:
Original, but Commented; more for beginners:

I recommend creating a batch file to run the script since it will display the text in real-time, however using a browser will work fine. This attack should reveal that the first hash resolves to the plaintext Ã¢â‚¬Ëœtest&#39;, however the second one is still unknown so we will try a dictionary attack.

The number of possible combinations during a brute-force attack can be shown with the equation:

sum = 0;
for(i = m; i &lt;= n; i++)
sum += pow(c, i);

(actual equation shown in PDF file)

Where Ã¢â‚¬Ëœc&#39; is the length of the charset (ex.: a-z 0-9 would be 36), Ã¢â‚¬Ëœm&#39; is the minimum length to brute-force, and Ã¢â‚¬Ëœn&#39; is the maximum length to brute-force. For example, a charset with the length of 36 and brute forcing from 1 character to 4 characters would be written as:
(36^1)+(36^2)+(36^3)+(36^4) = 1,727,604 possible combinations

A brute-force attack creates permutations of a string with a given charset and length, and will look something like this:
ID Plaintext MD5 Checksum (Hash)
1 aaaa 74b87337454200d4d33f80c4663dc5e5
2 aaab 4c189b020ceb022e0ecc42482802e2b8
3 aaac 3963a2ba65ac8eb1c6e2140460031925
4 aaad aa836f154f3bf01eed8df286a1fbb388
5 aaae 5f83cfb6ca6b50d3323a6377e1241b1f
6 aaaf 14acbed198e2456a400321cd9b065ce3
7 aaag 3e748489ace6f479f60ef30370220312
8 aaah d5096c66e84d7126564012fb76dbb47c
9 aaai 7cf9ef6f440fb8c7a377a60784d56156
10 aaaj bde5d54113c8ea8c6914f5aaee97fdf4

For a dictionary attack, you will need a wordlist containing a list of plaintext strings, this is usually a list common passwords. You will also need a method to read the wordlist and check the strings in the wordlist against the MD5 hash(es) you&#39;re trying to find a collision for.

Here is an example wordlist:
And here is some example code written in PHP to read the wordlist:

Using a wordlist is much faster than brute force since there is a set number of hashes possible to try, therefore I would recommend attempting a dictionary attack before a brute-force attack. The larger the wordlist is, the higher the chance of finding the plaintext is, but that also means the attack will take longer.

If you like, you may try adding alterations to the words in the dictionary, this will result in a higher success rate for finding collisions. This would be doing things such as adding suffixes to the string such as 0 through 100, turning the word into Ã¢â‚¬Ëœl33t speak&#39;, capitalizing the word (MD5 encrypts case-sensitive), and reversing the string.

Using the script and wordlist above will reveal that the second hash that couldn&#39;t be brute forced resolves to Ã¢â‚¬Ëœpassword&#39;.

A dictionary attack reads a prepared list of strings and checks the MD5 hash against a given list, it will look something like this:
ID Plaintext MD5 Checksum (Hash)
1 abbonerei 418d9dce69dbdcec3e2a09d38e3e9709
2 abboneremo bee24629ee0ef1930021bb0eea510cb1
3 abbonerete a7228dad3682ea9a75b7525b01ba6e3b
4 abbonero 594bd7832c0e86658249188fa1cd9717
5 abboni 867a268217a878a50bc06f19e2782394

In summation, finding collisions for MD5 hashes has become quite easy and perhaps it is time for a new form of encryption for user passwords. I hope that this article has enlightened you on how the plaintext of MD5 hashes can be found and that you will think twice before signing up for websites with passwords that can easily be found in a dictionary or brute-forced.

- P.S.: I have created a form of a dictionary attack (actually it&#39;s in the form of an n-ary tree, but very similar to a dictionary attack) that you may use if you wish, simply instant message Ã¢â‚¬ËœMD5 Library&#39; on AIM with a hash.


wolfmankurdon April 21 2006 - 19:38:59
Could you write an article on the bot and such?
Jakeon April 21 2006 - 19:41:07
I thought about it, but decided not to. If you have any questions about the bot, just ask me directly.
AldarHawkon April 21 2006 - 19:43:50
Awsome Article Jake, well written. 10/10
thk-h3xon April 21 2006 - 23:32:08
Nice one!
pyrodude0303on April 22 2006 - 03:42:39
Nice, i'd still rate it a 8/10
system_meltdownon April 22 2006 - 15:17:20
Excellent article mate!
The_Cellon April 23 2006 - 18:25:57
Great job!
system_meltdownon April 25 2006 - 15:56:50
Who rated this article poor, that's well out of order, this article is great
cubeman372on April 25 2006 - 16:09:19
Extremely Informative article Jake, and I am MD5 Libraries biggest fan!Grin
Stumpon September 18 2006 - 19:25:58
Your'e a real :ninja:
SLAUGHTERH8-biton February 12 2007 - 09:11:46
nice article:happy: but your url sent me to a porn site ??? hahaha
Post Comment

