Re: [hybi] Moving to a CONNECT-based handshake

Willy Tarreau <w@1wt.eu> Wed, 01 December 2010 13:01 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 1FF9228C3AD for <hybi@core3.amsl.com>; Wed, 1 Dec 2010 05:01:31 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.216
X-Spam-Level:
X-Spam-Status: No, score=-2.216 tagged_above=-999 required=5 tests=[AWL=-0.173, 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 LEzcnR6RHf+U for <hybi@core3.amsl.com>; Wed, 1 Dec 2010 05:01:23 -0800 (PST)
Received: from 1wt.eu (1wt.eu [62.212.114.60]) by core3.amsl.com (Postfix) with ESMTP id 7E42528C192 for <hybi@ietf.org>; Wed, 1 Dec 2010 05:00:44 -0800 (PST)
Received: (from willy@localhost) by mail.home.local (8.14.4/8.14.4/Submit) id oB1D1orQ019103; Wed, 1 Dec 2010 14:01:50 +0100
Date: Wed, 01 Dec 2010 14:01:50 +0100
From: Willy Tarreau <w@1wt.eu>
To: Maciej Stachowiak <mjs@apple.com>
Message-ID: <20101201130150.GA19021@1wt.eu>
References: <op.vmzqkhszidj3kv@simon-pieterss-macbook.local> <EC93027F-395D-41F5-8771-CA9F8C816BE5@apple.com> <20101201070212.GC14920@1wt.eu> <A8526C2A-B784-4AF5-B75C-0860A385C28A@apple.com> <20101201074155.GD14920@1wt.eu> <EBB146CE-D274-4FF3-AC9F-7871A5AA54EE@apple.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <EBB146CE-D274-4FF3-AC9F-7871A5AA54EE@apple.com>
User-Agent: Mutt/1.4.2.3i
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] Moving to a CONNECT-based handshake
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 Dec 2010 13:01:31 -0000

On Wed, Dec 01, 2010 at 12:18:09AM -0800, Maciej Stachowiak wrote:
> 
> On Nov 30, 2010, at 11:41 PM, Willy Tarreau wrote:
> 
> > On Tue, Nov 30, 2010 at 11:20:10PM -0800, Maciej Stachowiak wrote:
> >>>  CONNECT * HTTP/1.1
> >>>  Host: realserver.realdomain.com
> >>> 
> >>> A transparent proxy is less likely to interpret this as a correct
> >>> proxy request than it is with "websocket.invalid:443", and at least
> >>> we have the real Host field so that shared environments can deploy
> >>> Websocket.
> >> 
> >> Perhaps CONNECT * is worth testing.
> >> 
> >> But note that a transparent proxy is rather unlikely to interpret any request for websocket.invalid:443 as a valid request, but if it does, it's guaranteed that the hostname will not resolve. RFC2606 reserves the .invalid TLD for domain names that are sure to be invalid: http://tools.ietf.org/html/rfc2606
> > 
> > No, it's guaranteed that such a domain will not be officially registered.
> > It's a lot different. It's similar to the RFC1918 addresses that must not
> > be routed on the net but which everyone learns on BGP from hundreds of AS.
> > 
> > The real issue I see with an invalid name is that it's sufficient to silently
> > put it in a DNS or /etc/hosts so that noone notices it, and the traffic gets
> > silently diverted to the host of choice. Some cheap hosting providers are
> > hacked several times a year, some even a few times a month, and they host
> > thousands of domains. One single change in their /etc/hosts immediately
> > allows all their hosted domains to suddenly offer a websocket service and
> > to be diverted to another random site.
> 
> If your /etc/hosts is compromised, there is nothing the WebSocket protocol can do to protect you. Indeed, your system has likely been rooted. If your local DNS is compromised, then you are highly vulnerable to attacks over HTTP as well as WebSocket (in all its proposed variants).

What I mean is that such a change can remain unnoticed for a very long time
and only divert websocket traffic for sites which do not even plan to offer
such a service. Thus, an intruder may create a websocket service for many
sites without their owners ever noticing.

> > I prefer something which is interpreted improperly and which does not work
> > than something which has chances of succeeding to the wrong place by design !
> 
> That's exactly what I am worried about with * - that it would be mistakenly interpreted as "same host", as it is in OPTIONS, by a transparent proxy.

In OPTIONS, it does not mean "same host" but "this host", the subtlity is
important. There is no notion of forwarding anywhere, just local termination.

> That said, using something that is not even syntactically a valid domain name seems like a reasonable idea, if this is viewed as sufficiently HTTP compliant. I would personally prefer a token that has not been previously given a special meaning at all in HTTP.

I can agree with that.

> > Well, without a proper host name, the following cannot be done anymore :
> > 
> >  - URL filtering (mobile gateways, schools, ISPs)
> >    This introduces a new major security concern
> 
> I am skeptical that URL filtering of WebSocket connections is an effective security measure, or a major concern.

Because you probably have never been confronted to admins having to deal
with irresponsible users. In schools, it's very important. While it can
be accepted to open the service for a specific site (eg: online exams),
they will certainly not want it to be open for social networks or such.

> >  - Websocket for everyone : while Hixie wanted Websocket to be for the
> >    masses, now we're turning to Websocket for the Elite : you will
> >    need to have your own IP address to be able to run Websocket. That's
> >    completely opposite to the directions taken by the HTTP WG which want
> >    to incite IP address sharing.
> 
> I don't see why that is the case.

If the front infrastructure cannot use the Host header to route the
request to the appropriate location, I fail to see how you will offer
shared service for thousands of sites on a single IP.

> >  - Host-based transparent proxying : In his paper, Adam explained how some
> >    transparent HTTP proxies route based on the destination IP address instead
> >    of using the Host header. We all know that using the destination IP address
> >    is dangerous because it makes it easy to bypass filtering rules and/or to
> >    corrupt caches. If websocket does not provide a valid routing information,
> >    the only information transparent proxies will be able to use is precisely
> >    the destination IP address, which will become an incentive for doing that
> >    again.
> 
> For this to be a risk at all, transparent proxies would have to be updated for WebSocket. If they are updated for WebSocket, they can extract the masked true host information for routing.

No, because those transparent proxies won't have to care about WS at all since
we're trying to be HTTP-compliant. Those will remain HTTP-compliant and be
compatible with WS due to WS's compliance with HTTP. Otherwise the need for
compliance is moot.

> > But anyway some of the issues in the paper only involve pure HTTP and dirty transparent proxies. So we're
> > trying to protect from issues that already exist on HTTP itself, which will
> > not improve anything.
> 
> That's not how I read the paper. I see vulnerabilities described in Flash sockets, Java sockets, and some proposed WebSocket handshakes. I do not see any that would work with the HTTP APIs built into the Web platform (XHR, HTML forms, etc).

There is nowhere a WS handshake associated with the demonstrated
vulnerabilities in the paper. There is a case of 2 HTTP GETs through
a proxy which uses the destination IP as a routing info and the
Host header as a caching key (Fig 3 if my memory is correct). This
is already HTTP.

We're trying to focus on existing buggy HTTP components which are already
vulnerable and already corrupt their caches to say that the WS handshake
is vulnerable. This is in my opinion the point that is irrelevant to the
WG, because we're simply swapping the cause and the consequence.

Regards,
Willy