I'm just curious as to if this is possible or not?

  • 2
    shattered.io – kelalaka Mar 14 at 23:59
  • If they can modify the reference hash as well, then yes. – eckes Mar 15 at 2:53

Not for any well-known hashes, not even the extremely broken MD5. You're describing a second preimage attack, but virtually every hash known to be "broken" is only vulnerable to collision attacks.

Caveat: if the attacker had any control over the "good" data, then they could use a collision attack to accomplish this.


Cryptographic hash vs ordinary hash functions

There are all kinds of hash functions, used (for example) in error correcting codes and hash table data structures, and for many of them it is possible to do so

However, for cryptographic hash functions that is unacceptable. If it turns out that for a particular function it's actually possible to do so, then we'd consider it "broken" and not suitable for use as a cryptographic hash. So for all currently accepted cryptographic hash functions (which IMHO don't include MD5 anymore) we believe that an attacker can't modify data in an undetectable way.

It is theoretically possible that a highly advanced attacker has found out some mathematical vulnerability that allows them to do so for a particular hash. Perhaps NSA knows a particular way how SHA3 is broken, and in that case they might be able to do so; but as to the best of our knowledge that isn't currently possible.

  • Not the downvoter, but I don't think anyone would disagree that MD5 shouldn't be considered a secure cryptographic hash anymore (or SHA1 for that matter), but MD5 is still secure against preimages, as Joseph Sible points out. – AndrolGenhald Mar 19 at 13:23

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.