Home
Writeups Misc About
MD0

MD0

The code is vulnerable to hash length extension attack. The hash for a message with a new block appended can be computed from the hash of the old message, and xor with the result of encrypting the old hash with the key as the new block. Denote H as the old hash, H as the new hash, the newly appended block as B, and encryption as E, we have the relation:

H=HE(H,B)

Hence the task is simply to reconstruct the correct state of the hash algorithm, then do a simple xor with the new block and we should obtain a valid hash. The padding is a bit tricky to get it correct, so I recommend testing the challenge code out locally first.

Python Implementation: