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

Eric Rescorla <ekr@rtfm.com> Mon, 11 October 2010 22:21 UTC

Return-Path: <ekr@rtfm.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 E2E293A6832 for <hybi@core3.amsl.com>; Mon, 11 Oct 2010 15:21:28 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -101.732
X-Spam-Level:
X-Spam-Status: No, score=-101.732 tagged_above=-999 required=5 tests=[AWL=0.244, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, USER_IN_WHITELIST=-100]
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 hHX9h75wF5gg for <hybi@core3.amsl.com>; Mon, 11 Oct 2010 15:21:27 -0700 (PDT)
Received: from mail-gx0-f172.google.com (mail-gx0-f172.google.com [209.85.161.172]) by core3.amsl.com (Postfix) with ESMTP id D8D143A67E6 for <hybi@ietf.org>; Mon, 11 Oct 2010 15:21:26 -0700 (PDT)
Received: by gxk20 with SMTP id 20so1483745gxk.31 for <hybi@ietf.org>; Mon, 11 Oct 2010 15:22:39 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.90.84.18 with SMTP id h18mr3393032agb.13.1286835759033; Mon, 11 Oct 2010 15:22:39 -0700 (PDT)
Received: by 10.91.190.1 with HTTP; Mon, 11 Oct 2010 15:22:38 -0700 (PDT)
In-Reply-To: <20101011204228.GB17225@1wt.eu>
References: <4CAFAC2B.5000800@caucho.com> <55bva61goeqtn0lifgjt5uihf50obh7kf4@hive.bjoern.hoehrmann.de> <4CAFB9C4.6030905@caucho.com> <AANLkTinv5Ym5jwUEqS76z3UkVa7GpmOBT_WXhBbFK0-m@mail.gmail.com> <20101009055723.GL4712@1wt.eu> <AANLkTimY2DjxgZybibSRtc7L34Wns2KhQC=Wa9K6PYku@mail.gmail.com> <20101009204009.GP4712@1wt.eu> <AANLkTi=Az0RmE1Uipo068zMh3YzgMpM2tQ+zYxaDT47A@mail.gmail.com> <20101011053354.GA12672@1wt.eu> <AANLkTimC6A+5ZWuNhWASehAibUB9fQKVCPVsVpShUkrW@mail.gmail.com> <20101011204228.GB17225@1wt.eu>
Date: Mon, 11 Oct 2010 15:22:38 -0700
Message-ID: <AANLkTik=aBGxjnzwkVF=1p0Fmyj0WDF-gjFuqwpyyrTz@mail.gmail.com>
From: Eric Rescorla <ekr@rtfm.com>
To: Willy Tarreau <w@1wt.eu>
Content-Type: multipart/alternative; boundary="0016e64805ea4d2d8f04925eccc5"
Cc: hybi <hybi@ietf.org>, Bjoern Hoehrmann <derhoermi@gmx.net>
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: Mon, 11 Oct 2010 22:21:29 -0000

On Mon, Oct 11, 2010 at 1:42 PM, Willy Tarreau <w@1wt.eu> wrote:

> On Mon, Oct 11, 2010 at 07:07:18AM -0700, Eric Rescorla wrote:
> > On Sun, Oct 10, 2010 at 10:33 PM, Willy Tarreau <w@1wt.eu> wrote:
> >
> > > On Sun, Oct 10, 2010 at 09:17:21PM -0700, Eric Rescorla wrote:
> > > (...)
> > > > Thus, it's quite possible to implement an HTTP server which does not
> > > > deadlock
> > > > without looking at the Connection header at all, simply by having a
> short
> > > > timeout.
> > >
> > > That's what I meant with the "deadlock", we can only end the transfer
> on
> > > a timeout if the client expects a close and the server does not close.
> > > Even if the timeout is short, it makes the situation very uncomfortable
> > > for the user.
> >
> >
> > I don't understand what you mean here. There are two issues:
> >
> > (1) when the response is finished
> > (2) when the connection can be closed.
> >
> > Only the first affects the user experience, but they don't really
> interact.
>
> Yes they do for components which rely on the close only and don't require
> any content-length (eg: most monitoring tools). If the server did not care
> about the close in the request and waited for a second request instead of
> closing, the client would wait for the server to close to determine the
> end of the response, which is after the keep-alive timeout of the server.


I don't see how this makes sense. Regardless of the setting of Connection:
close
if the server is not going to either put a length field or chunked encoding,
it
needs to close the connection at the end of the response. Timeouts don't
enter into it. I don't know what you mean by "monitoring tools" here...



> > Even
> > if the client is using persistent connections, the server still needs to
> > either
> > incorporate a length indication or terminate the response after sending
> the
> > response. In neither case does the user experience a stall.
>
> This is mandatory for persistent connections only.


It's not an issue of mandatory or not. It's an issue of minimal
functionality.



> While it's recommended for
> other connections, we still see some servers that don't advertise a content
> length for HTTP/1.0 request (even Tomcat until very recently).


I don't understand what point you're making here. It's entirely possible for
a
server to be interoperable while ignoring Connection: close simply by always
using a length field/chunked encoding and using a timeout. This leads to
neither
deadlock nor interop problems. If you think there is an interop problem
here,
please describe the sequence of events that causes it. If not, then I don't
see
how you can rely on proper Connection: close behavior as a security feature.



> > No, I don't agree on this. Once you're reduced to this kind of survey you
> > no longer have any reasonable assurance of security. Surveys are
> sometimes
> > OK for resolving interoperability questions, but in this case you are
> > relying on this property for a security purpose.
>
> I still think that since the complexity of the hanshake only relies on a
> fear
> of massive attacks making use of browsers and shared hosting environments,
> if
> we fail to find a deployed vulnerable servers, the massive attack risk
> vanishes. It's not to say that no braindead server could not be attacked,
> but that such a vector is basically useless.
>

Who said anything about "massive attacks"? That's not my concern. My concern
is deploying a new feature which makes otherwise secure systems insecure.


>
> > Yes, that's why using CONNECT is a desirable feature, since for
> > interoperability
> > reasons servers/proxies cannot treat data that appears in the tunnel as
> if
> > it were HTTP traffic.
>
> And that's also why there cannot be a second request after the 200.


Yes, that's my point. That you can't really have an interoperable CONNECT
implementation at all without ignoring everything after the 200. By
contrast,
you can have an interoperable implementation while ignoring Connection:
close.
This is why I feel more comfortable relying on the CONNECT behavior than
on Connection: close.



> >
> > Yes, I agree that this would be required. I don't agree that it's a
> > dealbreaker.
>
> Well, first it's not compatible with any existing infrastructure, which is
> a bit limited outside of the lab.


Yes, I agree it requires an infrastructure change. I don't agree that it's a
dealbreaker.



> Second, it means that the front server
> would first have to acknowledge a WS handshake on behalf of any possible
> server behind it and finally have to return in WS frames a "Sorry man, I
> thought I could hand that connection to someone but there's nobody where
> you want to go".


No, this is not correct. The server can process the entire handshake,
including
the encrypted destination portion, and then only after that respond to the
request.
This requires, as Adam suggested, having the initial "Host" block encrypted
with a key supplied only by the client.



> > I don't see how this creates any meaningful increase in the state that
> must
> > be maintained by the infrastructure element, which must already maintain
> > TCP buffers, which are far larger.
>
> Exactly, it *has* to maintain TCP buffers as well as contexts, it cannot
> filter based on anything advertised in the handshake.
>

Again, this is incorrect. All the relevant material appears immediately
after
the TCP handshake.


All that is just based on the fact that we fear that some components will
> accept to process an HTTP request after both a "Connection: close" and a
> CONNECT that returns a 200.
>

I really don't understand what aspect of Adam or my proposal you're arguing
against
here.


I'd be tempted to suggest that such broken implementations simply deserve
> to be taken down...
>

Given that those implementations are compliant with 2616, I don't know on
what
basis you claim that they are broken.


-Ekr