Re: [hybi] Extensibility mechanisms?

Willy Tarreau <w@1wt.eu> Thu, 22 July 2010 14:07 UTC

Return-Path: <w@1wt.eu>
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 186753A6A13 for <hybi@core3.amsl.com>; Thu, 22 Jul 2010 07:07:16 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.03
X-Spam-Level:
X-Spam-Status: No, score=-3.03 tagged_above=-999 required=5 tests=[AWL=-0.987, BAYES_00=-2.599, HELO_IS_SMALL6=0.556]
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 SLNqEgeBuSOM for <hybi@core3.amsl.com>; Thu, 22 Jul 2010 07:07:15 -0700 (PDT)
Received: from 1wt.eu (1wt.eu [62.212.114.60]) by core3.amsl.com (Postfix) with ESMTP id 694B63A69E3 for <hybi@ietf.org>; Thu, 22 Jul 2010 07:07:14 -0700 (PDT)
Received: (from willy@localhost) by mail.home.local (8.14.4/8.14.4/Submit) id o6ME7Q95013553; Thu, 22 Jul 2010 16:07:26 +0200
Date: Thu, 22 Jul 2010 16:07:26 +0200
From: Willy Tarreau <w@1wt.eu>
To: Maciej Stachowiak <mjs@apple.com>
Message-ID: <20100722140726.GD12582@1wt.eu>
References: <Pine.LNX.4.64.1007212153110.7242@ps20323.dreamhostps.com> <AANLkTiku76oSucTNDFdwgsFBNFa_cCpC-YktTnMfX47-@mail.gmail.com> <4C479130.4020500@caucho.com> <AANLkTikLDjBP-Xs5t6TxmJuq4nG8jwThQ=n34B4cEmup@mail.gmail.com> <4C479CE4.6070805@caucho.com> <AANLkTims1er0Rbv0ysP4gRs1Kd0He8hapHeJ3nON=JQa@mail.gmail.com> <4C47C5B0.3030006@caucho.com> <AANLkTi=ND-FOH8OoD=TCbiyeSZ-h0LhxQBXN5w-2hfvj@mail.gmail.com> <20100722055452.GL7174@1wt.eu> <F412C956-038F-400D-A431-C42B4C7B829C@apple.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <F412C956-038F-400D-A431-C42B4C7B829C@apple.com>
User-Agent: Mutt/1.4.2.3i
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] Extensibility mechanisms?
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: Thu, 22 Jul 2010 14:07:16 -0000

Hi Maciej,

On Thu, Jul 22, 2010 at 12:18:19AM -0700, Maciej Stachowiak wrote:
> There's at least three kinds of concerns about cross-protocol attacks and the WebSocket protocol, in the case where the client is the browser:
> 
> 1) Hostile JS code running in the browser may use the browser's WebSocket client code to try to attack existing HTTP resources, if it can make a request that looks sufficiently like HTTP.

Maybe I'm mistaken, but why couldn't such JS code simply make use of the
browser's HTTP client to do so ? Posting a form, reloading an image from
a given URL or making an XMLHttpRequest seems perfectly possible right now,
so trying to do that via the WebSocket code would bring nothing at all.

> 3) Hostile JS code running in the browser may use the browser's HTTP client code (e.g. via XMLHttpRequest) to try to attack newly created WebSocket servers, if it can make a request that looks sufficiently like WebSocket.

The same is true here : why would the JS code try to use the normal HTTP
client if the browser supports WebSocket, with which the code would be
able to have finer control over its attack ?

> > If this is indeed the issue you're talking about, then I don't see why
> > the HTTP-based handshake could be a problem there. It's not more than
> > any other common HTTP request, it's even better in that no data should
> > flow until the server has correctly replied indicating proper support
> > for the protocol.
> 
> What's "the HTTP-based handshake"?

I mean the HTTP Upgrade mechanism.

> We have had several proposals for handshakes that start out looking like HTTP. They are not all equally effective in protecting against cross-protocol attacks, though some of them do have some protection..

Possibly, but what ended up in the spec was finally less secure than the normal
HTTP handshake since it allows the client to send bytes to the server through
reverse proxies without that later being aware of it.

> Although I am not an expert on cross-protocol attacks, one thing I have learned is that the issues can be *extremely* subtle. This leads me to conclude that it's better to err on the side of caution, and design the protocol to be even more robust against such threats than we think is strictly necessary. 

I agree with the *extremely subtle* point. But that's also why I'd rather
not try to reinvent within a small group things that are already efficient
and not proven wrong. We must accept that a small group is never smarter
than those outside the group and that a few hours designs have little
chance of being more robust than those which have survived exposure to the
world for 10 years or so.

It's just like when you see developers implement their own crypto algorithm
because "the public ones have not been broken yet but they're attacked, so
let's be safe and write a new one". The ones I have talked about on this
subject were really convinced their work was better than everything else,
while it was a disaster. That's what I'd prefer we avoid here.

However, enforcing a strict mode of operations based on something which
already works, or as Sal suggested, enforcing a stricter standard is the
right way to go.

> I believe the TLS-based handshake (as proposed by Adam) is more robust than solutions involving nonces and challenge/response built into an HTTP-like handshake. The reason for this is that it's hard for the attacker to control the bytes sent, other than to cause the initiation of a TLS handshake, which is something that all network services are already exposed to by browsers. The attacker cannot get to the next-level protocol running over TLS unless the server explicitly opts in. With HTTP-based schemes, it takes much more care to avoid sending information as the "wrong" protocol.

I agree with those points, but as suggested, there are many cases where
being limited to TLS can be a showstopper, either due to overhead, or
more simply because it will leave many users away (mostly those inside
enterprises who can only access a limited set of SSL sites).

We should spend some time trying to enumerate what aspect(s) of the HTTP-based
handshake we believe may be a problem regardless of the protocol deployed on
the target server.

> However, HTTP-based challenge-response solutions are definitely better than not trying to address the issue at all.

100% agree !

Regards,
Willy