Re: [hybi] Websocket: two protocols into one, and Internet rules broken
Joel Martin <hybi@martintribe.org> Thu, 16 June 2011 20:23 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 7D0FC11E82BD for <hybi@ietfa.amsl.com>; Thu, 16 Jun 2011 13:23:20 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.751
X-Spam-Level:
X-Spam-Status: No, score=-1.751 tagged_above=-999 required=5 tests=[AWL=-1.225, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, MIME_CHARSET_FARAWAY=2.45, 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 mOj2uHvWM6wv for <hybi@ietfa.amsl.com>; Thu, 16 Jun 2011 13:23:17 -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 B4C3B11E82C6 for <hybi@ietf.org>; Thu, 16 Jun 2011 13:23:02 -0700 (PDT)
Received: by ewy19 with SMTP id 19so834348ewy.31 for <hybi@ietf.org>; Thu, 16 Jun 2011 13:23:01 -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=rOVneaAaWg4fzV2aTaR+NsMT2URM+tWuoEhXEqs7lkg=; b=KUhgcoLUKd1g8lkDu0wC1gaowa2kr3sc3XuikFkYYNpq7mtDJKlKy/wtODKDwa7oSG acNyyDb28li4GAx84nuvuGyCp2sUKMcf1gg9PUYcS2xOp9jKRFBc+LyRS+WohND4uMLE dhAeU6Popkbxha1Xhbuj4h7823JWTWKNDEeP0=
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=F2YfBMygSbcUra5gJRhke/2GGDYWrXfuu6aUqjD1rJd/j+mn7915nO1oWZNFGZ7hdo NDN/lFPHR8C2tXCj8r9svLFUGBs5YHTCKME6LvetVszlCvCQVK5ligyYIneNCmG1AYCH hTuHXTEZ46J0Pm/9XdjZRIOW5mExpedgH0B4c=
Received: by 10.14.2.67 with SMTP id 43mr555502eee.74.1308255781286; Thu, 16 Jun 2011 13:23:01 -0700 (PDT)
MIME-Version: 1.0
Sender: buskanaka@gmail.com
Received: by 10.14.127.1 with HTTP; Thu, 16 Jun 2011 13:22:41 -0700 (PDT)
In-Reply-To: <BANLkTik4y_fRd3pEuPdrwESb7ftdbuvk9w@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>
From: Joel Martin <hybi@martintribe.org>
Date: Thu, 16 Jun 2011 15:22:41 -0500
X-Google-Sender-Auth: jWbYH5TZ4GGbRNAsogXUDhoj6BA
Message-ID: <BANLkTin2000Q8=LUuuUqkfkX_GRrYAnNDw@mail.gmail.com>
To: ifette@google.com
Content-Type: multipart/alternative; boundary="0016364269551e75c704a5da090b"
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 20:23:20 -0000
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