Hash Collision Attack

In cryptography, a collision attack on a cryptographic hash tries to find two inputs producing the same hash value, i.e. a hash collision.

A Collision Attack is an attempt to find two input strings of a hash function that produces the same hash result. Because hash functions have infinite input length and a predefined output length, there is inevitably going to be the possibility of two different inputs that produce the same output hash. If two separate inputs produce the same hash output, it is called a collision. This collision can then be exploited by any application that compares two hashes together – such as password hashes, file integrity checks, etc.

For example, let’s say we have a hypothetical hash function called “Hesh”. A collision attack would first start with a starting input value, and hash it.

Hesh(hello) = 89232323

Now the attacker needs to find a collision – a different input that generates the same hash as the previous input. This would generally be done through a brute-force method (trying all possible combinations) until one was found. Let’s say we found a collision for this input in our hypothetical hash function.


Hesh(asdfghjklzxcvbnmqwertyuiop) = 89232323

The attacker now knows two inputs with the same resulting hash. As an example for a practical use of this – if the attacker was offering a file download and showed the hash to prove the file’s integrity, he could switch out the file download but the hash would remain the same. The file would appear valid as it has the same hash as the supposed real file, but he could swap out the correct file for the collision instead, without it being obvious to the file validator.

So – are hash collisions realistically feasible? Yes, depending on the hash function. Md5 and even SHA-1 have been shown to not be very collision resistant – however SHA-256 and above seem to be safe at the current time. Here’s a visual example of what a collision attack might entail on an md5 hash. Can you figure out what this md5’s input was?

Comments

Popular posts from this blog

Location.Hash exploit || JQuery 1.11.3/1.7.2/1.6.1 Cross Site Scripting

JQuery UI 1.11.4 Cross Site Scripting

Bypass Mod_Security