Re: [hybi] #1: HTTP Compliance

"Shelby Moore" <shelby@coolpage.com> Sun, 15 August 2010 13:06 UTC

Return-Path: <shelby@coolpage.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 C8D6E3A6878 for <hybi@core3.amsl.com>; Sun, 15 Aug 2010 06:06:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.961
X-Spam-Level:
X-Spam-Status: No, score=-1.961 tagged_above=-999 required=5 tests=[AWL=0.638, BAYES_00=-2.599]
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 1BWWp0en8DoT for <hybi@core3.amsl.com>; Sun, 15 Aug 2010 06:06:21 -0700 (PDT)
Received: from www5.webmail.pair.com (www5.webmail.pair.com [66.39.3.83]) by core3.amsl.com (Postfix) with SMTP id 56BA03A6861 for <hybi@ietf.org>; Sun, 15 Aug 2010 06:06:21 -0700 (PDT)
Received: (qmail 78708 invoked by uid 65534); 15 Aug 2010 13:06:56 -0000
Received: from 121.97.54.174 ([121.97.54.174]) (SquirrelMail authenticated user shelby@coolpage.com) by sm.webmail.pair.com with HTTP; Sun, 15 Aug 2010 09:06:56 -0400
Message-ID: <91f61d138b8a8a80271688a0e10a685a.squirrel@sm.webmail.pair.com>
In-Reply-To: <20100815122648.GC27614@1wt.eu>
References: <f7d4bb98e444b85b9bf1af6d4d9f0772.squirrel@sm.webmail.pair.com> <20100815100717.GA27614@1wt.eu> <1c2251f66b8d01880b6943561c07d3cb.squirrel@sm.webmail.pair.com> <20100815122648.GC27614@1wt.eu>
Date: Sun, 15 Aug 2010 09:06:56 -0400
From: Shelby Moore <shelby@coolpage.com>
To: Willy Tarreau <w@1wt.eu>
User-Agent: SquirrelMail/1.4.20
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Priority: 3 (Normal)
Importance: Normal
Cc: hybi@ietf.org
Subject: Re: [hybi] #1: HTTP Compliance
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: shelby@coolpage.com
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: Sun, 15 Aug 2010 13:06:23 -0000

> On Sun, Aug 15, 2010 at 06:53:11AM -0400, Shelby Moore wrote:
>> > On Sun, Aug 15, 2010 at 05:10:09AM -0400, Shelby Moore wrote:
>> >> An HTTP proxy that is compatible with draft/proposal #76 (the
>> >> contentious
>> >> one that passes 8 extra characters after the HTTP header without a
>> >> Content-Length header), would need a specific code path for the
>> >> WebSocket
>> >> upgrade request in order to pass 8, and only 8, extra characters
>> >> (concensus is that passing an arbitrary content length would be a
>> >> security
>> >> hole).
>> >>
>> >> Isn't it the antithesis of the 80/20 rule and interoperability to
>> >> require
>> >> every HTTP proxy in the world to have specific code path for every
>> >> possible future HTTP Upgrade protocol that comes along?
>> >
>> > it's even worse than that, it means that such a reverse-proxy, when
>> shared
>> > between HTTP and Websocket, will have to accept to blindly forward
>> those 8
>> > bytes everytime someones *pretends* to talk websocket, without the
>> > server's
>> > consent.
>>
>> I had read that point in past discussion.  I would be tempted to assume
>> 8
>> characters is relatively harmless security hole (as compared to passing
>> an
>> arbitrarily unexpected content length, which is what would be required
>> to
>> have one code path for all proxies for all possible Upgrade extensions
>> that expect such special treatment), but I will grant you that even 1
>> unexpected bit is a potential security hole.
>
> Yes, even one byte is enough because it can be used to change the second
> request's method. For instance, let's say you have a reverse-proxy
> somewhere
> which analyses POST requests to validate the body, but which ignores all
> other methods. You could send it a first request with Upgrade: Websocket,
> with /key3/ being "\r\n\r\n\r\nPO", then a second request with a method
> called "ST" which it would ignore. The end server would then ignore the
> Upgrade request because it doesn't speak WebSocket, then would skip the
> empty lines and get a perfectly valid POST request which has not been
> checked by the reverse-proxy. This issue causes an infinite amount of
> similar class of problems. This is closely related to HTTP request
> smuggling.

I felt compelled to add my (what I feel is a more convincing) point to the
mix, because the security argument against the extra 8 bytes appears to be
weaker, because HTTP request smuggling already exists.

http://www.owasp.org/index.php/HTTP_Request_Smuggling

For as long as servers are free to have variable
interpretations/implementations of HTTP (within the broad constrainsts of
the spec), then HTTP request smuggling will exist.  And since I understand
that variable interpretationsinterpretations/implementations is critical
to HTTP robustness, then I conclude that "security" at the *transparent*
proxy is an oxymoron.  A *transparent* proxy should never be used for
mission critical functions, instead only to achieve optional benefits such
as increases in performance due to caching.  An opaque proxy (e.g. the
Apache server handling my server code or the upstream proxy I configure
into my browser) is theoretically deterministic and thus can be configured
to be reliable with respect to the end implementation.

Thus I don't think the security argument against proposal 76 is as
convincing.  Feel free to correct me, as I am only using deductive logic
of what I have read today, and am not speaking as an expert in the field.

> What is important is that if we make the websocket handshake pass through
> HTTP components, it must comply with the protocol. HTTP is clear on that:
> the protocol has switched *only once* the 101 has been seen. So a reverse
> proxy must not pass those 8 bytes before seeing the 101.

Otherwise we defacto change HTTP for every HTTP Upgrade protocal
extension.  We know we are changing HTTP, because the implementing server
or proxy has to implement a new code path for our Upgrade protocal
extension.

>> It would be an exponentially increasing cost problem of interoperability
>> if every Upgrade protocol requires a new code path in the proxies.
>
> And it would not make sense at all since this would not be HTTP anymore.

Agreed.  Ditto I wrote above.

[snip]