Re: [hybi] Websocket: two protocols into one, and Internet rules broken
Joel Martin <hybi@martintribe.org> Thu, 16 June 2011 21:22 UTC
Return-Path: <buskanaka@gmail.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 4E1A211E82F9 for <hybi@ietfa.amsl.com>; Thu, 16 Jun 2011 14:22:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.487
X-Spam-Level:
X-Spam-Status: No, score=-1.487 tagged_above=-999 required=5 tests=[AWL=-0.264, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, MIME_BASE64_TEXT=1.753, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ej9WelHDi3wH for <hybi@ietfa.amsl.com>; Thu, 16 Jun 2011 14:22:36 -0700 (PDT)
Received: from mail-ew0-f44.google.com (mail-ew0-f44.google.com [209.85.215.44]) by ietfa.amsl.com (Postfix) with ESMTP id 125B111E8234 for <hybi@ietf.org>; Thu, 16 Jun 2011 14:22:35 -0700 (PDT)
Received: by ewy19 with SMTP id 19so856215ewy.31 for <hybi@ietf.org>; Thu, 16 Jun 2011 14:22:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:from :date:x-google-sender-auth:message-id:subject:to:cc:content-type; bh=iJ2ha4/eaKabpx7TBrYyTwB2oa11j+8UzDi8F2S1Dv8=; b=JYIrwan8CqcNjIbWT5XpYfqksIpKzSc6cDmFZBUGawqTRFoqEWmejLoTD/2mETrOn+ FzZxedAKehmfuOiA6a9nuR+i8dLUrmFko6pezfZRIMZ9y82JNtPc+3NwQsHsK8da72DA KMhuaM1DvWD+uAWWVRHvQUvkzOguKmegPC/U0=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; b=Tf6AggYh5ypdB2A5luzP6bZR2xy5D9fw1x624/miEEm/YNEnsJQZTujj4vNki9WuLf pELzvOJd4/qTNAmjuWXNmtK+0UmLUJmZnnKYPGheKrp70pky5ga6bTtBmL3tkl1smftw G0ELQl5ufgSJh1NuFGbbQX5op0fsThhsui7AQ=
Received: by 10.14.11.1 with SMTP id 1mr594311eew.138.1308259355151; Thu, 16 Jun 2011 14:22:35 -0700 (PDT)
MIME-Version: 1.0
Sender: buskanaka@gmail.com
Received: by 10.14.127.1 with HTTP; Thu, 16 Jun 2011 14:22:15 -0700 (PDT)
In-Reply-To: <BANLkTi=w2SC5MFA21NrYhsV-ZyN5hzrSiQ@mail.gmail.com>
References: <BANLkTim4pKwx6wYC3WwXFWET+gx0bnjigQ@mail.gmail.com> <4DFA08A5.3010608@weelya.com> <BANLkTi=JGeFmkYcwqQJ_xe=3CGrXwHxHPg@mail.gmail.com> <4DFA1173.9050509@weelya.com> <BANLkTi=LAiw+JvCOc3VPrXnmog7AkSWwCw@mail.gmail.com> <4DFA15E9.50800@weelya.com> <BANLkTikdUneox_4tpMm-EjXPQEEbN7sF4w@mail.gmail.com> <BANLkTik4y_fRd3pEuPdrwESb7ftdbuvk9w@mail.gmail.com> <BANLkTin2000Q8=LUuuUqkfkX_GRrYAnNDw@mail.gmail.com> <BANLkTi=w2SC5MFA21NrYhsV-ZyN5hzrSiQ@mail.gmail.com>
From: Joel Martin <hybi@martintribe.org>
Date: Thu, 16 Jun 2011 16:22:15 -0500
X-Google-Sender-Auth: YKhZRTF1vDPktfntIml_suDOv7Y
Message-ID: <BANLkTi=89XimRBVOteEkc2GPmx72hpaZQw@mail.gmail.com>
To: ifette@google.com
Content-Type: multipart/alternative; boundary="0016364c7d73234ed304a5dade68"
Cc: hybi@ietf.org
Subject: Re: [hybi] Websocket: two protocols into one, and Internet rules broken
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/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: Thu, 16 Jun 2011 21:22:39 -0000
I must be missing some key concept here because your answers have been what I already know (and agree with), but they still seem out of sync with the text of the paragraph. The draft paragraph is talking about protecting WebSocket servers from NON-WebSocket clients (i.e. XMLHttpRequest or forms) and implying that the Sec-WebSocket-Accept somehow helps in that situation. I understand how a XMLHttpRequest/form submission will not have Sec-WebSocket-Key so this prevents a WebSockets server from answering a non-WebSocket request. But what does sending a proper Sec-WebSocket-Accept have to do with this case? The Sec-WebSocket-Accept value is so that a WebSockets client knows the server is a real WebSocket server. Won't a non-WebSockets request just ignore the Sec-WebSocket-Accept? Regards, Joel Martin 2011/6/16 Ian Fette (イアンフェッティ) <ifette@google.com> > Historically, many servers are lazy. They will not bother validating > whatever the client sends, and will just return some value and then get > exploited. By forcing the server to prove something to the client, we > essentially also force the server to validate at least part of the client's > handshake (rather than just hardcoding in some 101 Upgrade WS response). So, > by making the server prove something to the client, it's a way of forcing > the server to actually take some steps that have a side effect of protecting > it (e.g. this /forces/ the server to parse the Sec-WebSocket-Key header.) > > > 2011/6/16 Joel Martin <hybi@martintribe.org> > >> Ian, >> >> I should have been more clear. I understand why the client and server have >> to validate each other, it's the text of the paragraph in the draft that I'm >> confused about and I posted here because I think the draft text at least >> needs clarification. >> >> "Finally, the server has to prove to the client that it received the >> client's WebSocket handshake, ..." >> >> - Good so far >> >> "...so that the server doesn't accept connections that are not >> WebSocket connections." >> >> - What does proving to the client have to do with the _server_ refusing >> non-websockets connections? Perhaps this is supposed to be "...so that the >> client will not procede with connections to non-WebSocket servers." >> >> "This prevents an attacker from tricking a WebSocket server by sending >> it carefully-crafted packets using |XMLHttpRequest| or a |form| >> submission." >> >> - Again, what does proving to the client have to do with tricking the >> WebSocket server? Maybe this should really be "This prevents an attacker >> from tricking a non-WebSocket server by sending it carefully-crafted >> WebSocket packets because a non-WebSocket server will not return a correct >> Sec-WebSocket-Accept value during the handshake". >> >> Regards, >> >> Joel Martin >> >> 2011/6/16 Ian Fette (イアンフェッティ) <ifette@google.com> >> >> Sec-WebSocket-Accept uses a GUID defined in the protocol and the key from >>> the handshake to prove that the remote end is indeed a websocket server as >>> you point out. The other part is that Sec-WebSocket-Accept takes the key >>> from the Sec-WebSocket-Key header, which XHR cannot send and thus the server >>> doesn't have the information necessary to generate the Accept value as there >>> is no key from the client. >>> >>> The original question you link to is basically "why does the server have >>> to answer a challenge", and it breaks down into two parts: >>> >>> 1. Force server to validate that the client is a WebSocket client (by >>> making it use a value from Sec-WebSocket-Key along with the GUID, we ensure >>> that the server actually checks for the presence of Sec-WebSocket-Key.) >>> 2. Let the client validate that the server is actually a WebSocket server >>> (by checking that Sec-WebSocket-Accept is properly computed). >>> >>> #1 lets the server be sure it's not responding to some random XHR >>> request, >>> #2 lets the browser know that it's safe to connect and that it's >>> communicating to a WebSocket server and not some non-WS target. >>> >>> On Thu, Jun 16, 2011 at 8:54 AM, Joel Martin <hybi@martintribe.org>wrote: >>> >>>> I started to try and answer this StackOverflow question about the >>>> protocol text and realized that I didn't understand it as well as I thought: >>>> >>>> http://stackoverflow.com/questions/6372252/why-does-the-server-in-a-websocket-request-have-to-answer-a-challenge >>>> >>>> The question is related to this paragraph (which has been in the drafts >>>> for a while unchanged): >>>> >>>> Finally, the server has to prove to the client that it received the >>>> client's WebSocket handshake, so that the server doesn't accept >>>> connections that are not WebSocket connections. This prevents an >>>> attacker from tricking a WebSocket server by sending it carefully- >>>> crafted packets using |XMLHttpRequest| or a |form| submission. >>>> >>>> I can see how the Sec-WebSocket-Accept would prevent a WebSocket client >>>> from being tricked into connecting to a non-WebSocket server. However, I'm >>>> having difficulty understanding how the Sec-WebSocket-Accept header would >>>> prevent a XMLHttpRequest from succeeding to a WebSockets server since it is >>>> sent from the server. I am aware of the prohibition against "Sec-" headers >>>> in the client to server direction. Is there a requirement that >>>> XMLHttpRequest responses with unrecognized "Sec-" headers be rejected by >>>> user agents (and if so does this only apply in the browser case)? >>>> >>>> It's likely I just don't have enough context to understand the >>>> paragraph, but perhaps it could be clarified a bit. >>>> >>>> Regards, >>>> >>>> Joel Martin >>>> >>>> _______________________________________________ >>>> hybi mailing list >>>> hybi@ietf.org >>>> https://www.ietf.org/mailman/listinfo/hybi >>>> >>>> >>> >> >
- Re: [hybi] Websocket: two protocols into one, and… Anthony Catel
- [hybi] Websocket: two protocols into one, and Int… Iñaki Baz Castillo
- Re: [hybi] Websocket: two protocols into one, and… Iñaki Baz Castillo
- Re: [hybi] Websocket: two protocols into one, and… Anthony Catel
- Re: [hybi] Websocket: two protocols into one, and… Iñaki Baz Castillo
- Re: [hybi] Websocket: two protocols into one, and… Willy Tarreau
- Re: [hybi] Websocket: two protocols into one, and… Anthony Catel
- Re: [hybi] Websocket: two protocols into one, and… Joel Martin
- Re: [hybi] Websocket: two protocols into one, and… Ian Fette (イアンフェッティ)
- Re: [hybi] Websocket: two protocols into one, and… Joel Martin
- Re: [hybi] Websocket: two protocols into one, and… Ian Fette (イアンフェッティ)
- Re: [hybi] Websocket: two protocols into one, and… Willy Tarreau
- Re: [hybi] Websocket: two protocols into one, and… Philipp Serafin
- Re: [hybi] Websocket: two protocols into one, and… Joel Martin
- Re: [hybi] Websocket: two protocols into one, and… Joel Martin
- Re: [hybi] Websocket: two protocols into one, and… Iñaki Baz Castillo
- Re: [hybi] Websocket: two protocols into one, and… Ian Fette (イアンフェッティ)
- Re: [hybi] Websocket: two protocols into one, and… Dave Cridland