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

"Roy T. Fielding" <fielding@gbiv.com> Wed, 01 December 2010 22:14 UTC

Return-Path: <fielding@gbiv.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 10E153A67DF for <hybi@core3.amsl.com>; Wed, 1 Dec 2010 14:14:40 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.916
X-Spam-Level:
X-Spam-Status: No, score=-102.916 tagged_above=-999 required=5 tests=[AWL=-0.917, BAYES_00=-2.599, J_CHICKENPOX_44=0.6, 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 99CEuhD0wHok for <hybi@core3.amsl.com>; Wed, 1 Dec 2010 14:14:38 -0800 (PST)
Received: from homiemail-a27.g.dreamhost.com (caiajhbdcaib.dreamhost.com [208.97.132.81]) by core3.amsl.com (Postfix) with ESMTP id DFA093A6768 for <hybi@ietf.org>; Wed, 1 Dec 2010 14:14:38 -0800 (PST)
Received: from homiemail-a27.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a27.g.dreamhost.com (Postfix) with ESMTP id 392DC598080; Wed, 1 Dec 2010 14:15:48 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gbiv.com; h=subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to; q=dns; s=gbiv.com; b=m0iV7GJXjYeAQne5 wscP10KMyrbg4t4eAyRvzD6FNBG9kfy3GY9c7osjfBSr3BRoz87UUFqkf4hDm6jx lNELpATrGMXJLsd4XK4vJvdngV/9HmZ0SxLwTsVV/YMHneMl08uCb+rgjQW0cppg Tm2eNbPgUm7y8lnN1Jz6e1pVzCs=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gbiv.com; h=subject :mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=gbiv.com; bh=gdXC5JHYmgzMrKrASA15uSoB3bs=; b=NUMnNfAsYXbuYLW7A1ybnlZXNNo7 tM9i6bZe4JBRPSZ1KtYVc3fWvzxwj3+4bJgfQY2XUu5I5w/MtMMVw9xfZJA+D7lw d5aoxCcR+XGREW9Pts88AykymhAnEDsHn1RhcMKgEUd81pO7scZhwXDahYl55F/b UyRcrefjyR1nyRs=
Received: from [192.168.1.66] (99-21-208-82.lightspeed.irvnca.sbcglobal.net [99.21.208.82]) (Authenticated sender: fielding@gbiv.com) by homiemail-a27.g.dreamhost.com (Postfix) with ESMTPA id 3C73A59807B; Wed, 1 Dec 2010 14:15:37 -0800 (PST)
Mime-Version: 1.0 (Apple Message framework v1082)
Content-Type: text/plain; charset="iso-2022-jp"
From: "Roy T. Fielding" <fielding@gbiv.com>
In-Reply-To: <AANLkTin+HYi+p-53y7bB-qvSMzN9oRQdTcQEusyxdRX_@mail.gmail.com>
Date: Wed, 01 Dec 2010 14:15:37 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <94AF27DF-229F-4F06-AB68-89592BF980A7@gbiv.com>
References: <op.vmzqkhszidj3kv@simon-pieterss-macbook.local> <4CF52558.9010100@gmx.de> <4CF529FF.9080708@opera.com> <BB31C4AB95A70042A256109D4619912605790150@XCH117CNC.rim.net> <AANLkTimzTvtho0m9HZSe6exgSwZxbCnxtmeJd2-G0aSK@mail.gmail.com> <BB31C4AB95A70042A256109D4619912605790178@XCH117CNC.rim.net> <BB31C4AB95A70042A256109D4619912605790190@XCH117CNC.rim.net> <AANLkTimQJz22RtoVnB16C8Mi4C8=QKB946wSR9BRsP85@mail.gmail.com> <AANLkTi=BPFKVfj1CQQ4pk9-M_-9=ftQQPerfAFZtV8K7@mail.gmail.com> <AANLkTimPj6Xpqfm2k_VLeF=7M7s57yhsq67o4frKrK7L@mail.gmail.com> <780F99F1-00F7-4E4A-A29F-9C94F66ADD13@gbiv.com> <AANLkTin+HYi+p-53y7bB-qvSMzN9oRQdTcQEusyxdRX_@mail.gmail.com>
To: Adam Barth <ietf@adambarth.com>
X-Mailer: Apple Mail (2.1082)
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 22:14:40 -0000

On Dec 1, 2010, at 12:41 PM, Adam Barth wrote:

> On Wed, Dec 1, 2010 at 12:21 PM, Roy T. Fielding <fielding@gbiv.com> wrote:
>> On Dec 1, 2010, at 8:45 AM, Ian Fette (イアンフェッティ) wrote:
>>> We all know that WS over port 80 faces obstacles. That's been known for a long time, nothing has changed, and yet there remains a group that wishes to try to use it. As long as the problems are known, I see no reason to try to forbid it.
>>> 
>>> As for strong objectors, it seems like many people who are implementing have voiced strong support for adams proposal, modulo some tweaks here and there. I would like to see how far we can get.
>> 
>> We will get nowhere.  Adam's proposal is to use CONNECT, a method specifically
>> designed for telling a normal (non-intercept, non-reverse) proxy to create a
>> TCP tunnel to some other host:port, and he suggest using it to do something
>> contrary to its method definition and the HTTP architecture in general.
>> That would violate both CONNECT semantics and the HTTP syntax for non-proxy
>> requests (not to mention our hybi charter).  Please understand that such an
>> abomination will not be allowed in an Internet proposed standard even if the
>> browsers deployed it, and thus should be rejected out of hand.
> 
> You're assuming that the server in a WebSocket connection is an HTTP
> server.  It seems entirely reasonable to regard it as a proxy instead.
> In that case, the semantics work out fine.

No.  It could very well be a proxy, expecting to receive both valid
proxy requests (hopefully with some form of authentication) and valid
non-proxy requests.  The CONNECT semantics are clear enough to show
that your request does not follow them, and therefore will be treated
as an error.  That error will result in error logs, occasional pages
to overworked sysadmins, and in rare cases an automatic IPfw block
and a call to the FBI.  This is because CONNECT has been used in the
past by rootkit zombies to attack HTTP servers looking for open
relay proxies.

>> Listen to the input you have received already.  The vulnerability described
>> in Adam's paper has nothing to do with the Upgrade handshake -- they
>> specifically did not test the actual handshake.  What they did is test the
>> post-handshake non-encrypted connection for intercept proxies that might
>> (in 8 out of 47,338 cases) mistakenly interpret the unencrypted channel
>> after the handshake is completed (or ignored).  Thus, it represents
>> an attack on any non-opaqued channel that is being scanned by caching
>> intercept proxies (an architecture that is not condoned by HTTP but does
>> occur in some limited practice by idiots) when a browser is allowed to
>> send arbitrary bytes over that channel.
> 
> Correct.
> 
>> One question, therefore, is whether it is important to protect the 0.0169%
>> of users behind networks that are deliberately using an insecure and invalid
>> form of HTTP proxy from yet another attack based on that invalid usage.
>> YMMV.
> 
> For better or worse, browser vendors feel responsible to protect
> "idiots" (as you call them) from themselves.  You might or might not
> agree with that decision, but that's unlikely to change.

You aren't protecting them -- they are already vulnerable to those
attacks via POST and anything else that can send data on port 80.
At best we just avoid piling on.

It is a basic vulnerability of the browser same-origin protocol
to assume that same-IP will result in same-origin.  Combine that
with not retaining control over the Host header field (the actual
same-origin) or the application framing that determines where a
request starts, and then we have a security hole.  That hole can
be avoided for websockets by controlling the post-handshake output,
so browser vendors can happily continue to be responsible for
protecting those admin idiots who feel compelled to install
caching intercepts that don't respect HTTP/1.1 framing, even
if we don't use the proposed CONNECT handshake.

> [...]
> 
>> A more sensible test would have been to use a new method, like WEBSOCKET,
>> since then at least the initial handshake could remain HTTP-compliant.
> 
> Unfortunately, using a new method doesn't solve any of the problems
> we're currently worried about.  CONNECT, specially, is useful because
> many intermediaries already have the behavior we desire when
> processing CONNECT messages.

What makes you say that?  CONNECT sent to a proxy doesn't have the
behavior we want unless the host:port is true, and even then the
result is a pure tunnel which will need to start its own handshake.
Most proxies already limit use of CONNECT to specific ports, for
security reasons, so that it doesn't actually get around the firewall
limitations.  CONNECT sent to an origin server doesn't work any
better than a new method.

Changing the method to WEBSOCKET doesn't change the security
characteristics of encrypting the subsequent content, since we
can do that more easily with a new method.

>> BTW2, "transparent proxy" != "intercept proxy".  A proxy is called transparent
>> when it doesn't transform the messages exchanged, unlike intercepts (which
>> aren't even true proxies since they are unknown to the client).  Please use
>> the correct terminology.
> 
> For what its worth, we researched this issue when writing the paper.
> These terms appear to be used interchangeably by most folks, including
> Wikipedia.

Most folks don't write Internet standards based on protocols that
already contain a different definition for "transparent proxy" (one which
we plan on replacing with "non-transforming proxy" just because of
that confusion).  We use the term intercept because it has no other
confusing-yet-standard definition.

....Roy