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

Scott Ferguson <ferg@caucho.com> Tue, 28 September 2010 17:40 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 22DCC3A6E15 for <hybi@core3.amsl.com>; Tue, 28 Sep 2010 10:40:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.339
X-Spam-Level:
X-Spam-Status: No, score=-1.339 tagged_above=-999 required=5 tests=[AWL=-1.140, BAYES_00=-2.599, J_CHICKENPOX_22=0.6, J_CHICKENPOX_24=0.6, J_CHICKENPOX_25=0.6, J_CHICKENPOX_47=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 6RdiKPgDKBFW for <hybi@core3.amsl.com>; Tue, 28 Sep 2010 10:40:57 -0700 (PDT)
Received: from smtp114.biz.mail.mud.yahoo.com (smtp114.biz.mail.mud.yahoo.com [209.191.68.79]) by core3.amsl.com (Postfix) with SMTP id 339183A6E0D for <hybi@ietf.org>; Tue, 28 Sep 2010 10:40:57 -0700 (PDT)
Received: (qmail 29983 invoked from network); 28 Sep 2010 17:41:37 -0000
Received: from [192.168.1.11] (ferg@66.92.8.203 with plain) by smtp114.biz.mail.mud.yahoo.com with SMTP; 28 Sep 2010 10:41:37 -0700 PDT
X-Yahoo-SMTP: L1_TBRiswBB5.MuzAo8Yf89wczFo0A2C
X-YMail-OSG: vzkbSOcVM1kSUBOYjctxvJK.gJs12ozNxQFVY4xqTbVZxCp U.oOjFuGfsucLv9AsxVYhSuYZ9MA2IEEkkUO8O9bqbImc8LEtRcho8PHjokV mhqLUfyZF7o0I8w1JUzPEYwFJ4meCXGClEEeTqbFIsa00VG.0QkhpVptAgqM xLwiES55XXEqzYKJNlfKWIFejBIbMa4zYuByt5heKpuuAiVjluYX7rK_5V9y W1YO6muS_V4oRBQZjwp3ybJoKGjgbEkCudPvD6ZXE_5REI71kP1hi3tBB5GG YxDR8ya6e6BsW.Mt93EpxdmaR11i8.MflmFcoe32zUokiF3RNwX3NZQ--
X-Yahoo-Newman-Property: ymail-3
Message-ID: <4CA228D0.1070400@caucho.com>
Date: Tue, 28 Sep 2010 10:41:36 -0700
From: Scott Ferguson <ferg@caucho.com>
User-Agent: Thunderbird 2.0.0.24 (X11/20100411)
MIME-Version: 1.0
To: Greg Wilkins <gregw@webtide.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>
In-Reply-To: <AANLkTimrMfXrnVMjU3f57L_sO7usyYQ56rBM4aMb2Pfr@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"; 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: Tue, 28 Sep 2010 17:40:59 -0000

Greg Wilkins wrote:
> On 28 September 2010 09:26, Scott Ferguson <ferg@caucho.com> wrote:
>   
>> Greg Wilkins wrote:
>>     
>>> Scott,
>>>
>>> yes - I glossed over the details of what the actual hash should be in
>>> the ping packet.  I believe H(c-nonce, "WebSocket") is a good hash
>>> that indicates the server is a WS.
>>>       
>> That's not quite the issue. It's the second hash in the PONG that's missing,
>> because we also need to verify the client as a WS client and not a hijacked
>> HTTP client (or hijacked future non-websocket client):
>>     
>
> OK, I've got it.
>
> For your proposal of a server nonce, then a HELLO op-code is more
> appropriate than ping/pong as the pong should normally contain the
> same content as the ping.
>
> So my proposal was:
>
> HTTP(upgrade,nonce)   -->
> <-- HTTP(101)
> <-- WS(ping,hash(nonce,"WebSocket"))
> [ <-- * WS(op, data)  ]
> --> WS(pong,hash(nonce,"WebSocket"))   ; client calls onOpen
> [ * WS(op, data) -->  ]
>
>
> Your amendment is
>
> HTTP(upgrade,c-nonce)   -->
> <-- HTTP(101)
> <-- WS(hello,hash(c-nonce,"WebSocket"),s-nonce)
> [ <-- * WS(op, data)  ]
> --> WS(hello,hash(s-nonce,"WebSocket"))   ; client call onOpen
> [ * WS(op, data) -->  ]
>   

Exactly.

>
> I'm not 100% convinced that the server nonce is really necessary, as
> the client has already been validated by sending Sec-Headers and the
> upgrade in the first place, and the contents of the ping message must
> be copied into a pong message (and is not predictable if the nonce is
> hidden from the client).
>
> But if we want defence in depth, then the second hash of a s-nonce is
> an good way to achieve this.
>   
Yep.

The s-nonce gives the server control over the validation of the client, 
because the server controls the quality of the s-nonce. Otherwise, it 
would be relying on the quality of hijacked client's c-nonce and the 
client's own headers to validate the client. Since the client validation 
protects the websocket server, it makes sense for the server to have 
that control.

-- Scott
> cheers
>
>
>
>