Network Working Group V. Torvinen Internet-Draft J. Arkko Expires: April 28, 2005 M. Naslund Ericsson October 28, 2004 Hypertext Transfer Protocol (HTTP) Digest Authentication Using Authentication and Key Agreement (AKA) Version-2 draft-torvinen-http-digest-aka-v2-02.txt Status of this Memo This document is an Internet-Draft and is subject to all provisions of section 3 of RFC 3667. By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or she become aware will be disclosed, in accordance with RFC 3668. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt. The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft will expire on April 28, 2005. Copyright Notice Copyright (C) The Internet Society (2004). Abstract HTTP Digest as specified in [4] is known to be vulnerable to man-in-the-middle attacks if the client fails to authenticate the server in TLS, or if the same passwords are used for authentication in some other context without TLS. This is a general problem that exist not just with HTTP Digest but also with other IETF protocols Torvinen, et al. Expires April 28, 2005 [Page 1] Internet-Draft HTTP Digest AKAv2 October 2004 that use tunneled authentication. This document specifies version 2 of the HTTP Digest AKA algorithm [6]. This algorithm can be implemented in a way that it is resistant to the man-in-the-middle attack. Table of Contents 1. Requirements notation . . . . . . . . . . . . . . . . . . . . 3 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.1 Terminology . . . . . . . . . . . . . . . . . . . . . . . 4 3. HTTP Digest AKAv2 . . . . . . . . . . . . . . . . . . . . . . 6 3.1 Password generation . . . . . . . . . . . . . . . . . . . 6 3.2 Session keys . . . . . . . . . . . . . . . . . . . . . . . 7 4. Example Digest AKAv2 Operation . . . . . . . . . . . . . . . . 7 5. Security Considerations . . . . . . . . . . . . . . . . . . . 8 5.1 Multiple Authentication Schemes and Algorithms . . . . . . 8 5.2 Session Protection . . . . . . . . . . . . . . . . . . . . 8 5.3 Man-in-the-middle attacks . . . . . . . . . . . . . . . . 8 5.4 Entropy . . . . . . . . . . . . . . . . . . . . . . . . . 10 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 6.1 Registration Information . . . . . . . . . . . . . . . . . 11 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 11 7.1 Normative References . . . . . . . . . . . . . . . . . . . . 11 7.2 Informative References . . . . . . . . . . . . . . . . . . . 12 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . 12 Intellectual Property and Copyright Statements . . . . . . . . 14 Torvinen, et al. Expires April 28, 2005 [Page 2] Internet-Draft HTTP Digest AKAv2 October 2004 1. Requirements notation The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [3]. 2. Introduction The Hypertext Transfer Protocol (HTTP) Digest Authentication, described in [4], has been extended in [6] to support Authentication and Key Agreement (AKA) mechanism [8]. AKA mechanism performs authentication and session key distribution in Universal Mobile Telecommunications System (UMTS) networks. HTTP Digest AKA enables the usage of AKA as a one-time password generation mechanism for Digest authentication. HTTP Digest is known to be vulnerable to man-in-the-middle attacks, even when run inside TLS, if the same HTTP Digest authentication credentials are used in some other context without TLS. The attacker may initiate a TLS session with a server, and when the server challenges the attacker with HTTP Digest, the attacker masquerades the server to the victim. If the victim responds to the challenge, the attacker is able to use this response towards the server in HTTP Digest. Note that this attack is an instance of general attack that affects a number of IETF protocols such as PIC. The general problem is discussed in [9] and [10]. Because of the previous vulnerability, the use of HTTP Digest "AKAv1" should be limited to the situations where the client is able to demonstrate that in addition to the AKA response, it possess the AKA session keys. This is possible, for example, if the underlying security protocol uses the AKA generated session keys to protect the authentication response. This is the case for example in the 3GPP IP Multimedia Core Network Subsystem (IMS) where HTTP Digest "AKAv1" is currently applied. However, HTTP Digest "AKAv1" should not be used with tunnelled security protocols that do not utilize the AKA session keys. For example, the use of HTTP Digest "AKAv1" is not necessarily secure with TLS if the server side is authenticated using certificates and the client side is authenticated using HTTP Digest AKA. There are at least four potential solutions to the problem: 1. The use of the authentication credentials is limited to one application only. In general, this approach is good and can be recommended from security point of view. However, this will increase the total number of authentication credentials for an end-user, and may cause scalability problems in the server side. Torvinen, et al. Expires April 28, 2005 [Page 3] Internet-Draft HTTP Digest AKAv2 October 2004 2. The keys used in the underlying security protocols are somehow bind to the keys used in the tunneled authentication protocol. However, this would cause problems with the current implementations of underlying security protocols. For example, it is not possible to use the session keys from TLS at application layer. Furthermore, this solution would only solve the problem when HTTP Digest is used over one hop, and leave the problem of using HTTP Digest via multiple hops, e.g. via proxy servers, unsolved. 3. Authentication credentials are used in cryptographically different way for each media and/or access network. However, it may be difficult to know which underlying media is used below the application. 4. Authentication credentials are used in cryptographically different way for each application. This document specifies a new algorithm version for HTTP Digest AKA, i.e. "AKAv2". "AKAv2" specifies a cryptographically different way to use AKA credentials in use cases that are based either on HTTP Digest authentication or UMTS authentication (cf. approach 4 above). The only difference to "AKAv1" is that in addition to AKA response RES the AKA related session keys, IK and CK, are also used as the password for HTTP Digest. AKAv2 is immune to man-in-the-middle attack described above. However, if AKAv2 is used in some environment both with and without some underlying security, such as TLS, the problem still exists. New HTTP Digest AKA algorithm versions can be registered in IANA based on Expert Review. Documentation of new algorithm versions is not mandated as RFCs. However, "AKAv2" is documented as an RFC because the use of different AKA algorithm versions includes security implications that the implementators should be aware of. The extension version and security implications are presented in this document. 2.1 Terminology This chapter explains the terminology used in this document. AKA Authentication and Key Agreement. AKA is a challenge-response based mechanism that uses symmetric cryptography. AKA can be run in a UMTS IM Services Identity Module (ISIM) or in UMTS Subscriber Identity Module (USIM), which Torvinen, et al. Expires April 28, 2005 [Page 4] Internet-Draft HTTP Digest AKAv2 October 2004 reside on a smart card like device that also provides tamper resistant storage of shared secrets. CK Cipher Key. An AKA session key for encryption. CK' Cipher Key. HTTP Digest AKAv2 session key for encryption. CK' is derived from CK using a pseudo-random function. IK Integrity Key. An AKA session key for integrity check. IK' Integrity Key. HTTP Digest AKAv2 session key for integrity check. IK' is derived from IK using a pseudo-random function. ISIM IP Multimedia Services Identity Module. Sometimes ISIM is implemented using USIM. RES Authentication Response. Generated by the ISIM. PRF Pseudo-random function that is used to construct the AKAv2 password and related session keys IK' and CK'. In this document, PRF is presented in format KD(secret, data) denoting a keyed digest algorithm (KD) performed to the data "data" with the secret "secret". SIM Subscriber Identity Module. GSM counter part for ISIM and USIM. UMTS Universal Mobile Telecommunications System. USIM Torvinen, et al. Expires April 28, 2005 [Page 5] Internet-Draft HTTP Digest AKAv2 October 2004 UMTS Subscriber Identity Module. UMTS counter part for ISIM and SIM. XRES Expected Authentication Response. In a successful authentication this is equal to RES. 3. HTTP Digest AKAv2 In general, the Digest AKAv2 operation is identical to the Digest AKAv1 operation described in [6]. This chapter specifies the parts in which Digest AKAv2 is different from Digest AKAv1 operation. The notation used in the Augmented BNF definitions for the new and modified syntax elements in this section is as used in SIP [5], and any elements not defined in this section are as defined in [6]. In order to direct the client into using AKAv2 for authentication instead of other AKA versions or other HTTP Digest algorithms, the AKA version directive of [6] shall have the following new value: aka-version = "AKAv2" The AKA version directive is used as a part of the algorithm field as defined in [6]. Example: algorithm=AKAv2-MD5 3.1 Password generation The client shall use base64 encoded [1] parameters PRF(RES||IK||CK, "http-digest-akav2-password") as a "password" when calculating the HTTP Digest response directive for AKAv2. The server shall use base64 encoded [1] parameters PRF(XRES||IK||CK, "http-digest-akav2-password") as a "password" when checking the HTTP Digest response or when calculating the "response-auth" of the "Authentication-Info" header. The pseudo-random function (PRF) used to construct the HTTP Digest password is equal to HMAC [2] using the hash algorithm that is used in producing the digest and the checksum. For example, if the algorithm is AKAv2-MD5, then the PRF is HMAC_MD5. Torvinen, et al. Expires April 28, 2005 [Page 6] Internet-Draft HTTP Digest AKAv2 October 2004 The string "http-digest-akav2-password" included in the key derivation is case sensitive. 3.2 Session keys Even though HTTP Digest AKA framework does not specify the use of the session keys IK and CK for confidentiality and integrity protection, the keys may be used for creating additional security within HTTP authentication or some other security mechanism. However, the original session keys IK and CK MUST NOT be directly re-used for such additional security in "AKAv2". Instead, session keys IK' and CK' are derived from the original keys IK and CK in the following way: IK' = PRF(IK, "http-digest-akav2-integritykey") CK' = PRF(CK, "http-digest-akav2-cipherkey") Any application using HTTP authentication framework is allowed to use these masked session keys. The unmaksed session keys MAY also be re-used in some other context if some other application specific strings than "http-digest-akav2-integritykey" or "http-digest-akav2-cipherkey" are used to mask the original session keys. The pseudo-random function (PRF) used to construct the HTTP Digest session keys is equal to HMAC [2] using the hash algorithm that is used in producing the digest and the checksum. For example, if the algorithm is AKAv2-MD5, then the PRF is HMAC_MD5. The algorithm MUST be used in HMAC format as defined in [2]. The strings "http-digest-akav2-integritykey" and "http-digest-akav2-cipherkey" included in the key derivation are case sensitive. 4. Example Digest AKAv2 Operation This document does not introduce any changes to the operations of HTTP Digest or HTTP Digest AKA. Examples defined in [6] applies directly to AKAv2 with the following two exceptions: 1. The algorithm directive has a prefix "AKAv2" instead of "AKAv1". 2. The HTTP Digest password is derived from base64 encoded PRF(RES||IK||CK, "http-digest-akav2-password") or PRF(XRES||IK||CK, "http-digest-akav2-password") instead of (RES) or (XRES) respectively. 3. The optional session keys are derived from PRF(IK, Torvinen, et al. Expires April 28, 2005 [Page 7] Internet-Draft HTTP Digest AKAv2 October 2004 "http-digest-akav2-integritykey") and PRF(CK, "http-digest-akav2-cipherkey") instead of IK and CK respectively. Note that the password in "AKAv1" is in binary format. "AKAv2" password is base64 encoded [1]. 5. Security Considerations 5.1 Multiple Authentication Schemes and Algorithms The rules for an user agent for choosing among multiple authentication schemes and algorithms are as defined in [6] except that the user agent MUST choose "AKAv2" if both "AKAv1" and "AKAv2" are present. Since HTTP Digest is known to be vulnerable for bidding-down attack in environments where multiple authentication schemes and/or algorithms are used, the system implementators should pay special attention for scenarios where both "AKAv1" and "AKAv2" are used. Especially if the AKA generated sessions keys or some other additional security measures to authenticate the clients, such as client certificates, are not used, the use of both AKA algorithm versions should be avoided. 5.2 Session Protection Even though "AKAv2" uses the additional integrity (IK) and confidentiality (CK) keys as a part of HTTP Digest AKA password, these session keys may still be used for creating additional security within HTTP authentication or some other security mechanism. This recommendation is based on the assumption that algorithms used in HTTP Digest, such as MD5, are sufficiently strong one-way functions, and consequently HTTP Digest responses leak no or very little computational information about IK and CK. Furthermore, the session keys are masked into IK' and CK' before they can be used for session protection. 5.3 Man-in-the-middle attacks [9] describe a "man-in-the-middle" attack related to tunnelled authentication protocols. The attack can occur e.g. in EAP context or any similar contexts where tunnelled authentication is used and where the same authentication credentials are used without protection in some other context or the client fails to authenticate the server. For example, the use of TLS with HTTP Digest authentication (i.e. TLS for server authentication, and subsequent use of HTTP Digest for client authentication) is an instance of such scenario. HTTP Torvinen, et al. Expires April 28, 2005 [Page 8] Internet-Draft HTTP Digest AKAv2 October 2004 challenges and responses can be fetched from and to different TLS tunnels without noticing where they originally came from. Especially, the attack is easy to perform if the client fails to authenticate the server. If the same HTTP credentials are used with unsecured connection, the attack is also easy to perform. This is how the "man-in-the-middle" attack works with HTTP Digest and TLS if the victim (i.e. the client) fails to authenticate the server: 1. The victim contacts the attacker using TLS. If the attacker has a valid server certificate, the client may continue talking to the attacker and use some HTTP authentication compatible protocol, such as Session Initiation Protocol (SIP). 2. The attacker contacts some real proxy/server also using TLS and some HTTP authentication compatible protocol. The proxy/server responds to the attacker with HTTP Authentication challenge. 3. The attacker forwards the HTTP Authentication challenge from the proxy/server to the victim. If the victim is not careful, and check that the identity in the server certificate in TLS matches the realm in the HTTP authentication challenge, it may send a new request which carries a valid response to the HTTP Authentication challenge. 4. The attacker may use the response with the victims HTTP Digest username and password to authenticate itself to the proxy/server. The man-in-the-middle attack is not possible if the client compares the identities in the TLS server certificate and the HTTP Digest authentication challenge. Note that with HTTP Basic, the client would send the password to the attacker. Another variant of the "man-in-the-middle" attack is the so-called "interleaving attack". This attack is possible if the HTTP Digest authentication credentials are used in several contexts, and in one of them without protection. This is how the attack could proceed: 1. The attacker establishes a TLS tunnel to the proxy/server using one-way server authentication. The attacker sends a request to the proxy/server. 2. The proxy/server challenges the attacker with HTTP Digest challenge. Torvinen, et al. Expires April 28, 2005 [Page 9] Internet-Draft HTTP Digest AKAv2 October 2004 3. The attacker challenges the victim in some other context using the challenge carried in the HTTP Digest challenge. The HTTP Digest challenge need to be modified to the format used in the protocol of this other context. 4. The victim responds with a response. 5. The attacker uses the response from the other context for authentication in HTTP Digest. 6. The proxy/server accepts the response, and delivers the service to the attacker. In some circumstances, HTTP Digest AKAv1 may be vulnerable for the interleaving attack. In particular, if ISIM is implemented using USIM the HTTP Digest AKAv1 should not be used with tunneled security protocols unless the AKA related session keys, IK and CK, are somehow used with the solution. HTTP Digest AKAv2 is not vulnerable for this interleaving attack, and it can be used with tunneled security protocols without using the related AKA session keys. 5.4 Entropy AKAv1 passwords should only be used as one-time passwords if the entropy of the used RES value is limited (e.g., only 32 bits). For this reason, the reuse of the same RES value in authenticating subsequent requests and responses is not recommended. Furthermore, algorithms such as "MD5-sess", which limit the amount of material hashed with a single key, by producing a session key for authentication, should not be used with AKAv1. Passwords generated using AKAv2 can more securely be used for authenticating subsequent requests and responses because the concatenation of AKA credentials (i.e. RES||IK||CK) makes the passwords significantly longer, and the pseudo-random function heuristically provides an entropy equal to the length of this string, or, the length of the PRF output, whichever is the shortest. The user agent does not need to assume that AKAv2 passwords are limited to one-time use only, and it may try to re-use the AKAv2 passwords with the server. However, note that AKAv2 passwords can not be re-used with HTTP Digest AKAv2 algorithm because such authentication challenge will automatically generate a fresh password. AKAv2 passwords can be used with other HTTP Digest algorithms, such as "MD5". The underlying AKA protocol (e.g. UMTS AKA) has been designed to Torvinen, et al. Expires April 28, 2005 [Page 10] Internet-Draft HTTP Digest AKAv2 October 2004 keep CK and IK confidential but will typically send RES in the clear. We note that even if (by some unfortunate missuse of AKA) RES values were revealed, the inclusion of RES in PRF(RES||IK||CK) is still benefitial as it makes pre-calculated dictionaries of IK||CK values rather useless (though such dictionaries are anyway infeasible for typical sizes of IK and CK). 6. IANA Considerations This document specifies a new aka-version, "AKAv2", to the aka-version namespace maintained by IANA. The procedure for allocation of new aka-versions is defined in [6]. 6.1 Registration Information To: ietf-digest-aka@iana.org Subject: Registration of a new AKA version Version identifier: "AKAv2" Contacts for further information: vesa.torvinen@ericsson.com, jari.arkko@ericsson.com or mats.naslund@ericsson.com 7. References 7.1 Normative References [1] Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", RFC 2045, November 1996. [2] Krawczyk, H., Bellare, M. and R. Canetti, "HMAC: Keyed-Hashing for Message Authentication", RFC 2104, February 1997. [3] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [4] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., Leach, P., Luotonen, A. and L. Stewart, "HTTP Authentication: Basic and Digest Access Authentication", RFC 2617, June 1999. [5] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, A., Peterson, J., Sparks, R., Handley, M. and E. Schooler, "SIP: Session Initiation Protocol", RFC 3261, June 2002. [6] Niemi, A., Arkko, J. and V. Torvinen, "Hypertext Transfer Protocol (HTTP) Digest Authentication Using Authentication and Torvinen, et al. Expires April 28, 2005 [Page 11] Internet-Draft HTTP Digest AKAv2 October 2004 Key Agreement (AKA)", RFC 3310, September 2002. 7.2 Informative References [7] Narten, T. and H. Alvestrand, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 2434, October 1998. [8] 3rd Generation Partnership Project, "Security Architecture (Release 4)", TS 33.102, December 2001. [9] Asokan, N., Niemi, V. and K. Nyberg, "Man-in-the-Middle in Tunnelled Authentication Protocols", Cryptology ePrint Archive, http://eprint.iacr.org Report 2002/163, October 2002. [10] Puthenkulam, J., Lortz, V., Palekar, A. and D. Simon, "The Compound Authentication Binding Problem", IETF, Work in progress draft-puthenkulam-eap-binding-02.txt, March 2003. Authors' Addresses Vesa Torvinen Ericsson Joukahaisenkatu 1 Turku FIN 20520 Finland Phone: +358 40 7230822 EMail: vesa.torvinen@ericsson.com Jari Arkko Ericsson Hirsalantie 1 Jorvas FIN 02420 Finland Phone: +358 40 5079256 EMail: jari.arkko@ericsson.com Torvinen, et al. Expires April 28, 2005 [Page 12] Internet-Draft HTTP Digest AKAv2 October 2004 Mats N„slund Ericsson Torshamnsgatan 23 Stockholm SE 16480 Sweden Phone: +46 8 58533739 EMail: mats.naslund@ericsson.com Torvinen, et al. Expires April 28, 2005 [Page 13] Internet-Draft HTTP Digest AKAv2 October 2004 Intellectual Property Statement The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79. Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf-ipr@ietf.org. Disclaimer of Validity This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Copyright Statement Copyright (C) The Internet Society (2004). This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights. Acknowledgment Funding for the RFC Editor function is currently provided by the Internet Society. Torvinen, et al. Expires April 28, 2005 [Page 14]