Re: [kitten] Input on Paul's concerns about aes-cbc

mrex@sap.com (Martin Rex) Wed, 09 October 2013 02:23 UTC

Return-Path: <mrex@sap.com>
X-Original-To: kitten@ietfa.amsl.com
Delivered-To: kitten@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D420911E8112 for <kitten@ietfa.amsl.com>; Tue, 8 Oct 2013 19:23:16 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -9.716
X-Spam-Level:
X-Spam-Status: No, score=-9.716 tagged_above=-999 required=5 tests=[AWL=0.533, BAYES_00=-2.599, HELO_EQ_DE=0.35, RCVD_IN_DNSWL_HI=-8]
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 76byN03cPG4M for <kitten@ietfa.amsl.com>; Tue, 8 Oct 2013 19:23:11 -0700 (PDT)
Received: from smtpde01.sap-ag.de (smtpde01.sap-ag.de [155.56.68.170]) by ietfa.amsl.com (Postfix) with ESMTP id 7C6F621F9B12 for <kitten@ietf.org>; Tue, 8 Oct 2013 19:23:10 -0700 (PDT)
Received: from mail05.wdf.sap.corp by smtpde01.sap-ag.de (26) with ESMTP id r992N5eI010151 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 9 Oct 2013 04:23:06 +0200 (MEST)
In-Reply-To: <064ca7780d4943b1868670461c2c7184@BLUPR03MB279.namprd03.prod.outlook.com>
To: "Paul Miller (NT)" <paumil@microsoft.com>
Date: Wed, 09 Oct 2013 04:23:05 +0200
X-Mailer: ELM [version 2.4ME+ PL125 (25)]
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="US-ASCII"
Message-Id: <20131009022305.BD1FB1A9E6@ld9781.wdf.sap.corp>
From: mrex@sap.com
X-SAP: out
Cc: "kitten@ietf.org" <kitten@ietf.org>, Sam Hartman <hartmans-ietf@mit.edu>
Subject: Re: [kitten] Input on Paul's concerns about aes-cbc
X-BeenThere: kitten@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
Reply-To: mrex@sap.com
List-Id: Common Authentication Technologies - Next Generation <kitten.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/kitten>, <mailto:kitten-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/kitten>
List-Post: <mailto:kitten@ietf.org>
List-Help: <mailto:kitten-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/kitten>, <mailto:kitten-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 09 Oct 2013 02:23:17 -0000

Paul Miller (NT) wrote:
>
>  ... it would not be possible to do a fallback just for impacted
> callers as the cipher of the subsession key is chosen during the
> context establishment which is before the first call to
> EncryptMessage (GSS_Wrap analogue).  By the time we knew that the
> caller was not providing for padding, it would be too late to
> select differently.

That fallback isn't possible has been intuitively obvious, at least to me.


> 
> With the existing calling pattern used for DES in Windows, callers that
> did not pass in the SECBUFFER_PADDING into the EncryptMessage call would
> just fail when the buffer was not aligned.

Hmmm.

While I did write my code that calls SSPI's EncryptMessage() in 1999
(during W2K beta), and don't exactly remeber which documentation
I used,  The "MDSN Library October 2001 Platform SDK" contains
a description titled "SSPI/Kerberos Interoperability with GSS-API
with this code sample:

  // Need 3 descriptors - 2 for the SSP and one to hold the application data 
  in_buf_desc.cBuffers = 3;
  in_buf_desc.pBuffers = wrap_bufs;
  in_buf_desc.ulVersion = SECBUFFER_VERSION;
  wrap_bufs[0].cbBuffer = sizes.cbSecurityTrailer;
  wrap_bufs[0].BufferType = SECBUFFER_TOKEN;
  wrap_bufs[0].pvBuffer = malloc(sizes.cbSecurityTrailer);
  // This buffer holds the application data
  wrap_bufs[1].BufferType = SECBUFFER_DATA;
  wrap_bufs[1].cbBuffer = in_buf.cbBuffer;
  wrap_bufs[1].pvBuffer = malloc(wrap_bufs[1].cbBuffer);
  memcpy(wrap_bufs[1].pvBuffer, in_buf.pvBuffer, in_buf.cbBuffer);
  wrap_bufs[2].BufferType = SECBUFFER_PADDING;
  wrap_bufs[2].cbBuffer = sizes.cbBlockSize;
  wrap_bufs[2].pvBuffer = malloc(wrap_bufs[2].cbBuffer);
  maj_stat = EncryptMessage(&context,
          SignOnly ? KERB_WRAP_NO_ENCRYPT : 0,
          &in_buf_desc, 0);

// Send message to server


>
> There are several reasons that I think this is a significant risk.
> First of all, the documentation that Microsoft has for the
> EncryptMessage function for Kerberos has very little bearing on how
> the function should actually be used.  In fact, most of the document
> is incorrectly copied and pasted from SSL's documentation.

Would the above code really fail to work?

-Martin