Re: [hybi] It's time to ship

Adam Barth <ietf@adambarth.com> Thu, 13 January 2011 00:03 UTC

Return-Path: <ietf@adambarth.com>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 675A23A67D4 for <hybi@core3.amsl.com>; Wed, 12 Jan 2011 16:03:20 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.534
X-Spam-Level:
X-Spam-Status: No, score=-3.534 tagged_above=-999 required=5 tests=[AWL=-1.157, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, J_CHICKENPOX_31=0.6, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WlVwfCMG1yCZ for <hybi@core3.amsl.com>; Wed, 12 Jan 2011 16:03:19 -0800 (PST)
Received: from mail-vw0-f44.google.com (mail-vw0-f44.google.com [209.85.212.44]) by core3.amsl.com (Postfix) with ESMTP id EC9F63A6403 for <hybi@ietf.org>; Wed, 12 Jan 2011 16:03:18 -0800 (PST)
Received: by vws7 with SMTP id 7so413241vws.31 for <hybi@ietf.org>; Wed, 12 Jan 2011 16:05:38 -0800 (PST)
Received: by 10.220.171.19 with SMTP id f19mr392032vcz.235.1294877137187; Wed, 12 Jan 2011 16:05:37 -0800 (PST)
Received: from mail-iy0-f172.google.com (mail-iy0-f172.google.com [209.85.210.172]) by mx.google.com with ESMTPS id g27sm559118vby.14.2011.01.12.16.05.35 (version=SSLv3 cipher=RC4-MD5); Wed, 12 Jan 2011 16:05:36 -0800 (PST)
Received: by iyi42 with SMTP id 42so1123785iyi.31 for <hybi@ietf.org>; Wed, 12 Jan 2011 16:05:34 -0800 (PST)
Received: by 10.231.173.12 with SMTP id n12mr1724314ibz.77.1294877134749; Wed, 12 Jan 2011 16:05:34 -0800 (PST)
MIME-Version: 1.0
Received: by 10.231.11.140 with HTTP; Wed, 12 Jan 2011 16:05:04 -0800 (PST)
In-Reply-To: <l2bsi6ll7c25ogv53kc1tj1gu88c2jjhg8@hive.bjoern.hoehrmann.de>
References: <AANLkTim2VGfH2FiJ4iH85wYiuXNKQ1Arh1C1Kg4M58Fs@mail.gmail.com> <sk1si6dvl4s1lmroa5qdt0ra2erd5066ri@hive.bjoern.hoehrmann.de> <AANLkTinBZeMoTLUjPUxjixB7sfhJ4yeHi3REk=oz76FC@mail.gmail.com> <l2bsi6ll7c25ogv53kc1tj1gu88c2jjhg8@hive.bjoern.hoehrmann.de>
From: Adam Barth <ietf@adambarth.com>
Date: Wed, 12 Jan 2011 16:05:04 -0800
Message-ID: <AANLkTi=BvE1uUW2Nqx1PcL=8--NWqwMpsZK8RVdYFOpw@mail.gmail.com>
To: Bjoern Hoehrmann <derhoermi@gmx.net>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] It's time to ship
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 13 Jan 2011 00:03:20 -0000

On Wed, Jan 12, 2011 at 3:47 PM, Bjoern Hoehrmann <derhoermi@gmx.net> wrote:
> * Adam Barth wrote:
>>Here's an example RFC that uses AES-128-CTR
>>
>>http://www.ietf.org/rfc/rfc4344.txt
>>
>>I believe it's technically defined by combining
>>http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf and
>>http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf, the
>>later of which contains test vectors.  (Careful readers will notice
>>that my example is wrong.)
>
> I agree your example is wrong. So the concern was a chosen ciphertext
> attack. For simplicity let's say Websocket frames are just 16 byte long
> blocks and the attacker has full control over them. From the same 16
> byte input the browser would generate at most 2^32 ciphertexts, so an
> attacker can compute the masked frame for one of the nonces and send it
> over and over again, eventually his ciphertext will appear.
>
> Example: The handshake establishes the per-connection key K, I want to
> put "0123456789ABCDEF" on the wire, I compute "0123456789ABCDEF" `xor`
> AES(K, 0x12345678000000...) and ask the browser to send that again and
> again; eventually it will pick 0x12345678 as per-frame nonce, it will
> xor with the same AES value, and I get my attack payload on the wire
> (if the block counter is not reset, I'd just take that into account by
> recomputing the masked frame still assuming the same per-frame nonce.)
>
> So is there an error in this analysis, or is the argument simply that
> using your AES scheme seems to make attacks a little bit harder?

That's not really a chosen ciphertext attack.  A chosen ciphertext
attack means something specific in cryptography:

http://en.wikipedia.org/wiki/Chosen-ciphertext_attack

Your overall point is correct, however.  The security of the masking
depends on the size of the per-frame nonce.  That's the case for each
of the masking proposals.  32 bits seems like a reasonable trade-off
between security and per-frame size overhead.  With a 32 bit nonce,
you'll have to try this attack 2,147,483,648 times (on average) before
it works (that's around 2 billion).

Adam