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

Scott Ferguson <ferg@caucho.com> Sat, 02 October 2010 00:44 UTC

Return-Path: <ferg@caucho.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 94C6D3A6DEF for <hybi@core3.amsl.com>; Fri, 1 Oct 2010 17:44:31 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.226
X-Spam-Level:
X-Spam-Status: No, score=-2.226 tagged_above=-999 required=5 tests=[AWL=-0.227, BAYES_00=-2.599, J_CHICKENPOX_14=0.6]
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 3xKsRMWraF1y for <hybi@core3.amsl.com>; Fri, 1 Oct 2010 17:44:30 -0700 (PDT)
Received: from smtp111.biz.mail.re2.yahoo.com (smtp111.biz.mail.re2.yahoo.com [66.196.116.96]) by core3.amsl.com (Postfix) with SMTP id 721093A6D91 for <hybi@ietf.org>; Fri, 1 Oct 2010 17:44:30 -0700 (PDT)
Received: (qmail 57574 invoked from network); 2 Oct 2010 00:45:18 -0000
Received: from [192.168.1.11] (ferg@66.92.8.203 with plain) by smtp111.biz.mail.re2.yahoo.com with SMTP; 01 Oct 2010 17:45:17 -0700 PDT
X-Yahoo-SMTP: L1_TBRiswBB5.MuzAo8Yf89wczFo0A2C
X-YMail-OSG: xgXXtlQVM1lGMbmqLpuQvMfy4u_EunAxJWzrMwmIRb7SzG1 lUzS.PDI.AMI54bcZvRuAB3dM2kpXQs64ACGyHcLntobZHd0a8cMZKXi946Q rx2tjhQNLbKFEaYvV6PWMCeEpHe1F1ggQbM9xROXudtwZ4fddoIlLt3cS7xq mQkMsxJPo9Y2tTekcLk2y89NEplv60nVqHjqWD5csDK_s1UifL32ruDz3JWc XHLitofu8Bn.mwMXtqTWrBV34V1x9LMpFdDToORDaspwlpxjXsf6a107uqMc NyDNo_hWQakz5llolPFzTmRn_IApD7CE1s.9saOz8eKpEfqdFpwlcLoVrDTM 8_JEVToEVE0AM7bVzae9SEd_cejH83wlRC2WR7toDMY590U2R3dsTHYbXXfG iD1UzKrO3LPZwuWrbmOJlxrCAKSnaFYmGKwXjnkAcvpS4Gmbm3DU-
X-Yahoo-Newman-Property: ymail-3
Message-ID: <4CA68098.8010404@caucho.com>
Date: Fri, 01 Oct 2010 17:45:12 -0700
From: Scott Ferguson <ferg@caucho.com>
User-Agent: Thunderbird 2.0.0.24 (X11/20100411)
MIME-Version: 1.0
To: Adam Barth <ietf@adambarth.com>
References: <AANLkTikszM0pVE-0dpZ2kv=i=y5yzS2ekeyZxtz9N=fQ@mail.gmail.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> <AANLkTik9igUwoxVrktoBoZrPoUW=Tjh7HyVbGJgQYes-@mail.gmail.com> <9F595226-FA0A-4C38-A6D0-0F4214BD7D21@apple.com> <4CA4BE10.1010709@caucho.com> <AANLkTi=wKFnNOuM+U3fktAFRn3R5OZ7c6PR2W3EAy7tm@mail.gmail.com> <4CA53E6B.1040808@caucho.com> <AANLkTikOyvF5AHTf4sDD=rWmK2FTD6R6LaHa4KTqkbcm@mail.gmail.com>
In-Reply-To: <AANLkTikOyvF5AHTf4sDD=rWmK2FTD6R6LaHa4KTqkbcm@mail.gmail.com>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
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: Sat, 02 Oct 2010 00:44:31 -0000

Adam Barth wrote:
> On Thu, Sep 30, 2010 at 6:50 PM, Scott Ferguson <ferg@caucho.com> wrote:
>   
>> To repeat the key pieces:
>>  a) c-nonce must not be available to or predictable by the hijacker
>>  b) "WebSocket" is not possessed by a non-websocket server
>>     
>
> You're making a bunch of assumptions about how non-websocket servers
> behave.  In particular, consider a protocol like DNS.  It's entirely
> possible that a DNS-like protocol could relay the c-nonce to the
> attacker and give the attacker an opportunity to response with the
> appropriate hash, which the server would then relay to the client.
> Attacks of this general class (even against DNS) are known for HTTP.
>   

No, Adam, you can't just handwave that scenario. Let's take your attack 
in detail.

  1) Hijacker has taken control of a browser and initiates a websocket 
connection.
  2) That websocket connection is to a DNS server.
  3) The DNS server relays the c-nonce to the hijacked browser (???)

       browser -> DNS -> browser

  4) The hijacked browser can now compute H(c-nonce, "WebSocket")
  5) The browser somehow sends the H(c-nonce, "WebSocket") to the DNS 
proxy which now that it has the hash redirects to the actual target, 
which echos the hash through the theoretical proxy chain. Or it acts as 
a web-socket relay itself

       browser -> DNS -> browser -> target

None of which makes any sense.

I am making some assumptions:

  1) there are no websocket open relays. If there are, the issue isn't a 
cross-protocol attack, but an open relay attack. Your description 
proposes the browser itself as a websocket open relay ("could relay the 
c-nonce to the attacker").

  2) there are no open relays that compute H(xxxx, "WebSocket") or open 
relays that calculate arbitrary hashes H(xxxx).  Your proposed DNS 
attack does neither, nor does it propose a relay that does calculate 
either. Instead, you handwave to the hijacked browser itself as an open 
websocket relay.

> The security of this protocol relies on more assumptions than you've
> listed in your message.  Reasoning about security here is very subtle,
> especially when reasoning about the behavior of non-WebSocket servers.
>  We need to be prepared for them to do a wide variety of things.
>   

This statement is not particularly useful.

If you assume the existence of open relays which implement arbitrary 
protocols and compute arbitrary functions, that's equivalent to assuming 
the relay is a valid websocket proxy, which is no longer a 
cross-protocol attack.

Does your "wide variety of things" include calculation of arbitrary hashes?

> As a side note, using an exotic HTTP method is not a good idea.  The
> first few bytes of the clients initial message are absolutely
> critical.  Picking an exotic HTTP method is just rolling the dice
> w.r.t. what protocols an attacker can exploit.  For example, some
> attacks from HTTP to DNS rely critically on the fact that the first
> byte of an HTTP POST message is an uppercase P.  The kinds of things
> you can do with an uppercase W as the first byte are largely
> unstudied.
>   

You misunderstand entirely.

It's not an exotic HTTP method; it's identifying the protocol by the 
initial sequence of bytes.

If every client for every protocol sent a non-hijackable unique protocol 
identifier as its initial sequence, and every server for every protocol 
verified the protocol identifier before accepting any further bytes, 
then cross protocol attacks would be impossible.

We can't fix the older protocols that don't identify themselves 
immediately and don't validate, but we can ensure that new protocols do.

-- Scott