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

"Manger, James H" <James.H.Manger@team.telstra.com> Wed, 13 June 2012 02:32 UTC

Return-Path: <James.H.Manger@team.telstra.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 4A22721F8643 for <cfrg@ietfa.amsl.com>; Tue, 12 Jun 2012 19:32:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.79
X-Spam-Level:
X-Spam-Status: No, score=-0.79 tagged_above=-999 required=5 tests=[AWL=-0.489, BAYES_00=-2.599, HELO_EQ_AU=0.377, HOST_EQ_AU=0.327, J_CHICKENPOX_41=0.6, RELAY_IS_203=0.994]
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 9l8E3JQwc6UZ for <cfrg@ietfa.amsl.com>; Tue, 12 Jun 2012 19:32:38 -0700 (PDT)
Received: from ipxbno.tcif.telstra.com.au (ipxbno.tcif.telstra.com.au [203.35.82.204]) by ietfa.amsl.com (Postfix) with ESMTP id 7CB9421F863B for <cfrg@irtf.org>; Tue, 12 Jun 2012 19:32:34 -0700 (PDT)
X-IronPort-AV: E=Sophos;i="4.77,400,1336312800"; d="scan'208";a="76518894"
Received: from unknown (HELO ipcani.tcif.telstra.com.au) ([10.97.216.200]) by ipobni.tcif.telstra.com.au with ESMTP; 13 Jun 2012 12:32:33 +1000
X-IronPort-AV: E=McAfee;i="5400,1158,6740"; a="17071403"
Received: from wsmsg3754.srv.dir.telstra.com ([172.49.40.198]) by ipcani.tcif.telstra.com.au with ESMTP; 13 Jun 2012 12:32:33 +1000
Received: from WSMSG3153V.srv.dir.telstra.com ([172.49.40.159]) by WSMSG3754.srv.dir.telstra.com ([172.49.40.198]) with mapi; Wed, 13 Jun 2012 12:32:32 +1000
From: "Manger, James H" <James.H.Manger@team.telstra.com>
To: "cfrg@irtf.org" <cfrg@irtf.org>, David McGrew <mcgrew@cisco.com>
Date: Wed, 13 Jun 2012 12:32:31 +1000
Thread-Topic: draft-mcgrew-aead-aes-cbc-hmac-sha2-00: unsafe to optionally hash A's length
Thread-Index: Ac1Il9We7OUFiS6ZT1mPEv0MCuf7aQAbOzCQ
Message-ID: <255B9BB34FB7D647A506DC292726F6E114F557CCA2@WSMSG3153V.srv.dir.telstra.com>
References: <C9B2F1B1-6089-46FA-94CB-510DC7FCE927@cisco.com> <1B8956F6-81C5-4921-BA03-4097BE58F471@bbn.com>
In-Reply-To: <1B8956F6-81C5-4921-BA03-4097BE58F471@bbn.com>
Accept-Language: en-US, en-AU
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
acceptlanguage: en-US, en-AU
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Subject: [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 02:32:39 -0000

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.

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).

Section 4: Stray " at end of Rationale.

Section 5: Some cases explicitly list PS and AL values, others don't.

--
James Manger