Re: [hybi] Handshake was: The WebSocket protocol issues.

Willy Tarreau <w@1wt.eu> Fri, 24 September 2010 14:57 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 CEDF13A6B5B for <hybi@core3.amsl.com>; Fri, 24 Sep 2010 07:57:52 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.792
X-Spam-Level:
X-Spam-Status: No, score=-2.792 tagged_above=-999 required=5 tests=[AWL=-0.749, 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 eKKm+4igX2VH for <hybi@core3.amsl.com>; Fri, 24 Sep 2010 07:57:52 -0700 (PDT)
Received: from 1wt.eu (1wt.eu [62.212.114.60]) by core3.amsl.com (Postfix) with ESMTP id 8C9F93A6B56 for <hybi@ietf.org>; Fri, 24 Sep 2010 07:57:51 -0700 (PDT)
Received: (from willy@localhost) by mail.home.local (8.14.4/8.14.4/Submit) id o8OEwGXY031882; Fri, 24 Sep 2010 16:58:16 +0200
Date: Fri, 24 Sep 2010 16:58:16 +0200
From: Willy Tarreau <w@1wt.eu>
To: Alexander Voronin <alexander.voronin@gmail.com>
Message-ID: <20100924145816.GB28314@1wt.eu>
References: <AANLkTikszM0pVE-0dpZ2kv=i=y5yzS2ekeyZxtz9N=fQ@mail.gmail.com> <AANLkTikczXMx9XSY4jGaVwh5LndRTTLg==+LPj=JmiGk@mail.gmail.com> <AANLkTi=_TYM1vZrZYBoSu+8j9WrSXfaZ42EMRmnF3rnz@mail.gmail.com> <AANLkTi=gqCD=ymNawDYnpRommm2CesrBFqC-eDCpuFvG@mail.gmail.com> <AANLkTikKgvO28yKrE3X7FrAnssFFkrogwWbYo6pJEsJC@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <AANLkTikKgvO28yKrE3X7FrAnssFFkrogwWbYo6pJEsJC@mail.gmail.com>
User-Agent: Mutt/1.4.2.3i
Cc: hybi <hybi@ietf.org>
Subject: Re: [hybi] Handshake was: The WebSocket protocol issues.
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: Fri, 24 Sep 2010 14:57:52 -0000

On Fri, Sep 24, 2010 at 05:50:57PM +0300, Alexander Voronin wrote:
> Intermediates and servers that have no WebSockets support will answer to
> handshake with any code but no 101. Is that still not enough to figure out
> if WebSocket connection established? Why to make things complex if they
> could be simple?

I think that the point that you missed is that since WS works on top of
HTTP, any HTTP-compliant intermediary will implicitly support WS. However,
we're aware that there are some incomplete HTTP implementations, and some
intermediaries which by design will not let that pass through, reason why
it's important to detect failures quickly.

> Also I did not get this
> article<http://www.ietf.org/mail-archive/web/hybi/current/msg04166.html>by
> email, but will answer here. Referenced document provides sample of
> cross-protocol attack using HTTP POST on SMTP. POST is a one-stage request
> without handshake, WebSocket is a GET extension with handshake, so I guess
> does not matter how complicated handshake will be if browser not obey HTTP
> rules and continue HTTP session after getting "500 Command unrecognized"
> instead of "HTTP/1.1 101 OK". This is not protocol but browser issue.

No, the issue happens before. Imagine that the browser sends an HTTP-based
handshake immediately followed by a certain amount of bytes that are to be
understood by the remote server. If that remote server simply ignores the
handshake because it does not understand it (as most services do), it will
start to process the rules that follow the handshake. An SMTP server might
very well accept spam that are sent as a POST request (my mail server
receives hundreds of those every day).

Whether the browser stops or not when receiving the "500 Command unrecognized"
is irrelevant to the problem, the harm has already been done.

Willy