Re: [hybi] WebSocket handshake (HTTP and SSO)

Scott Ferguson <ferg@caucho.com> Wed, 01 September 2010 01:39 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 289563A68B1 for <hybi@core3.amsl.com>; Tue, 31 Aug 2010 18:39:05 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.51
X-Spam-Level:
X-Spam-Status: No, score=-2.51 tagged_above=-999 required=5 tests=[AWL=0.089, BAYES_00=-2.599]
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 CnkClvmhS6NB for <hybi@core3.amsl.com>; Tue, 31 Aug 2010 18:39:02 -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 CBC733A68AE for <hybi@ietf.org>; Tue, 31 Aug 2010 18:39:01 -0700 (PDT)
Received: (qmail 55167 invoked from network); 1 Sep 2010 01:39:29 -0000
Received: from [192.168.1.11] (ferg@66.92.8.203 with plain) by smtp111.biz.mail.re2.yahoo.com with SMTP; 31 Aug 2010 18:39:29 -0700 PDT
X-Yahoo-SMTP: L1_TBRiswBB5.MuzAo8Yf89wczFo0A2C
X-YMail-OSG: ZWao7N0VM1mnG_a1mWaNd8Q4CsfeNBi3N2YJcGQ7MN7waZp iDwVOX6IY6JCa3K47zh5UXrmX7YGjlcHm_B6EL08SoNP59VDkwDM3dHbpeJ9 9E2otMukna6EadoSsexxeKGYJEcIM2eX.8mdwExGhIGTp8pGXX9tBQnV8yet un6GaPkgPOtGG0EGpT71rUhfsfsTUidpwF1eSZWyfMLHgpERaBJGhhy56Ggh t5gP.LIQTPQKhqZYgpG24jIzLmO1ifVadnY4daiB95ayaly9q6hIWNUcDI._ 4b2y6uzCP95XQHNSmML6Rjn78BPf5vZINsL9pbQKZYLOFQFRAYIZcPWECek2 HMOzlAO.EVWu5XGYnWmKnQZK8gbgWeE0gXiIxEM5Iubv0M4pnSX.xeVn9Wmg ZbQEsuKiwXiGfJLP8hA--
X-Yahoo-Newman-Property: ymail-3
Message-ID: <4C7DAECB.7050905@caucho.com>
Date: Tue, 31 Aug 2010 18:39:23 -0700
From: Scott Ferguson <ferg@caucho.com>
User-Agent: Thunderbird 2.0.0.24 (X11/20100411)
MIME-Version: 1.0
To: Hector Santos <hsantos@isdg.net>
References: <4C7A269F.8020306@gmail.com> <AANLkTinqJ+K-pqm7p7S+aviWVY==S0mJ9RBvNfpnTa02@mail.gmail.com> <AANLkTikCVNoJnKXTOTJadYJWYR356u1wZdVNdBwEh6cg@mail.gmail.com> <AANLkTik3Jo4rG8cTcHerpwPumT_X77bn9y5rDkZ8ZD33@mail.gmail.com> <AANLkTimabr-0gVy1Jpr0=i-Wfv6u-AnD+ReNvb0eajYO@mail.gmail.com> <4C7BDA8F.4080107@caucho.com> <4C7BF060.7070501@isdg.net> <4C7C2A33.6010405@caucho.com> <4C7C746F.1040006@isdg.net> <4C7D2B74.8030702@caucho.com> <4C7D5B20.9030503@isdg.net>
In-Reply-To: <4C7D5B20.9030503@isdg.net>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Cc: hybi <hybi@ietf.org>, Brodie Thiesfield <brodie@jellycan.com>
Subject: Re: [hybi] WebSocket handshake (HTTP and SSO)
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, 01 Sep 2010 01:39:05 -0000

Hector Santos wrote:
> Scott Ferguson wrote:
>> Hector Santos wrote:
>>
>> DIGEST is a challenge/response style authentication, which means it 
>> uses a challenge from the server before sending its credentials. 
>> BASIC just sends the user and credentials in clear text.
>
> Sorry, missed this (not so) subtle point. BASIC does not require an 
> initial server challenge hence it can work unsolicited.

Exactly.

>
>>> Also probably related, I see no security benefit in this handshake. 
>>> The bad guy client can always validate a server handshake response 
>>> whether it was correct or not.
>>
>> I don't understand. A bad client can't generate the correct 
>> authentication credentials. That's the whole point of authentication.
>
> I was referring to the websocket client random data and the websocket 
> server "reassembly" and response.
>
> Well, bad guys will most like implement websocket clients which ignore 
> the server response (always accept it) and simply move the ready state 
> to open, and fire the onOpen.  I didn't see how this challenge helps 
> except maybe to mitigate MITM threats.
>

Oh.

I think what it's trying to do is validate that the client is a 
websocket client and the server is a websocket server before sending any 
content that might be an attack (like a SMTP mail message or printer 
commands.)

Here's what I think the protocol is trying to do (the actual algorithm 
is obscure):

a) To validate the server as websocket server (as opposed to a SMTP 
server), the client creates a securely-generated random nonce, c_nonce 
and sends it in C1. The server sends back a hash in S2, like H(c_nonce, 
"WebSocket"). Since no server other than a websocket server will 
generate that hash, you've verified that the server is a websocket server.

b) To validate the client as a websocket client (as opposed to a 
hijacked HTTP client), the server sends a securely-generated random 
nonce, s_nonce and sends it in S2. The client sends a hash back in C3, 
like H(s_nonce, "WebSocket"). Since no hijacked non-websocket client can 
generate that hash, you've verified that the client is a websocket client.

So now the websocket protocol is free to run, having verified that the 
client and server are both websocket implementations.  Of course, those 
websocket implementations might be hijacked too, or the attacking client 
might be a non-browser valid websocket client but that's a different 
story (or rather, it's the same story as my request for authentication 
support, but unrelated to the security fields in the current protocol.)

Or at least, I think that's what the protocol is trying to do. To me, it 
looks like a security -through-confusion protocol hacked together by 
someone with little security experience, who believes that a 
complicated, confusing protocol is more secure than a straightforward 
one. If no one can understand it, no one can attack it, I guess. That's 
just what it looks like to me.

-- Scott



-- Scott