Re: [hybi] A WebSocket handshake

Adam Barth <ietf@adambarth.com> Wed, 06 October 2010 14:23 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 C8E063A6F84 for <hybi@core3.amsl.com>; Wed, 6 Oct 2010 07:23:54 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.991
X-Spam-Level:
X-Spam-Status: No, score=-1.991 tagged_above=-999 required=5 tests=[AWL=-0.014, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622]
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 mJb-F2Q6yOdj for <hybi@core3.amsl.com>; Wed, 6 Oct 2010 07:23:53 -0700 (PDT)
Received: from mail-vw0-f44.google.com (mail-vw0-f44.google.com [209.85.212.44]) by core3.amsl.com (Postfix) with ESMTP id A88243A6F72 for <hybi@ietf.org>; Wed, 6 Oct 2010 07:23:53 -0700 (PDT)
Received: by vws10 with SMTP id 10so3017vws.31 for <hybi@ietf.org>; Wed, 06 Oct 2010 07:24:53 -0700 (PDT)
Received: by 10.220.176.141 with SMTP id be13mr790753vcb.225.1286375093410; Wed, 06 Oct 2010 07:24:53 -0700 (PDT)
Received: from mail-yx0-f172.google.com (mail-yx0-f172.google.com [209.85.213.172]) by mx.google.com with ESMTPS id r15sm1356740vbp.0.2010.10.06.07.24.51 (version=SSLv3 cipher=RC4-MD5); Wed, 06 Oct 2010 07:24:52 -0700 (PDT)
Received: by yxl31 with SMTP id 31so3044138yxl.31 for <hybi@ietf.org>; Wed, 06 Oct 2010 07:24:51 -0700 (PDT)
Received: by 10.231.15.203 with SMTP id l11mr13871275iba.182.1286375088722; Wed, 06 Oct 2010 07:24:48 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.231.149.20 with HTTP; Wed, 6 Oct 2010 07:24:18 -0700 (PDT)
In-Reply-To: <20101006082037.GB22844@1wt.eu>
References: <AANLkTimQ5x-v+Mz_OHrNDdtVd94E+HOBWwo3_f1ktEeg@mail.gmail.com> <20101006053400.GC20095@1wt.eu> <AANLkTiknEw7SAQH_fbm-YkXvDpOQZavduM2D+JvpiGDf@mail.gmail.com> <20101006082037.GB22844@1wt.eu>
From: Adam Barth <ietf@adambarth.com>
Date: Wed, 06 Oct 2010 07:24:18 -0700
Message-ID: <AANLkTimwhr4YbjChYC9Ki=zWqrx8fTQv0JaYkLRPkXQ+@mail.gmail.com>
To: Willy Tarreau <w@1wt.eu>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] A WebSocket handshake
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: Wed, 06 Oct 2010 14:23:54 -0000

On Wed, Oct 6, 2010 at 1:20 AM, Willy Tarreau <w@1wt.eu> wrote:
> On Tue, Oct 05, 2010 at 11:57:40PM -0700, Adam Barth wrote:
>> On Tue, Oct 5, 2010 at 10:34 PM, Willy Tarreau <w@1wt.eu> wrote:
>> > Adam, could you please recheck the importance for this handshake to
>> > have the invalid hostname ? It really is the only blocking issue I
>> > can think of. If it is absolutely needed, maybe we could use something
>> > like "<valid-hostname>.websocket.invalid" instead so that at least the
>> > server-side components can route the request to the proper location ?
>>
>> Using an invalid host name is important because we don't want the
>> attacker to be able to choose any of the bytes in the initial message.
>
> OK I understand your point, but this is no different from what the
> attacker can already do with plain HTTP.

Please read the document.  If that were true, we could just use the
initial POST strawman.

>> Of course, virtual hosting is important.  We'll probably want to
>> include the real Host header in the encrypted "additional information"
>> sent with the initial handshake message so that the WebSocket server
>> can dispatch the connection to the appropriate virtual host.
>
> Except that right now the virtual hosting it handled at the boundary
> and the websocket will be handled at the internals. That said, the
> host part of a URL must at least respect the limited charset of the
> DNS system. We don't have the %-encoding of the plain URLs.

Please read the document.  That's true and intentional.  We want the
server to understand that it's talking WebSockets before it dispatches
the request to a particular virtual host.  That prevents a single
virtual host from opting into a WebSocket connection on behalf of the
entire host.  If the real host doesn't understand what's going on, it
could get confused and let the attacker do nasty things.

Adam