-1
$\begingroup$

I've been studying the MD5 hashing algorithm, and there is something that I just don't understand yet. They say that the server holds some sort or "secret" and that it appends some sort of "message" (or "data") to that secret. Then, the algorithm adds the appropriate padding to the concatenated ("secret" + "data") and the process continues from there. Now, it is said that only the server knows the "secret", but an attacker would know the "data" as well as the signature (which is apparently the result that comes out of hashing ("secret + data")). Now, here is what I don't get:

Let's say we have a URL:

http://website.com/ABCDEFGHIJKLMNOP?parameter=something

Now, the ABCDEFGHIJKLMNOP part is the hashed part of this URL. Would it be correct to call that part the signature? If so, what exactly is the "data" that an attacker supposedly knows? Where in this URL is the "data" that was appended to the "secret"?

Also, why is "data" appended to the "secret" in the first place? Why isn't the "secret" just hashed by itself and kept hidden from an attacker instead of giving the attacker some apparently known "data"?

$\endgroup$
5
  • 2
    $\begingroup$ One thing is sure: MD5 itself does not suppose that anything is secret, nor does it specifies a "server" entity. MD5 is a fully public function that transforms a message (any bitstring up to some extremely large size) into a 128-bit bitstring. That the message is secret, or not, has nothing to do with MD5 itself. A sure thing is that if the hash is to be secret, at least some of the message must be. The question is about MD5 in some context that is currently unclear. The mention of "signature" suggests something more complex than HMAC or password hashing. We can't tel!! $\endgroup$
    – fgrieu
    Jul 20 at 15:59
  • 1
    $\begingroup$ A link to a resource that makes this claim would be helpful. As fgrieu says, the claim isn't true about MD5 per se, but it could be correct in a larger context. As for a url, the significance of the parts is up to the creator - you can't tell in general if there are hashes involved at all. And in any case, "the hashed part of the url" doesn't mean much. $\endgroup$
    – bmm6o
    Jul 20 at 16:33
  • 1
    $\begingroup$ @bmm6o Here is a link that mentions what I mean about the "secret" and the "data" and all of that: blog.skullsecurity.org/2012/… $\endgroup$
    – Rikudou
    Jul 20 at 17:25
  • 1
    $\begingroup$ @Rikudou That article is about attacking a badly-designed message authentication code (MAC) algorithm based on MD5 (or some other extendable hash). The "secret" and "data" parts come from it being used as a MAC, not from MD5 itself. $\endgroup$ Jul 20 at 18:02
  • $\begingroup$ In proper signature, there is a private key used to produce the signature, and a public key to verify the signature. Nothing such in the case at hand. $\endgroup$
    – fgrieu
    Jul 21 at 6:25
1
$\begingroup$

As indicated, this is about creating a $\operatorname{MAC}_k(m) = \operatorname{H}(k \| m)$ where $k$ is the key / secret and $m$ is the message / data.

Now, the ABCDEFGHIJKLMNOP part is the hashed part of this URL. Would it be correct to call that part the signature? If so, what exactly is the "data" that an attacker supposedly knows?

No, "ABCDEFGHIJKLMNOP" is the message data. The attacker knows it because it is plainly displayed in the URL.

Also, why is "data" appended to the "secret" in the first place? Why isn't the "secret" just hashed by itself and kept hidden from an attacker instead of giving the attacker some apparently known "data"?

Because the MAC is used to authenticate a message. If you just hash the secret then you could show that you have the key, but the data would be left unprotected.

In both cases you should still beware of replay attacks. However, that's another topic I suppose.

$\endgroup$
0

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.