Re: [hybi] Web sockets and existing HTTP stacks

Roberto Peon <fenix@google.com> Wed, 03 February 2010 17:55 UTC

Return-Path: <fenix@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 01F303A6A7F for <hybi@core3.amsl.com>; Wed, 3 Feb 2010 09:55:24 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -105.727
X-Spam-Level:
X-Spam-Status: No, score=-105.727 tagged_above=-999 required=5 tests=[AWL=0.249, 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 0NEUvXQIMM0k for <hybi@core3.amsl.com>; Wed, 3 Feb 2010 09:55:23 -0800 (PST)
Received: from smtp-out.google.com (smtp-out.google.com [216.239.33.17]) by core3.amsl.com (Postfix) with ESMTP id 923463A693E for <hybi@ietf.org>; Wed, 3 Feb 2010 09:55:22 -0800 (PST)
Received: from wpaz29.hot.corp.google.com (wpaz29.hot.corp.google.com [172.24.198.93]) by smtp-out.google.com with ESMTP id o13Hu3ql013658 for <hybi@ietf.org>; Wed, 3 Feb 2010 17:56:04 GMT
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1265219764; bh=/d7Y8NfC6mBm6cSxJNO4YCGHJgY=; h=MIME-Version:In-Reply-To:References:Date:Message-ID:Subject:From: To:Cc:Content-Type; b=H7HOjGotBOi1KxEUFXDHV7xQ3aGcT7NiJr+chQQ2+JfwcOp1U4WK1NXt6VM3OU3nP aQTeXpAylJyNA9UKH9Saw==
DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=mime-version:in-reply-to:references:date:message-id:subject:from:to: cc:content-type:x-system-of-record; b=RX53tT0WXEiwFYMfpKI5nkIPP6K/3p1HfJd7pp5lGVhdY8zZP25/Z/+dSvsQIJ9Yw KhjdGqEuHOhaHAIoAxOAg==
Received: from pxi38 (pxi38.prod.google.com [10.243.27.38]) by wpaz29.hot.corp.google.com with ESMTP id o13HtEMP025736 for <hybi@ietf.org>; Wed, 3 Feb 2010 09:56:02 -0800
Received: by pxi38 with SMTP id 38so1717162pxi.28 for <hybi@ietf.org>; Wed, 03 Feb 2010 09:56:02 -0800 (PST)
MIME-Version: 1.0
Received: by 10.142.7.38 with SMTP id 38mr5223413wfg.179.1265219762323; Wed, 03 Feb 2010 09:56:02 -0800 (PST)
In-Reply-To: <7CB6EE56-B840-4368-ABAF-C8AA1CCE6600@apple.com>
References: <557ae280911171402v7546e5e7n93a1e57f87dc10e5@mail.gmail.com> <ad99d8ce1002012139l3b8f525bj9caf7861332f3d18@mail.gmail.com> <1427E183-FDBC-4854-9455-B93AB28DAB03@apple.com> <ad99d8ce1002012343n132169f8wbaacc1cf4efe2f87@mail.gmail.com> <31123817-6D3F-489D-9F48-109AC93E6769@apple.com> <ad99d8ce1002030000i566f3517qddf4e62f386c9211@mail.gmail.com> <4B692EDB.1060300@gmx.de> <E9DF7FE9-70F0-4268-8CEF-1007D71F9FBB@apple.com> <ad99d8ce1002030107i5994c847yf639b660dc64cdc9@mail.gmail.com> <7CB6EE56-B840-4368-ABAF-C8AA1CCE6600@apple.com>
Date: Wed, 03 Feb 2010 09:56:02 -0800
Message-ID: <ad99d8ce1002030956w7503957eg8bd6e88da66a884a@mail.gmail.com>
From: Roberto Peon <fenix@google.com>
To: Maciej Stachowiak <mjs@apple.com>
Content-Type: multipart/alternative; boundary="00504502ae8e7f017b047eb5eee6"
X-System-Of-Record: true
Cc: hybi@ietf.org
Subject: Re: [hybi] Web sockets and existing HTTP stacks
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, 03 Feb 2010 17:55:24 -0000

On Wed, Feb 3, 2010 at 2:02 AM, Maciej Stachowiak <mjs@apple.com> wrote:

>
> On Feb 3, 2010, at 1:07 AM, Roberto Peon wrote:
>
> >
> > How exactly does the random bit of text in the first line help?
>
> In the case of a cross-protocol attack against HTTP, it's likely harder to
> inject text into the status line than it is to inject a response header, so
> that's the reason why it is in the first line. In the case of a
> cross-protocol attack against other protocols, in general it's harder to
> mess with the very beginning of the server response than the end (though not
> always).
>
> The text is not random, it is a hash of some information from the request.
> The reason for the particular nature of the bit of text is to further
> increase the challenge of cross-protocol attacks by requiring the handshake
> response to contain something that (a) cannot be predicted before client JS
> tries to initiate the connection; and (b) is not a verbatim echo of anything
> in the handshake request. So even if you can find a server that will echo
> back exact text of your choice, or pieces of the request of your choice, you
> cannot make it return what appears to be a valid handshake response.
>

You can still do this as an HTTP header.


>
> > You still have to frame the HTTP response, which means that any errors in
> that framing are going to be causing problems.
>
> I don't understand what kinds of problems you have in mind, could you
> clarify?
>

HTTP header injection problems: If it is possible, you can get interesting
things to happen. This true of anything which is attempting to frame HTTP,
and thus isn't limited to WebSockets, however, when it happens on a server
there is no way to recover safely. The real problem with these is that the
server has no idea that it happened without scanning its own output to see
that it is framed the way it expects (and I don't know of any server which
does this).


>
> > In other words, the response will always be as insecure as HTTP. No way
> around that while still using HTTP. And, as we've already covered, not using
> HTTP isn't a terribly good option while on port 80 until the upgrade has
> finished.
>
> Again, I don't know what you mean by "as insecure as HTTP". Specifically
> what we're worried about here are cross-protocol attacks (both using
> WebSocket and against a WebSocket service). The fact that the handshake
> format is an HTTP request does increase the risk in both directions, but we
> can do things to mitigate it. If you think my proposed defense is
> ineffective, could you explain how?
>

MitM still works just fine even with the hash value.
What is the attack vector that you see mitigated? I may just not be seeing
it.

-=R


> Regards,
> Maciej
>
>