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

Greg Wilkins <gregw@webtide.com> Tue, 28 September 2010 09:36 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 9CFE83A6C9E for <hybi@core3.amsl.com>; Tue, 28 Sep 2010 02:36:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.739
X-Spam-Level:
X-Spam-Status: No, score=-1.739 tagged_above=-999 required=5 tests=[AWL=0.238, 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 vJIEN+VOog6E for <hybi@core3.amsl.com>; Tue, 28 Sep 2010 02:36:08 -0700 (PDT)
Received: from mail-pz0-f44.google.com (mail-pz0-f44.google.com [209.85.210.44]) by core3.amsl.com (Postfix) with ESMTP id A73F03A6C9B for <hybi@ietf.org>; Tue, 28 Sep 2010 02:36:08 -0700 (PDT)
Received: by pzk6 with SMTP id 6so1953244pzk.31 for <hybi@ietf.org>; Tue, 28 Sep 2010 02:36:49 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.142.133.8 with SMTP id g8mr7577193wfd.38.1285666609494; Tue, 28 Sep 2010 02:36:49 -0700 (PDT)
Received: by 10.142.165.19 with HTTP; Tue, 28 Sep 2010 02:36:49 -0700 (PDT)
In-Reply-To: <CA8029B0-71A3-44ED-88C6-934FE833BBA2@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>
Date: Tue, 28 Sep 2010 19:36:49 +1000
Message-ID: <AANLkTim+fXj-h6OS3OdcfVfh3Q1UwxD8NLVawb=AWHX+@mail.gmail.com>
From: Greg Wilkins <gregw@webtide.com>
To: hybi <hybi@ietf.org>
Content-Type: text/plain; charset="UTF-8"
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: Tue, 28 Sep 2010 09:36:09 -0000

Maciej,

taking our offline conversation back to the list (as you suggested), you said:

> I don't think you identified any effective defenses other than inability
> to send the intended form of the nonce (as a Sec- header).
>
> I would be glad to elaborate further on the list if that would be helpful.


I believe that more defences have been discussed than just the
inability to send the nonce. Specifically the following defences have
been identified (but perhaps not enumerated as thoroughly):

For a HTTP client to attack a WS server, the defences are:
 + The inability to send a nonce in a Sec-Header.
 + Reliance on the browser not treating the 101 response as an error.
 + The inability to read the ping frame after the 101 response.
 + The inability to send a pong frame
 + The inability to provide credentials (not otherwise available to
normal HTTP) to access authorized content
 + The inability to make a WS server send unauthorized content as
valid WS frames
 + The inability to provide credentials (not otherwise available to
normal HTTP) that might trigger server side effects
 + The inability to send a WS frame from a HTTP client that might
trigger server side effect.
 + That even if all of the above could be subverted, the attacker
would only have a capability (to talk WS), that we plan to have widely
available within the browser.


For a WS client to attack a HTTP server:
 + The inability to force intermediaries and servers to generate a 101 response
 + The inability to force a server to emit a ping frame after a 101 response
 + The inability to know what contents to put into a ping frame even
if one could be injected.
 + The inability to provide credentials (not otherwise available to
normal HTTP) to access authorized content
 + The inability for the server to send unauthorized content in a WS frame.
 + The inability to provide credentials not available to via a normal
HTTP request that might trigger some authorized side effect.
 + The inability to send valid HTTP requests from a WS client.
 + If all of the above could be subverted, then the existing browser
cross domain model could be broken and an attacker could view content
from a different domain. But if the server was injectable to such an
extent as to allow 101s and ping frames, then it is highly likely that
javascript code could be injected that would also break the cross
domain model without the use of WS.


For a WS client to some other protocol server:
 + The browser restricts the port range that can be the target of a WS
connection
 + Reliance on the server to not treat the HTTP handshake request as a
fatal error.
 + The inability to force the servers to generate a 101 response
 + The inability to force a server to emit a ping frame after a 101 response
 + The inability to know what contents to put into a ping frame even
if one could be injected.
 + The inability to force another protocol server to send unauthorized
content in a websocket frame.
 + The inability to provide credentials not available to via a normal
HTTP request that might trigger some authorized side effect.


For a WS client to attack a WS server:
 + The inability to force a server to send arbitrary origin headers,
so attacking code will not be from the same origin as the connection.

Note that these defences are essentially identical between -02 and my
proposal - ie they are not dependant on space encoding of nonces nor
the unframed transmission of nonces and hashes.

I'm not saying these defences are perfect, nor that they cannot be
improved. However I think that there are sufficient defences in depth
(except for WS to WS) that they cannot be simply dismissed without
some thorough detailed explanation.

regards