Re: [hybi] Masking only Payload/Extension Data

John Tamplin <jat@google.com> Thu, 10 March 2011 16:21 UTC

Return-Path: <jat@google.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 2BCEC3A6A1A for <hybi@core3.amsl.com>; Thu, 10 Mar 2011 08:21:53 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -105.936
X-Spam-Level:
X-Spam-Status: No, score=-105.936 tagged_above=-999 required=5 tests=[AWL=0.040, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
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 jibNflzVwt5t for <hybi@core3.amsl.com>; Thu, 10 Mar 2011 08:21:51 -0800 (PST)
Received: from smtp-out.google.com (smtp-out.google.com [216.239.44.51]) by core3.amsl.com (Postfix) with ESMTP id 78B8F3A69C3 for <hybi@ietf.org>; Thu, 10 Mar 2011 08:21:51 -0800 (PST)
Received: from kpbe20.cbf.corp.google.com (kpbe20.cbf.corp.google.com [172.25.105.84]) by smtp-out.google.com with ESMTP id p2AGN8EB004481 for <hybi@ietf.org>; Thu, 10 Mar 2011 08:23:08 -0800
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1299774188; bh=fmCyiosF+bH2aOEIZegQZgi/WCE=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=rc5vgOZZwRwYdXonVd0qVMkrTWWIqHo/ndL7OzgsBOx5745jS6Nw/jNX0He9CkyNR R8UDJ5paEzVb22l4b84pA==
Received: from gxk2 (gxk2.prod.google.com [10.202.11.2]) by kpbe20.cbf.corp.google.com with ESMTP id p2AGMu5G007814 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <hybi@ietf.org>; Thu, 10 Mar 2011 08:23:07 -0800
Received: by gxk2 with SMTP id 2so938710gxk.0 for <hybi@ietf.org>; Thu, 10 Mar 2011 08:23:07 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=U8GQpaxcxexpgBThaPhhYcSzrS92oPopKnyK/JomZ7I=; b=GqMfhJWL68yyvcx3tjSRI+HU+Z1LoXloTmS01Laj+WXBawJj1SU+2k5CLE06R4gvDW aR5JpFilo6IPnMBL1lwA==
DomainKey-Signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=QxTjPAzZKh4d8mCx+2uity/kMx9q9wFxUrcnkwyh1dQSrwBniFe59gqWVA6J3tThMD 8ox5A0G5RBjai5VnOaPA==
Received: by 10.150.209.1 with SMTP id h1mr1257063ybg.181.1299774187122; Thu, 10 Mar 2011 08:23:07 -0800 (PST)
MIME-Version: 1.0
Received: by 10.150.200.16 with HTTP; Thu, 10 Mar 2011 08:22:47 -0800 (PST)
In-Reply-To: <4D78EFFD.5040906@warmcat.com>
References: <4D77B885.5050109@callenish.com> <OF36FEDDC6.06951577-ON8825784E.0062343E-8825784E.0066AC27@playstation.sony.com> <AANLkTinau4g1pB_ccJ31u7WRi5npYtHvXE5YRn5uTbeV@mail.gmail.com> <AANLkTikB4YeaYiF_NVGn61c1YxpNWbmEWQZu1WcN+=Jf@mail.gmail.com> <1299704939.2606.238.camel@ds9.ducksong.com> <20110309214212.GA29190@1wt.eu> <AANLkTi=i=8aWg=6+T7=Kn5dWeKkW6MYVCH_CuNkt_ZMM@mail.gmail.com> <AANLkTimip9o0RoZaBfONCmg5nuJVWXjOKDKgAt8zrNVV@mail.gmail.com> <AANLkTikbFBeM6+hiURSBqxFyjc2Wc-yh8UJnZiO+U0JX@mail.gmail.com> <20110310103914.GA32389@1wt.eu> <AANLkTik-TNXCMygBu3WqBHyhJWaG-XUTjCdXud9zHOgX@mail.gmail.com> <1299769498.2606.252.camel@ds9.ducksong.com> <4D78EFFD.5040906@warmcat.com>
From: John Tamplin <jat@google.com>
Date: Thu, 10 Mar 2011 11:22:47 -0500
Message-ID: <AANLkTi=HvWvOW7UEYL8Ua9zRiQGCe0iZehmA_oeA8-U-@mail.gmail.com>
To: Andy Green <andy@warmcat.com>
Content-Type: multipart/alternative; boundary="000e0cd51c9eb634ea049e234214"
X-System-Of-Record: true
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] Masking only Payload/Extension Data
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, 10 Mar 2011 16:21:53 -0000

On Thu, Mar 10, 2011 at 10:36 AM, Andy Green <andy@warmcat.com> wrote:

> It is much cleaner protocol-wise to have consistent framing and mask inside
> the extension area and allows server traffic masking to be selected the same
> way.
>

While I agree it is awkward to not be able to have a totally separate layer
where the masking is removed (since you can't know the length of the masked
frames without looking inside the masking), I don't think anyone is going to
implement it that way.  Instead, what will happen is that a flag will be
passed in saying to expect a mask, and it is just as easy to read that mask
before the opcode/length as it is afterwards (whether doing it with blocking
reads or a state machine for processing the next available bytes).  So, I
don't really see how it makes much difference from an implementation point
of view.

Once that's done, if 4-byte recirculating xor with per-frame random key
> isn't enough, and we have been told it is not "enough" before if you recall,
> then it'll be easy to upgrade the protocol to use AES masking or whatever
> without breaking the framing.


I don't see a difference here either -- if in the future a more
sophisticated masking is required, an extension would be negotiated that
will change it.  Browsers could choose to drop connections if the server
didn't accept this extension after some transition period, and then the new
masking algorithm would be applied to what was going on the wire.  If you
wanted to support both, it is easy enough for that boolean flag to become an
enum specifying the type of masking to be applied.

Regarding the negative impact of masking outside the framing, remember it is
only transparent intermediaries we are worried about (which includes packet
sniffers) since they can only observe the handshake but can't participate in
it.  Thus, if an extension is negotiated they don't understand, they can't
do anything with the stream.  I don't see there is much that can be done
about it -- for example, imagine the deflate-stream extension in -06 was not
part of the standard but a later extension.  No intermediary would even be
able to find frame boundaries if they didn't understand the extension.

As for using wireshark/etc to debug it, a simple heuristic like looking at
the port should get 95% of it right, and the user can always force
interpretation as WebSocket-client or WebSocket-server if they don't capture
the handshake.  Other intermediaries that must operate independently (such
as sniffers enforcing policy) are going to have to see the handshake to do
their job, and they have to already distinguish WebSocket traffic from
others in order to do their job, and in the process they will know which
side they are looking at.

So, my position is that I am unconvinced of the benefits of moving the mask
after the opcode/length, but I also think the additional risk exposed by
doing so is minimal, so I don't feel to strongly about it.

-- 
John A. Tamplin
Software Engineer (GWT), Google