Re: [hybi] handshake security (was: Frame size)

"Thomson, Martin" <Martin.Thomson@andrew.com> Mon, 19 April 2010 04:01 UTC

Return-Path: <Martin.Thomson@andrew.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 436B13A6817 for <hybi@core3.amsl.com>; Sun, 18 Apr 2010 21:01:00 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.62
X-Spam-Level:
X-Spam-Status: No, score=-0.62 tagged_above=-999 required=5 tests=[AWL=-0.621, BAYES_50=0.001]
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 KLjwShK0paKl for <hybi@core3.amsl.com>; Sun, 18 Apr 2010 21:00:59 -0700 (PDT)
Received: from csmailgw2.commscope.com (csmailgw2.commscope.com [198.135.207.242]) by core3.amsl.com (Postfix) with ESMTP id 43B4E3A6808 for <hybi@ietf.org>; Sun, 18 Apr 2010 21:00:59 -0700 (PDT)
Received: from [10.86.20.103] ([10.86.20.103]:24541 "EHLO ACDCE7HC2.commscope.com") by csmailgw2.commscope.com with ESMTP id S216909Ab0DSEAu (ORCPT <rfc822; hybi@ietf.org>); Sun, 18 Apr 2010 23:00:50 -0500
Received: from SISPE7HC2.commscope.com (10.97.4.13) by ACDCE7HC2.commscope.com (10.86.20.103) with Microsoft SMTP Server (TLS) id 8.1.436.0; Sun, 18 Apr 2010 23:00:50 -0500
Received: from SISPE7MB1.commscope.com ([fe80::9d82:a492:85e3:a293]) by SISPE7HC2.commscope.com ([fe80::58c3:2447:f977:57c3%10]) with mapi; Mon, 19 Apr 2010 12:00:47 +0800
From: "Thomson, Martin" <Martin.Thomson@andrew.com>
To: Ian Hickson <ian@hixie.ch>
Date: Mon, 19 Apr 2010 12:02:15 +0800
Thread-Topic: [hybi] handshake security (was: Frame size)
Thread-Index: AcrfabHgI+mVtvQdRjaEEnEwEogTWgABkMcw
Message-ID: <8B0A9FCBB9832F43971E38010638454F03E7D0682D@SISPE7MB1.commscope.com>
References: <8B0A9FCBB9832F43971E38010638454F03E3F313ED@SISPE7MB1.commscope.com> <Pine.LNX.4.64.1004161940180.751@ps20323.dreamhostps.com> <8B0A9FCBB9832F43971E38010638454F03E7D0678C@SISPE7MB1.commscope.com> <Pine.LNX.4.64.1004190009190.751@ps20323.dreamhostps.com> <8B0A9FCBB9832F43971E38010638454F03E7D067A9@SISPE7MB1.commscope.com> <Pine.LNX.4.64.1004190159340.751@ps20323.dreamhostps.com>
In-Reply-To: <Pine.LNX.4.64.1004190159340.751@ps20323.dreamhostps.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
acceptlanguage: en-US
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-BCN: Meridius 1000 Version 3.4 on csmailgw2.commscope.com
X-BCN-Sender: Martin.Thomson@andrew.com
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] handshake security (was: Frame size)
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: Mon, 19 Apr 2010 04:01:00 -0000

> > Invent a scenario for me.  How does this allow the attacker to gain
> the
> > nuclear launch codes?
> 
> There's no way to extract data in such a scenario, as far as I am
> aware,
> unless the subprotocol supports a way to trigger data to be sent out of
> band. To use your analogy, the risk is not getting nuclear launch
> codes,
> it's just launching the nukes.
> 
> Suppose an author wrote a Web Socket server that launches nukes upon
> request. The server is in on a secure intranet, and all users are
> trusted,
> so there's no authentication required. The server therefore can ignore
> the
> handshake, and just needs to scan for frames that have the request.
> 
> There's no way for an attacker on hostile.example.com to open a Web
> Socket
> connection to nukes.intranet.example, since the browser would read the
> handshake from nukes.intranet.example before allowing a frame to be
> sent,
> and the handshake says that only the origin nukes.intranet.example is
> allowed. However, hostile.example.com can instead do an XHR or form
> submission to nukes.intranet.example, with the payload being carefully
> crafted to contain just a frame causing a nuke. The server would
> receive
> it, ignore the (wrong) handshake, see the frame, and set off the nukes.
> A
> worker browsing the Web with a computer on that intranet who happens to
> go
> to hostile.example.com could, without their knowledge, fire the nukes.

Thank you.  I think that I understand your scenario a little better.

> The new handshake works around this (as described in the message above)
> by
> requiring that the server prove that it checked the handshake. In the
> scenario above, the server would fail to find the right information to
> create that proof; there is a much better chance that the author would
> then bail rather than continue trying to listen for further frames.

Post mortem detection of the problem doesn't solve anything.  If the browser has sent the XHR blindly, the damage is done by the time that it learns that the server is a dumb WS implementation.  You can't go and stuff the missiles back in their silos.

The thing is, this sort of indication (i.e. that the server is a WS server) is made clearer by the presence of the "Upgrade: " header in the 101 response (or the presence of the response itself).

If the server only looks for certain markers, then I imagine that an SMTP message could trigger launch in the same fashion.  It doesn't stop the attack.

What you are trying here is analogous to a qualification exam for server implementers.  If they can pass this test, then you assume that they're smart enough not to make other silly mistakes.

That requires a little too much suspension of disbelief for me.  Your proverbial server implementer will do whatever is necessary to get their app working.  I put it to you that they will pass your intelligence test, and fail in other more spectacular ways.  No matter how complicated you make the test.

It's quite possible that any viable solution to that problem would be more trouble than it's worth.  (you know, there might be a business in that...)

> > If this is as simple as a programmer forgetting the distinction
> between
> > /Upgrade: foo/ and /^Upgrade: foo/, then we're back to disagreeing on
> > the same old and tired topic.
> 
> Yes. 

No comment.

--Martin