Re: [secdir] SecDir review of draft-ietf-tram-turn-third-party-authz-07

"Tirumaleswar Reddy (tireddy)" <tireddy@cisco.com> Mon, 02 February 2015 18:07 UTC

Return-Path: <tireddy@cisco.com>
X-Original-To: secdir@ietfa.amsl.com
Delivered-To: secdir@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 580841A8836; Mon, 2 Feb 2015 10:07:37 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.511
X-Spam-Level:
X-Spam-Status: No, score=-14.511 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tAKfyU4dFgyc; Mon, 2 Feb 2015 10:07:33 -0800 (PST)
Received: from alln-iport-3.cisco.com (alln-iport-3.cisco.com [173.37.142.90]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id BCB8E1A883A; Mon, 2 Feb 2015 10:07:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=8188; q=dns/txt; s=iport; t=1422900439; x=1424110039; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=QtBbdREcyIGZXu2l/JRuJ7E5BdVGdQxyW62C5l2xFok=; b=Wr4VNt5/DaWuSZMSj22D6wswi2F3OQ1u1dJytE3aaQ533PEW1mCjBqnp zXygvhTND6wx6Hk8Z7AAy8ipcmcE3ZD6FWeEYJ9VngIPbxaw3sSJNk62f ZU/sWsXh5TdD1qAPyiVHG1rDMVeoUiZCcYf9XJV4WyZ+rE8lniNIiGvc8 0=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0CPBQCYvM9U/40NJK1bgwZSWQTCP4IlhXECgRxDAQEBAQF9hAwBAQEDAScTPwUHBgEIEQQBAQsOBgkoERQJCQEEAQ0FCIgRAwkIDdBhDYU2AQEBAQEBAQEBAQEBAQEBAQEBAQEBF41OgXkxDRKCfoETBY0mgWODToQRgl02gk2IRYV9IoIBARyBUG8BgUN+AQEB
X-IronPort-AV: E=Sophos;i="5.09,507,1418083200"; d="scan'208";a="119795734"
Received: from alln-core-8.cisco.com ([173.36.13.141]) by alln-iport-3.cisco.com with ESMTP; 02 Feb 2015 18:07:18 +0000
Received: from xhc-aln-x11.cisco.com (xhc-aln-x11.cisco.com [173.36.12.85]) by alln-core-8.cisco.com (8.14.5/8.14.5) with ESMTP id t12I7I0i022162 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Mon, 2 Feb 2015 18:07:18 GMT
Received: from xmb-rcd-x10.cisco.com ([169.254.15.160]) by xhc-aln-x11.cisco.com ([173.36.12.85]) with mapi id 14.03.0195.001; Mon, 2 Feb 2015 12:07:18 -0600
From: "Tirumaleswar Reddy (tireddy)" <tireddy@cisco.com>
To: Yaron Sheffer <yaronf.ietf@gmail.com>, IETF Security Directorate <secdir@ietf.org>, The IESG <iesg@ietf.org>, "draft-ietf-tram-turn-third-party-authz.all@tools.ietf.org" <draft-ietf-tram-turn-third-party-authz.all@tools.ietf.org>
Thread-Topic: SecDir review of draft-ietf-tram-turn-third-party-authz-07
Thread-Index: AdA/ExG1WBn6u6R0RKmUj5mvhiVERQ==
Date: Mon, 2 Feb 2015 18:07:18 +0000
Message-ID: <913383AAA69FF945B8F946018B75898A35535978@xmb-rcd-x10.cisco.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [10.65.32.8]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Archived-At: <http://mailarchive.ietf.org/arch/msg/secdir/XvYohR_k0lMA2tSp2gAKrQ8ZrO0>
Cc: "tram@ietf.org" <tram@ietf.org>
Subject: Re: [secdir] SecDir review of draft-ietf-tram-turn-third-party-authz-07
X-BeenThere: secdir@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Security Area Directorate <secdir.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/secdir>, <mailto:secdir-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/secdir/>
List-Post: <mailto:secdir@ietf.org>
List-Help: <mailto:secdir-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/secdir>, <mailto:secdir-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2015 18:07:37 -0000

Hi Yaron,

Thanks for the detailed review. Please see inline

> -----Original Message-----
> From: Yaron Sheffer [mailto:yaronf.ietf@gmail.com]
> Sent: Sunday, February 01, 2015 11:26 PM
> To: IETF Security Directorate; The IESG; draft-ietf-tram-turn-third-party-
> authz.all@tools.ietf.org
> Subject: SecDir review of draft-ietf-tram-turn-third-party-authz-07
> 
> I have reviewed this document as part of the security directorate's ongoing
> effort to review all IETF documents being processed by the IESG.
> These comments were written primarily for the benefit of the security area
> directors.  Document editors and WG chairs should treat these comments
> just like any other last call comments.
> 
> This document defines a mechanism where a STUN client can present an
> OAUTH token and get authorized to use a particular STUN server.
> 
> Summary
> 
> IMHO, the document is not yet ready to be published.
> 
> Details
> 
> * What is the motivation for this authorization? Is it intended to conserve
> server resources?

Yes, to ensure that only authorized clients can use the STUN server. For example allow the client to use the TURN server only when making a call using the WebRTC server.

> 
> * What is HMAC-SHA-256-128? Is the output 128 or 256 bits long? 

The output is truncated to 128 bit.

> Please
> include a reference.

Added reference to RFC 4868.

> 
> * Maybe I'm confused, but it seems to me that the discussion immediately
> following Fig. 2 mixes the hash algorithm that signs the token itself with the
> algorithm that integrity-protects STUN messages. If they must be the same
> for some reason, please state it clearly.

No, they do not need to be same. RFC 5389 mandates HMAC-SHA1 for integrity protection of STUN message and in future the WG plans to remove this limitation, hence we added this paragraph after Fig.2.

> 
> * 4.1: there are obvious benefits to using an asymmetric key here, and in fact
> this can be done efficiently using elliptic curves (ECDSA). So I think the "MUST
> establish a symmetric key" is misguided.

Agreed. 
NEW:
Elliptic curve cryptography (ECC) or symmetric-key algorithm MUST be chosen to ensure that the size of encrypted token is not large because usage of RSA will result in large encrypted tokens which may not fit into a single STUN message.

> 
> * 4.1.1: the derivation of both keys seems to be the same, so are they
> identical?!

The derivation of the keys is required if the encryption and HMAC algorithm require keys of different length.

NEW:
For example
   if the input symmetric key (K) is 32 octets length, encryption
   algorithm is AES_256_CBC and HMAC algorithm is HMAC-SHA1 [RFC2104]
   then the secondary keys AS-RS, AUTH are generated from the input key
   K as follows

   1.  HKDF-Extract(zero, K) -> PRK

   2.  HKDF-Expand(PRK, zero, 16) -> AUTH key 

   3.  HKDF-Expand(PRK, zero, 32) -> AS-RS key

> 
> * 4.1.2: this interaction (a simple REST query to get a long-term key) is by
> default insecure, so I'm surprised to see it here with no comments about the
> need to encrypt it an authenticate the client.

Good point, updated draft.
NEW:
The two servers could choose to use REST API over HTTPS to establish a symmetric key. HTTPS MUST be used for mutual authentication and confidentiality.

> 
> * 4.1.3: please provide a reference for AES_256_CBC_HMAC_SHA_512.

Added reference.

> 
> * 6.1, last sentence: so an attacker who can disrupt communication to the AS
> can force the client to switch to 1st party authentication, which is easily
> susceptible to dictionary attacks ?

The possible way to mitigate the attack is use (D)TLS for communication b/w the client and server. 

NEW text (added to Security considerations):
   An attacker may remove the THIRD-PARTY-AUTHORIZATION STUN attribute
   from the error message forcing the client to pick first party
   authentication, this attack may be mitigated by opting for Transport
   Layer Security (TLS) [RFC5246] or Datagram Transport Layer Security
   (DTLS) [RFC6347] as a transport protocol for Session Traversal
   Utilities for NAT (STUN), as defined in [RFC5389]and [RFC7350].

> 
> * 6.2: the timestamp value is strange, specifically the fractional part.
> Why are fractions needed, do we think this improves security?

We used the description from http://tools.ietf.org/html/rfc3971#section-5.3.1  
Do you see a problem ?

> 
> * 6.2 example: when using AES-256-CBC something must be said about
> padding and about the IV.

Yes, updated encrypted_block to include padding, padding_length;

         struct {
             opaque {
                 uint16_t key_length;
                 opaque mac_key[key_length];
                 uint64_t timestamp;
                 uint32_t lifetime;
                 uint8_t  padding_length;
                 uint8_t padding[padding_length];
             } encrypted_block;
             opaque mac[mac_length];
             uint8_t mac_length;
         } token;

   padding_length:  The padding length MUST be such that the total size
      of the encrypted_block structure is a multiple of the cipher's
      block length.

   padding:  Padding that is added to force the length of the plaintext
      to be an integral multiple of the block cipher's block length.

And the below text to address the comment on IV

   o  C = AES_256_CBC(AS-RS, encrypted_block)

      *  Initialization vector can be set to zero because the
         encrypted_block in each access token will not be identical and
         hence will not result in generation of identical ciphertext.

> 
> * 6.2, last sentence: the length of the nonce surely depends on the selected
> algorithm, and cannot be a constant 12.

Yes, removed the last sentence and added the following line:
The length of nonce for AEAD algorithms is explained in [RFC5116].

> 
> * 8: Is the MESAGE INTEGRITY attribute itself mandatory ? 

Yes.

> The client should
> reject messages if this attribute is not included.

Added following text for clarity:

   o  The client looks for the MESSAGE-INTEGRITY attribute in the
      response.  If MESSAGE-INTEGRITY is absent or the value computed
      for message integrity using mac_key does not match the contents of
      the MESSAGE-INTEGRITY attribute then the response MUST be
      discarded.

> 
> * 9: if the server is allowed to cache access tokens, there must be a way for
> the client to refer to a token by name. Otherwise there may be confusion
> when tokens are expired and replaced by new ones, especially in the
> presence of dropped messages.

That line is only for server implementation optimization. 
NEW:
Since the access token is only valid for a specific period of time, the TURN server can cache it so that it can check if the access token in a new allocation request matches one of the cached tokens and avoids the need not decrypt the access token.

> 
> * 10: is the server required to cache old transaction IDs to avoid replay
> attacks? If this is the case, you need to mandate it explicitly.

Fixed.
NEW:
An attacker trying to replay message with ACCESS-TOKEN attribute can be mitigated by
frequent changes of nonce value as discussed in section 10.2 of
[RFC5389].

> 
> * App. A: the mac_key as included in the token should be binary IMO, and
> not as shown here, encoded in base64.

Assuming mac_key is negotiated using DSKPP base64 encoding is shown, will add a note that mac_key is base64 encoded and 
must be converted to binary for HMAC computation.


> 
> * I suggest to rename "long term password" to "long term key" 

Fixed.

> (and again, it
> should be binary).

Added note that long_term_key is base64 encoded and must be converted to binary for encrypting and decrypting of token.

> 
> * Similarly, the nonce should be binary.

Updated.

Best Regards,
-Tiru

> 
> Thanks,
> 	Yaron