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

Scott Ferguson <ferg@caucho.com> Wed, 29 September 2010 16:58 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 0A9163A6EBF for <hybi@core3.amsl.com>; Wed, 29 Sep 2010 09:58:06 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.493
X-Spam-Level:
X-Spam-Status: No, score=-2.493 tagged_above=-999 required=5 tests=[AWL=0.106, 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 xGIlcWUoIZ8E for <hybi@core3.amsl.com>; Wed, 29 Sep 2010 09:58:04 -0700 (PDT)
Received: from smtp113.biz.mail.mud.yahoo.com (smtp113.biz.mail.mud.yahoo.com [209.191.68.78]) by core3.amsl.com (Postfix) with SMTP id 8E6573A6CBC for <hybi@ietf.org>; Wed, 29 Sep 2010 09:58:04 -0700 (PDT)
Received: (qmail 61964 invoked from network); 29 Sep 2010 16:58:43 -0000
Received: from [192.168.1.11] (ferg@66.92.8.203 with plain) by smtp113.biz.mail.mud.yahoo.com with SMTP; 29 Sep 2010 09:58:43 -0700 PDT
X-Yahoo-SMTP: L1_TBRiswBB5.MuzAo8Yf89wczFo0A2C
X-YMail-OSG: 6Ya1srYVM1kIYoPjd_k6a9NtxBDX0piP9KxX5Tnr9Qummlj u4Se_3BBdqpktplBErXnehHbpDTANUr0xwHGzE_b3J6F2kQPPqB1ljShwtqw yRoGfqV.0WSl63i8Z7O6tBpOu.UmEosaTJw2OJT829iuYQTH.RoFtmlMSg9N 5Kl49rWjFbdkkD6BkUOo996Y5hIHqdcOVcuW17aj78yNC3pb6Gcii1pPpHW3 f4uiUA.RBJS7bbGlnXPeVvleKUcRr0a2vqk11LOpT_1EuOPxVRledA76T5qP gU0rVIyh.wv4Iq5Hsc3lB8w--
X-Yahoo-Newman-Property: ymail-3
Message-ID: <4CA37038.4020907@caucho.com>
Date: Wed, 29 Sep 2010 09:58:32 -0700
From: Scott Ferguson <ferg@caucho.com>
User-Agent: Thunderbird 2.0.0.24 (X11/20100411)
MIME-Version: 1.0
To: Maciej Stachowiak <mjs@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> <F1C112EC-28AB-4CE2-9208-2517077E5EC2@apple.com> <4CA21A0F.2030608@caucho.com> <6470F2B1-F0A4-49FD-9EE3-7CEF5D355366@apple.com>
In-Reply-To: <6470F2B1-F0A4-49FD-9EE3-7CEF5D355366@apple.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: Wed, 29 Sep 2010 16:58:06 -0000

Maciej Stachowiak wrote:
>
> On Sep 28, 2010, at 9:38 AM, Scott Ferguson wrote:
>
>>
>> #2 is certainly a security benefit for servers. If a server provides 
>> a non-browser service, it needs the ability to authenticate. That 
>> should be an obvious security need.
>
> Can you explain the security benefit specifically of changing the 
> opcodes of the packets involved in the handshake? It's not clear to 
> me. A new authentication scheme may or may not have benefits on its 
> own, but changing the handshake message opcodes does not seem to make 
> any difference to this.

The opcode itself doesn't matter. It's the extension space for 
challenge/response authentication in the handshake payload that's the 
important added value. (It's not related to cross-protocol issues, but 
still an important security issue, because servers need to protect 
themselves against non-browser websockets clients.)

>>
>> Authentication is the goal here. The whole point of defeating a 
>> cross-protocol attack is authenticating both the client and the 
>> server as implementing the correct protocol. Once you've validated 
>> both sides as implementing websockets, then any attack is no longer a 
>> cross-protocol attack.
>>
>> The shared "secret" is the "WebSocket" value in the hash. For server 
>> authentication, H(c-nonce, "WebSocket"), only a websocket server will 
>> ever produce that hash because on a websocket server has that 
>> "secret". SMTP cannot produce that response because it don't have 
>> that secret (and doesn't produce hashes at all, of course.)
>
> This does not seem like a classical authentication problem to me. 
> There is no actual secret and no actual proof of identity. Rather, the 
> cross-protocol defense provided depends on the presumed inability of 
> stock servers or browser-hosted client code to send or meaningfully 
> process particular messages. For example, the security of this scheme 
> would be largely unaffected if the hash was not cryptographically 
> secure, which is surely not the case with actual authentication 
> schemes. Robustness against cross-protocol attacks is simply not the 
> same problem.

The server hash validation is stronger than your description, because 
it's also checking that the server is in possession of the "WebSocket" 
string (a "secret"), which is more than just checking that the server 
can calculate the hash.   A future protocol's server might calculate a 
hash just like WebSockets does, but it would not be in possession of the 
"WebSocket" string. The server's possession of that "secret" is proof of 
its identity as a websockets server.

For the client validation, the "WEBSOCKET" method would be sufficient by 
itself if it could never be produced by a hijacked browser. The 
H(s-nonce, "WebSocket") would be a bit of overkill in that case, but 
it's easy to produce and strengthens the defense against future protocol 
hijacking, not specifically HTTP clients.

And if the initial client bytes do not uniquely identify the protocol as 
WebSockets (e.g. "GET") or the bytes are hijackable, then you do need to 
validate the client with something like this hash and you would want to 
check that the client possesses the "WebSockets" string in a 
non-hijackable form. If a future protocol used a similar cross-protocol 
validation technique, the hash and "WebSocket" would distinguish a 
websocket client from the future hijacked protocol. That's a stronger 
protection than the -76 random bytes, because those bytes say 
"not-HTTP"; they don't identify it as "WebSocket".

But you're right, since cross-protocol validation is a weaker 
requirement than classical authentication, it doesn't need a 
cryptographically secure hash. The shared "secret" is not secret to the 
world; it's just a secret to any non-websocket server.

-- Scott

>
> Regards,
> Maciej
>