Re: [hybi] Web sockets and existing HTTP stacks

Jamie Lokier <jamie@shareable.org> Wed, 03 February 2010 02:08 UTC

Return-Path: <jamie@shareable.org>
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 699953A69E0 for <hybi@core3.amsl.com>; Tue, 2 Feb 2010 18:08:02 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.575
X-Spam-Level:
X-Spam-Status: No, score=-2.575 tagged_above=-999 required=5 tests=[AWL=0.024, 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 RCnadaBhSR4K for <hybi@core3.amsl.com>; Tue, 2 Feb 2010 18:08:01 -0800 (PST)
Received: from mail2.shareable.org (mail2.shareable.org [80.68.89.115]) by core3.amsl.com (Postfix) with ESMTP id 863A63A695A for <hybi@ietf.org>; Tue, 2 Feb 2010 18:08:01 -0800 (PST)
Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from <jamie@shareable.org>) id 1NcUfX-0004xj-3Q; Wed, 03 Feb 2010 02:08:39 +0000
Date: Wed, 03 Feb 2010 02:08:39 +0000
From: Jamie Lokier <jamie@shareable.org>
To: Maciej Stachowiak <mjs@apple.com>
Message-ID: <20100203020839.GO32743@shareable.org>
References: <4B2C1D52.9020505@webtide.com> <5c902b9e0912181640n497169cdrfa71f9a2908e6ef3@mail.gmail.com> <20091219005442.GA10949@shareable.org> <4B2C287E.1030006@webtide.com> <Pine.LNX.4.64.1001310835410.3846@ps20323.dreamhostps.com> <5821ea241001311219j111d25a3h27fb2d05a2ece32d@mail.gmail.com> <5821ea241001311226s3d2092d7kef13f958db3a0132@mail.gmail.com> <A3071537-C3A5-4C0D-945F-618382435383@apple.com> <5c902b9e1001312024k7ba2df94iceeb0828051fddaf@mail.gmail.com> <568D478E-DEE2-440B-8A71-8F1B9970E60D@apple.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <568D478E-DEE2-440B-8A71-8F1B9970E60D@apple.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
Cc: hybi@ietf.org
Subject: Re: [hybi] Web sockets and existing HTTP stacks
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, 03 Feb 2010 02:08:02 -0000

Maciej Stachowiak wrote:
>    I believe the only component that absolute has to check for violations
>    of the sentinel framing to maintain security is the browser - it needs
>    to prevent script code running in the browser from doing shady things
>    to an existing connection, so it can't let scripts inject a sentinel.

Every component which forwards data and needs to track the frame
boundaries, including those which just use it to control buffering,
need to scan every byte and are vulnerable to injection attacks.

A simple forwarding component may track frame boundaries to buffer up
a whole message before forwarding it.  A frame injection attack can
fool such a component to cause an unbounded delay in delivering that
or later messages, breaking application expectations.

Other things which have been discussed such as orderly close,
keepalives and so on can be very broken by a frame injection attack on
an earlier frame.

Web pages with multiple Javascript components sharing a connection
through a simple framework - which is the primary target for WebSocket
I believe - may be tricked into things like retrying a state changing
request sent to the server when it is not safe to do so, causing the
state change twice, despite the application protocol being carefully
coded to make that "impossible".  Because of a frame injection attack
breaking protocol assumptions.

If a receiver supported the gzipped binary frame which
was mentioned, a sentinel frame injection attack could inject a
gzipped frame which may decode in all sorts of ways... denial of
service at least.

If anything, the *sender* has to be especially careful to check for
violations, otherwise the whole delivery chain may go wrong.

-- Jamie