Re: [hybi] Why redirects are a bad for the security of WebSockets (was Re: Clarify wheter HTTP responses other than 101 are valid)

Greg Wilkins <gregw@intalio.com> Mon, 28 March 2011 21:04 UTC

Return-Path: <gregw@intalio.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 589AA28C104 for <hybi@core3.amsl.com>; Mon, 28 Mar 2011 14:04:33 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.341
X-Spam-Level:
X-Spam-Status: No, score=-2.341 tagged_above=-999 required=5 tests=[AWL=0.036, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, J_CHICKENPOX_66=0.6, RCVD_IN_DNSWL_LOW=-1]
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 kPcowvuecJU9 for <hybi@core3.amsl.com>; Mon, 28 Mar 2011 14:04:32 -0700 (PDT)
Received: from mail-vw0-f44.google.com (mail-vw0-f44.google.com [209.85.212.44]) by core3.amsl.com (Postfix) with ESMTP id 4A14228C0F0 for <hybi@ietf.org>; Mon, 28 Mar 2011 14:04:31 -0700 (PDT)
Received: by vws12 with SMTP id 12so3102577vws.31 for <hybi@ietf.org>; Mon, 28 Mar 2011 14:06:08 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.52.168.8 with SMTP id zs8mr501214vdb.184.1301346368648; Mon, 28 Mar 2011 14:06:08 -0700 (PDT)
Received: by 10.52.155.71 with HTTP; Mon, 28 Mar 2011 14:06:08 -0700 (PDT)
In-Reply-To: <BANLkTi=0a84PA+2hN9U7S9uvNWgmestE2g@mail.gmail.com>
References: <BANLkTi=0a84PA+2hN9U7S9uvNWgmestE2g@mail.gmail.com>
Date: Tue, 29 Mar 2011 08:06:08 +1100
Message-ID: <AANLkTi=0dAtY5g0O5Rw8qAZ78RcOa48sKGTb8nshcXBA@mail.gmail.com>
From: Greg Wilkins <gregw@intalio.com>
To: hybi@ietf.org
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: Patrick McManus <pmcmanus@mozilla.com>
Subject: Re: [hybi] Why redirects are a bad for the security of WebSockets (was Re: Clarify wheter HTTP responses other than 101 are valid)
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, 28 Mar 2011 21:04:33 -0000

On 29 March 2011 07:34, Adam Barth <ietf@adambarth.com> wrote:
> Consider the following code:
>
> var url = <obtain URL from somewhere, e.g. postMessage>
>
> if (!url.startsWith("wss://example.com/"))
>  return;
>
> var socket = new WebSocket(url);
> socket.onopen = function () {
>  [... interact with socket ...]
> };
>
> Reading this code, it's quite natural to assume that sending and
> receiving information on socket will actually communicate with
> example.com.  For example, I might send confidential information to
> example.com or rely upon the integrity of information received from
> example.com.  However, if example.com has has an open redirector (as
> is extremely common on the Internet), this assumption is incorrect and
> leads to vulnerabilities.
>
> Now, we can wring our hands and claim that this sort of issue isn't
> our problem, but it is.  Simply warning folks about these traps in
> Security Considerations is just passing the buck.  Instead, we
> shouldn't add this complexity to WebSockets at this time.  We can
> always change out minds and add support for redirects in the future,
> but we can never remove support once added.

Adam,

I don't think it is "our problem".     I think it is a "W3C/WHATWG
HTML-5 WG problem".

This is essentially an API issue for the browser websocket object.
There are plenty of ways around this (adding optional follow
redirects, exposing redirect responses etc. etc.),   but I think it is
the W3C and WHATWG HTML-5 working groups that should be where such
matters are decided.

As a web developer I really rather not have to go without redirection
and other common auth methods - and I take responsibility for my
servers not being open redirectors..... but would understand if the
W3C/WHATWG decided not to support these features - at least initially.

However, we should make the protocol such that if/when the API does
support these features, then it will only be an in browser change and
not an update of the protocol.

cheers