SECURE ALGORITHMS Minding Your MAC Algorithms?
Total Page:16
File Type:pdf, Size:1020Kb
SECURE ALGORITHMS Abstract In spite of the advantages of digital signa- tures, MAC algorithms are still widely used to authenticate data; common uses include authorization of financial transactions, mo- bile communications (GSM and 3GPP), and authentication of Internet communications with SSL/TLS and IPsec. While some MAC algorithms are part of ‘legacy’ implementa- tions, the success of MAC algorithms is mainly due to their much lower computa- tional and storage costs (compared to digital signatures). This article describes a list of common pitfalls that the authors have en- countered when evaluating MAC algorithms deployed in commercial applications and pro- vides some recommendations for practitio- ners. Minding Your Introduction MAC Algorithms? MAC algorithms compute a short string as a complex function of a message and a secret key. In a communications setting, the sender will ap- Helena Handschuh pend the MAC value to the message (see also Gemplus, France Figure 1). The recipient shares a secret key with the sender. On receipt of the message, he recom- putes the MAC value using the shared key and Bart Preneel verifies that it is the same as the MAC value sent K.U.Leuven, Belgium along with the message. If the MAC value is cor- rect, he can be convinced that the message origi- nated from the particular sender and that it has not been tampered with during the transmis- sion. Indeed, if an opponent modifies the mes- sage, the MAC value will no longer be correct. Moreover, the opponent does not know the se- cret key, so he is not able to predict how the MAC value should be modified. The main security property of a MAC algorithm is that one should not be able to forge MAC val- ues, that is, to predict values on new messages without knowing the secret key. A second re- quirement is that it should be computationally infeasible to recover the MAC key by exhaustive search, since an exhaustive key search allows for arbitrary forgeries. Historically, the first commercial deployment of MAC algorithms was made by the financial sec- tor (wholesale and retail banking, including elec- tronic purses, debit and credit cards). On the Internet, MAC algorithms are used for authenti- cating data at the transport layer (TLS or Trans- port Layer Security, the successor to SSL) and at the network layer (IPsec, both in the AH and the ESP transforms). The GSM operators use a pro- prietary algorithm in the smart cards (SIMs or Subscriber Identification Modules) to authenticate the users. For 3rd generation systems (3GPP) the Milenage algorithm has been proposed as the ex- ample algorithm for user authentication; signal- Information Security Bulletin, July 2004 Volume 9, Page 213 Copyright ©2004 CHI Publishing Ltd - All rights reserved - Do not copy without written permission SECURE ALGORITHMS out, flaws are discovered One of the most important One of the most important which would have been identified immediately if functions of a cell is to functions of a cell is to the algorithms had been recruit other cells. One recruit other cells. One published before imple- member of each cell member of each cell mentation. This does not recruits a man outside, recruits a man outside, necessarily mean that all who will organise another who will organise another proprietary designs are cell, and so on. cell, and so on. flawed; numerous designs are based on sound pub- MAC MAC licly known building K K blocks such as AES or SHA-1, but security by ob- 21068204 21068204 scurity has rarely proven Identical? successful. As an example, 21068204 we consider two algo- rithms which leaked out Figure 1 - Using a MAC Algorithm for Data Authentication in the last years: alleged SecureID [5] and alleged Comp128 [9]. The first al- ling information is also authenticated using the gorithm is used for authenticating users to their KASUMI block cipher. corporate VPN. It computes a one-time pass- The most popular MAC algorithms are the vari- word as a MAC value on the current time using ants of CBC-MAC which are based on a block ci- a secret key. This MAC value is provided to the pher; in the past this has been mostly DES or tri- VPN server along with the username and pass- ple-DES. Currently AES is becoming more popu- word to open a secure session. The second algo- lar. Since the mid 1990s, constructions based on rithm is used in a challenge-response protocol to hash functions such as HMAC have been intro- authenticate a user to the GSM network. It de- duced on the Internet. All these algorithms have rives a MAC value from a random challenge pro- been included in a large number of standards vided by the network and a secret key stored in (IETF, FIPS, ANSI, ISO, ...); the most comprehen- the SIM card of the user. The MAC value is sent sive one is the 3-part standard IS 9797 published back to the network which verifies it before giv- by ISO/IEC [10]. ing access to the network. Both algorithms were cryptanalyzed immediately after publication; In the following, the key length in bits of a MAC they are both vulnerable to collision attacks. It algorithm is denoted with k and the length in takes a few hours only to recover the secret key bits of the MAC result is denoted with m. of a SIM card and a few months to find the key for a SecurID token. Therefore, secret designs should not be trusted unless sufficient independ- Common Pitfalls ent evaluation of the algorithms has been per- Throughout this paper, we analyze problems formed and documented. which we encountered while evaluating MAC algorithms. Several of these algorithms were Recommendation 2 flawed and as a result, we present simple recom- mendations on constructions that should be Don’t Use Short MAC Lengths avoided. The length in bits of a message authentication code is directly related to the number of trials Recommendation 1 that an adversary has to perform before a mes- Don’t Use Proprietary Algorithms Without sage (and its associated MAC value) is accepted. For a MAC value of bit-length m, the adversary Additional Evaluation has to perform on average 2m-1 random on-line Kerckhoffs’ principle, which dates back to the MAC verifications before his strategy succeeds. 19th century, states that the secrecy of a crypto- Therefore, MAC values of 16 bits require about graphic algorithm should only rely on the se- 32,000 trials, which is rather straightforward in a crecy of the key (and not on that of the algo- fully automated setting (for example over the rithm itself). Nevertheless, it is a common belief Internet). Hence, 16-bit MAC values should not in industry that cryptographic algorithms should be used. The minimum reasonable length for a be kept secret. While this might be the only solu- MAC is 32 bits; this corresponds to about 2 bil- tion for constrained environments in which lion or2x109 trials. For high value applications there are insufficient resources to deploy stan- 64 bits are more appropriate. dard cryptographic algorithms (for example not enough gates for hardware designs or memory Recommendation 3 cells for embedded devices), most secret designs are far less secure than published algorithms. Don’t Use Single DES Or Short Keys Many proprietary designs have not been sub- Another common pitfall is to use strong publicly jected to extensive cryptanalysis; when they leak known algorithms with too short keys. For ex- Volume 9, Page 214 Information Security Bulletin, July 2004 Copyright ©2004 CHI Publishing Ltd - All rights reserved - Do not copy without written permission SECURE ALGORITHMS ample the use of truncated 40-bit keys or even where H0 represents a fixed public initial value single DES, which has a 56-bit key, are strongly and the hash value h(M)=Ht. If an iterated hash discouraged. Ten years ago a 56-bit key would function is used and the key K is prepended to have offered adequate protection for low-secu- the message M, i.e., the MAC value is given by rity applications. However, today it is vulnerable MAC = h(KyM) where y is the symbol for con- to straightforward exhaustive search attacks, in catenation, then it is straightforward to compute which an attacker simply tries out every possible the MAC of a different message MyM’ from value for the key and compares the computation MAC as follows: results to the valid MACs available to him. For a y y key of bit-length k,2k-1 trials on average are re- MAC’ = h(K M M’) = f(MAC,M’) quired to find the correct key. The current re- Note that one does not need to know the secret cord for exhaustive key search is less than a day key to perform this computation, which shows for a single 56-bit DES key on specialized hard- that this method is not secure. Truncating the ware combined with additional distributed com- MAC to fewer bits than the output length of the puting. With a US$1 million key search machine, hash function might help, but the security of this a DES key could be recovered in about 1 minute, scheme remains doubtful. It has been shown which means that the cost per key is about US$1 that even a construction which computes a MAC [22]. For this reason it is recommended that keys on message M with key K as h(KyMyK) may be of at least 80 bits should be used. An exhaustive 24 insecure [19, 20]; the attack does not violate the search for an 80-bit key would take 2 (about 16 security proof of [2], but illustrates its limitations million) times more effort, which in 2004 is out when key recovery attacks are considered.