CBC-MAC (2024)

In cryptography, a Cipher Block Chaining Message Authentication Code, abbreviated CBC-MAC, is a technique for constructing a message authentication code from a block cipher. The message is encrypted with some block cipher algorithm in CBC mode to create a chain of blocks such that each block depends on the proper encryption of the previous block. This interdependence ensures that a change to any of the plaintext bits will cause the final encrypted block to change in a way that cannot be predicted or counteracted without knowing the key to the block cipher.

To calculate the CBC-MAC of message CBC-MAC (1) one encrypts CBC-MAC (2) in CBC mode with zero initialization vector. The following figure sketches the computation of the CBC-MAC of a message comprising blocks CBC-MAC (3) using a secret key CBC-MAC (4) and a block cipher CBC-MAC (5):

File:CBC-MAC structure (en).svg

Contents

  • 1 Variable-length messages
  • 2 Using the same key for encryption and authentication
  • 3 See also
  • 4 References

Variable-length messages[]

Given a secure block cipher, CBC-MAC is secure for fixed-length messages. However, by itself, it is not secure for variable-length messages.An attacker who knows the correct message-tag (i.e. CBC-MAC) pairs CBC-MAC (6) CBC-MAC (7) and CBC-MAC (8) CBC-MAC (9) can generate a third message CBC-MAC (10) whose CBC-MAC will also be CBC-MAC (11). This is simply done by XORing the first block of CBC-MAC (12) with CBC-MAC (13) and then concatenating CBC-MAC (14) with this modified CBC-MAC (15), i.e. by making CBC-MAC (16).


This problem cannot be solved by adding a message-size block (e.g., with Merkle-Damgård strengthening) and thus it is recommended to use a different mode of operation, for example, CMAC to protect integrity of variable-length messages. Slatty

Using the same key for encryption and authentication[]

One common mistake is to reuse the same key CBC-MAC (17) for CBC encryption and CBC-MAC. Although a reuse of a key for different purposes is a bad practice in general, in this particular case the mistake leads to a spectacular attack. Suppose that one encrypts a message CBC-MAC (18) in the CBC mode using an CBC-MAC (19) and gets the following ciphertext: CBC-MAC (20), where CBC-MAC (21). He also generates the CBC-MAC tag for the IV and the message: CBC-MAC (22) Now an attacker can change every bit before the last block CBC-MAC (23) and the MAC tag still be valid. The reason is that CBC-MAC (24) (this is actually the reason why people make this mistake so often—it allows to increase the performance by a factor of two). Hence as far as the last block is not changed the equivalence CBC-MAC (25) holds and thus the CBC-MAC tag is correct.

This example also shows that a CBC-MAC cannot be used as a collision resistant one-way function: given a key it is trivial to create a different message which “hashes” to the same tag.

See also[]

  • CMAC — A block-cipher–based MAC algorithm which is secure for messages of different lengths (recommended by NIST).
  • OMAC and PMAC — Other methods to turn block ciphers into message authentication codes (MACs).
  • One-way compression function - Hash functions can be made from block ciphers. But note, there are significant differences in function and uses for security between MACs (such as CBC-MAC) and hashes.
  • DAA — A (now obsolete) U.S. government standard instantiation of CBC-MAC.

References[]

  1. ISO/IEC 9797-2:2002
  2. The security of the cipher block chaining message authentication code.
Cryptography navbox
Block ciphers

fr:CBC-MACit:CBC-MAC

CBC-MAC (2024)
Top Articles
Latest Posts
Article information

Author: Msgr. Benton Quitzon

Last Updated:

Views: 6602

Rating: 4.2 / 5 (43 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Msgr. Benton Quitzon

Birthday: 2001-08-13

Address: 96487 Kris Cliff, Teresiafurt, WI 95201

Phone: +9418513585781

Job: Senior Designer

Hobby: Calligraphy, Rowing, Vacation, Geocaching, Web surfing, Electronics, Electronics

Introduction: My name is Msgr. Benton Quitzon, I am a comfortable, charming, thankful, happy, adventurous, handsome, precious person who loves writing and wants to share my knowledge and understanding with you.