Re: [hybi] Handshake was: The WebSocket protocol issues.

Greg Wilkins <gregw@webtide.com> Wed, 29 September 2010 10:28 UTC

Return-Path: <gregw@webtide.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 22BE03A6C71 for <hybi@core3.amsl.com>; Wed, 29 Sep 2010 03:28:08 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.741
X-Spam-Level:
X-Spam-Status: No, score=-1.741 tagged_above=-999 required=5 tests=[AWL=0.236, 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 pYcOgsoAgnA5 for <hybi@core3.amsl.com>; Wed, 29 Sep 2010 03:28:03 -0700 (PDT)
Received: from mail-iw0-f172.google.com (mail-iw0-f172.google.com [209.85.214.172]) by core3.amsl.com (Postfix) with ESMTP id 8802E3A6C5E for <hybi@ietf.org>; Wed, 29 Sep 2010 03:28:03 -0700 (PDT)
Received: by iwn3 with SMTP id 3so1036127iwn.31 for <hybi@ietf.org>; Wed, 29 Sep 2010 03:28:46 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.231.162.2 with SMTP id t2mr1568298ibx.57.1285756126527; Wed, 29 Sep 2010 03:28:46 -0700 (PDT)
Received: by 10.231.39.199 with HTTP; Wed, 29 Sep 2010 03:28:46 -0700 (PDT)
In-Reply-To: <9746E847-DC8B-45A7-ADF3-2ADB9DA7F82E@apple.com>
References: <AANLkTikszM0pVE-0dpZ2kv=i=y5yzS2ekeyZxtz9N=fQ@mail.gmail.com> <62B5CCE3-79AF-4F60-B3A0-5937C9D291D7@apple.com> <AANLkTikKc+4q_Q1+9uDo=ZpFF6S49i6vj2agZOGWVqKm@mail.gmail.com> <E2D38FF3-F1B9-4305-A7FC-A9690D2AEB4A@apple.com> <AANLkTikRYB_suPmSdH3uzGmdynozECRszDx+BpUvtZ4h@mail.gmail.com> <5CBF797D-A58E-4129-96B3-164F6E7409B9@apple.com> <4CA0D0D2.4040006@caucho.com> <AANLkTinACqm-GxUPhvFMf6_sGfeJofwy1r=28o=vgM43@mail.gmail.com> <4CA12810.8020006@caucho.com> <AANLkTimrMfXrnVMjU3f57L_sO7usyYQ56rBM4aMb2Pfr@mail.gmail.com> <20100928052501.GD12373@1wt.eu> <CA8029B0-71A3-44ED-88C6-934FE833BBA2@apple.com> <AANLkTim+fXj-h6OS3OdcfVfh3Q1UwxD8NLVawb=AWHX+@mail.gmail.com> <4FAC5C93-9BDF-4752-AFBC-162D718397AB@apple.com> <AANLkTikcH1W3bQwumqHbe-Yqa3XdoJqCa2b-mZuvoQ7g@mail.gmail.com> <9746E847-DC8B-45A7-ADF3-2ADB9DA7F82E@apple.com>
Date: Wed, 29 Sep 2010 20:28:46 +1000
Message-ID: <AANLkTik9igUwoxVrktoBoZrPoUW=Tjh7HyVbGJgQYes-@mail.gmail.com>
From: Greg Wilkins <gregw@webtide.com>
To: Maciej Stachowiak <mjs@apple.com>
Content-Type: text/plain; charset="UTF-8"
Cc: hybi <hybi@ietf.org>
Subject: Re: [hybi] Handshake was: The WebSocket protocol issues.
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, 29 Sep 2010 10:28:08 -0000

On 29 September 2010 18:56, Maciej Stachowiak <mjs@apple.com> wrote:
> The raw HTTP request can include a body, which is sent immediately, rather
> than waiting for the remainder of the handshake. The body can include
> content framed as WS protocol messages. A WebSocket client will wait until
> the handshake is complete. So yes, the possibility of attempting an HTTP
> connection to a WebSocket server does create additional attack surface.

But how is the HTTP header going to be skipped by the WS server in
order for it to find these encapsulated WS messages?

Both a HTTP server and a WS server will consume all of any HTTP
request sent to it, so content will not be mistaken as new messages.

It is not sufficient just to send WS frames over the wire.  You have
to explain how they are
going to be sent so that a server will actually read them and
interpret them WS messages.



> I suspect -76 is not strong enough, but it is slightly stronger in some
> specific ways. First, by spreading the data across multiple header fields
> and incorporating whitespace, it makes it slightly trickier to do injection
> attacks.

Why is hex encoding simpler to inject than the space/char injected
decimal encoding?
The white space fields originate from the client and do not need to be
injected into
the server response.

Can you explain any scenario where a HTTP client could somehow send Sec- fields
without spaces, but could not send ones with spaces?

Also I've not proposed having only a single key field. We can still
have two fields,
so thus require data from multiple header fields.


I think the bulk of your concerns are about HTTP handshakes in general and
not specifically about my proposals to fix the handshake issues that
we have now.
Let's not forget that the current handshake with unframed random bytes
is causing
real problems with intermediaries now - so it needs to be fixed.


regards