Can anyone explain why CBC-MAC is not secure for variable length message?

I read many books, but there are still some confusion. Like the highlighted parts in following pictures

Slide 32: Slide 32

Slide 33: Slide 33

  1. First question, why need to set T"=C0?

  2. Second question which is biggest question i don't understand, why T"' = T". How to prove this relationship?

  3. Third question, why is new message = P0.P1.(P0 xor T')?

Can anyone help me. Thanks!


In its plain form, CBC-MAC is vulnerable to "length extension attack", where you just add some blocks at the end.

So in order to stop people from doing that, you need to somehow mark the final block as indeed the final block. And not treat it like any other block.

Wikipedia lists two ways: either prefix with block count, or encrypt final block with independent key (This is then known as "Encrypted CBC-MAC" or ECBC-MAC).

  • it sounds like prefixing with block count or length of input would work as well for SHA-1/2 – David 天宇 Wong Jun 22 '17 at 18:47

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.