Given $c' = \operatorname{HMACSHA512}(k, a\ ||\ b\ ||\ c\ ||\ d)$ and the 32-bit integers $a$, $b$, $c$, and $d$ is it feasible to alter $b$ and produce a valid MAC under the unknown key?

I understand that typically it wouldn't be, but I am mostly wondering if it's possible with 4 small independent inputs being used.

Would it change anything if I could observe many MACs over time with all variables constant except one?

  • $\begingroup$ It works fine in your case, since a,b,c,d are all fixed length (even all-but-one of them being fixed-length would suffice), but in general, concatenation does not necessarily suffice, since for example ​ ​ ​ 01 || 0 ​ = ​ 0 || 10 ​ ​ . ​ ​ ​ ​ ​ ​ ​ ​ $\endgroup$ – user991 Mar 11 '16 at 1:16
  • $\begingroup$ @RickyDemer Indeed! I noticed that this would pose a problem for a different thing I was working on. Someone recommended using a separator value like a comma. $\endgroup$ – Michael J. Gray Mar 11 '16 at 1:18
  • $\begingroup$ Another option is using a prefix-free code. ​ ​ $\endgroup$ – user991 Mar 11 '16 at 1:21

Is is feasible to alter b and produce a valid MAC under the unknown key?

We most certainly hope not. The fundamental security property of a MAC is that, even if that attacker can get a huge number of valid (Message, MAC) pairs (where he gets to choose the messages), he still is unable to generate a MAC for a message he has not seen. This fundamental property doesn't change just because the inputs are 'small'.

We believe that HMAC-SHA512 is a secure MAC (assuming an unguessable key); hence we believe that it is secure in your case.

  • $\begingroup$ I assumed this was the case. I figured it would not make any difference if there were small independent variables in the message that were changing in minor ways versus the message changing completely. $\endgroup$ – Michael J. Gray Mar 10 '16 at 19:17

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.