Re: [Cfrg] draft-mcgrew-aead-aes-cbc-hmac-sha2-00: unsafe to optionally hash A's length

David McGrew <mcgrew@cisco.com> Wed, 13 June 2012 20:23 UTC

Return-Path: <mcgrew@cisco.com>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 209A121F8474 for <cfrg@ietfa.amsl.com>; Wed, 13 Jun 2012 13:23:25 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -110.299
X-Spam-Level:
X-Spam-Status: No, score=-110.299 tagged_above=-999 required=5 tests=[AWL=-0.300, BAYES_00=-2.599, J_CHICKENPOX_41=0.6, RCVD_IN_DNSWL_HI=-8, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yNWbm0qBf7uc for <cfrg@ietfa.amsl.com>; Wed, 13 Jun 2012 13:23:24 -0700 (PDT)
Received: from rcdn-iport-9.cisco.com (rcdn-iport-9.cisco.com [173.37.86.80]) by ietfa.amsl.com (Postfix) with ESMTP id 0510811E8083 for <cfrg@irtf.org>; Wed, 13 Jun 2012 13:23:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2860; q=dns/txt; s=iport; t=1339619004; x=1340828604; h=subject:mime-version:from:in-reply-to:date:cc: content-transfer-encoding:message-id:references:to; bh=H5m0qakBn02ahX47ABL479ZlF+hDlmopAN/2yCumf/k=; b=lx//7eImSIIWoCw/hhwpSzRGQ2bO9CyPmsX4Z4M5HcZnu6s4tjbwq5+p xkTRjI4Vn9Tu53lkuAPDvhajgMz/KJ3aJ7igfvVJejjoSmO1dJCv0Io1h ddc/m44wXHevAFCOonov3LL3RJA4XbpAN5B8M9TYxdEHKdCptFt5n3k8E k=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AqcGAOD12E+tJXHA/2dsb2JhbABFsWmDWIEHghgBAQEDARIBZgULC0ZXBjWHZAWaMqAHizGFMWADlSGOFoFmgnw
X-IronPort-AV: E=Sophos;i="4.75,766,1330905600"; d="scan'208";a="89219679"
Received: from rcdn-core2-5.cisco.com ([173.37.113.192]) by rcdn-iport-9.cisco.com with ESMTP; 13 Jun 2012 20:23:23 +0000
Received: from rtp-vpn5-1719.cisco.com (rtp-vpn5-1719.cisco.com [10.82.238.189]) by rcdn-core2-5.cisco.com (8.14.5/8.14.5) with ESMTP id q5DKNMFM010967; Wed, 13 Jun 2012 20:23:22 GMT
Mime-Version: 1.0 (Apple Message framework v1278)
Content-Type: text/plain; charset="windows-1252"
From: David McGrew <mcgrew@cisco.com>
In-Reply-To: <255B9BB34FB7D647A506DC292726F6E114F557CCA2@WSMSG3153V.srv.dir.telstra.com>
Date: Wed, 13 Jun 2012 16:23:21 -0400
Content-Transfer-Encoding: quoted-printable
Message-Id: <149B9613-82A9-4D27-934D-A15F854233BE@cisco.com>
References: <C9B2F1B1-6089-46FA-94CB-510DC7FCE927@cisco.com> <1B8956F6-81C5-4921-BA03-4097BE58F471@bbn.com> <255B9BB34FB7D647A506DC292726F6E114F557CCA2@WSMSG3153V.srv.dir.telstra.com>
To: "Manger, James H" <James.H.Manger@team.telstra.com>
X-Mailer: Apple Mail (2.1278)
Cc: "cfrg@irtf.org" <cfrg@irtf.org>
Subject: Re: [Cfrg] draft-mcgrew-aead-aes-cbc-hmac-sha2-00: unsafe to optionally hash A's length
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <http://www.irtf.org/mailman/options/cfrg>, <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <http://www.irtf.org/mail-archive/web/cfrg>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <http://www.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Wed, 13 Jun 2012 20:23:25 -0000

Hi James,

thanks for the quick feedback, more inline:

On Jun 12, 2012, at 10:32 PM, Manger, James H wrote:

> RE: Authenticated Encryption with AES-CBC and HMAC-SHA
> 
> Great document.
> 
> I am not certain that the way the length of the additional data (A) is optionally hashed is safe.

Agreed.   MIN_LEN_A was an under analyzed suggestion of mine, intended as a way to enable these AEAD algorithms to interoperate with some existing implementations of CBC and HMAC.   It is not clear that the interoperability I was going for is even important, and as you point out, the particular way that the length of A was included doesn't work.  Change is clearly needed.   I suggest that Step 5 should read: "The octet string AL is equal to the number of bits in A expressed as a 64-bit unsigned integer in network byte order."

> 
> 1. Legitimate user sends A and C = S || T, where T = HMAC(A || S || len(A)).
> 
> 2. Attacker intercepts & rearranges the message, sending an empty A' and C' = A || S || len(A) || T.
> 
> 3. Recipient verifies T' = HMAC(S'), since len(A) = 0 = MIN_LEN_A so AL is empty.
>  T' = HMAC(S') = HMAC(A || S || len(A)) = T
> The verification passes! Yikes! The recipient now gets garbage from the decryption.
> The attack might only work if len(A) mod 128 = 64, but that is not hard enough.
> 
> 
> An attack can also work if the legitimate user sends an empty A.
> 1. Legitimate user sends empty A and C = S || T, where T = HMAC(S).
> 
> 2. Attacker splits S into 3 parts, S = S1 || S2 || S3, choosing len(S3) = 64 and len(S1) = S3. The attacker sends A' = S1 and C' = S2 || T.
> 
> 3. Recipient's verification works! Yikes!
>  T' = HMAC(A' || S' || len(A)) = HMAC(S1 || S2 || S3) = HMAC(S) = T
> The recipient now gets garbage from the decryption.
> The attack might only work if the last 64 bits are a small enough integer (and equal 64 mod 128), but that is not hard enough.
> 
> 
> 
> 
> Typos:
> 
> Section 2.1: The last padding string (PS) in step 3 should be 1010…, not 0F0F…, as can be seen in the P_9 line in the section 5.1 test case. Change it to:
> 
>  PS = 10101010101010101010101010101010, if len(P) mod 128 = 0.
> 
> Section 2.2: Decryption step 3 should refer to encryption "steps 5 and 6", not just to "step 5".
> 
> Section 3: A random IV should have min-entropy within 1 bit of the block size (128-bits), not within 1 bit of the key length (which is longer than the IV for AES-192 and AES-256 algorithms).

Agreed on all points.

> 
> Section 4: Stray " at end of Rationale.
> 
> Section 5: Some cases explicitly list PS and AL values, others don't.

Thanks again!

David

> 
> --
> James Manger