Re: [hybi] Masking only Payload/Extension Data

Ian Fette (イアンフェッティ) <ifette@google.com> Wed, 09 March 2011 08:26 UTC

Return-Path: <ifette@google.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 E3F2E3A68AA for <hybi@core3.amsl.com>; Wed, 9 Mar 2011 00:26:26 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -105.54
X-Spam-Level:
X-Spam-Status: No, score=-105.54 tagged_above=-999 required=5 tests=[AWL=0.136, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
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 LXhZk8ZA7ynD for <hybi@core3.amsl.com>; Wed, 9 Mar 2011 00:26:25 -0800 (PST)
Received: from smtp-out.google.com (smtp-out.google.com [74.125.121.67]) by core3.amsl.com (Postfix) with ESMTP id 004CD3A687D for <hybi@ietf.org>; Wed, 9 Mar 2011 00:26:24 -0800 (PST)
Received: from wpaz21.hot.corp.google.com (wpaz21.hot.corp.google.com [172.24.198.85]) by smtp-out.google.com with ESMTP id p298RdYH017717 for <hybi@ietf.org>; Wed, 9 Mar 2011 00:27:39 -0800
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1299659260; bh=vjAM8YKt/fJPhWZbY6qJDVn1uRI=; h=MIME-Version:Reply-To:In-Reply-To:References:Date:Message-ID: Subject:From:To:Cc:Content-Type; b=lY+3y/vUly7wO/QsaaJFeTbKaT7bC0Z58VSVQXChhytkoSJQdlkOSOMDMoAyHcs2/ HUz4a0OaJWaxsB9PGESfg==
Received: from iwn9 (iwn9.prod.google.com [10.241.68.73]) by wpaz21.hot.corp.google.com with ESMTP id p298RGrU028277 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <hybi@ietf.org>; Wed, 9 Mar 2011 00:27:38 -0800
Received: by iwn9 with SMTP id 9so347863iwn.23 for <hybi@ietf.org>; Wed, 09 Mar 2011 00:27:38 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:mime-version:reply-to:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=w2vit4A9GZl+DHvSt9yrCNZsW582JRsHlzHq5Zm4H2A=; b=jXoAeWmvLsUYlTbLFPFmtbRC7ITuJAja/6ZuIdc44W20GXPuuqHwNdXJQoGQ76agkF adOCK1P3S/CboWmAwC1Q==
DomainKey-Signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; b=AV6liKkOjTlbLwfuhbghAOh3cqC27jj6vvBzbpjI41Iy1PuRVajSw7bAi9EZJVrsUs werHUYBlvdOfTK1OxoYg==
MIME-Version: 1.0
Received: by 10.43.54.71 with SMTP id vt7mr7878789icb.225.1299659256565; Wed, 09 Mar 2011 00:27:36 -0800 (PST)
Received: by 10.231.34.131 with HTTP; Wed, 9 Mar 2011 00:27:36 -0800 (PST)
In-Reply-To: <AANLkTim7js6hPBMoEgmzr3gH-NuRYkEZ-pAePkgo=Q=L@mail.gmail.com>
References: <AANLkTim7js6hPBMoEgmzr3gH-NuRYkEZ-pAePkgo=Q=L@mail.gmail.com>
Date: Wed, 09 Mar 2011 00:27:36 -0800
Message-ID: <AANLkTimcTUYRMBA7XfYpbUNX26eup+oq2C3cL-q8+gf-@mail.gmail.com>
From: "Ian Fette (イアンフェッティ)" <ifette@google.com>
To: Brian <theturtle32@gmail.com>
Content-Type: multipart/alternative; boundary="bcaec51d2a7c510e13049e088093"
X-System-Of-Record: true
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] Masking only Payload/Extension Data
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: ifette@google.com
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, 09 Mar 2011 08:26:27 -0000

Can someone please explain to me why this matters? Given that we went with a
32-bit mask included in the frame, and it's just xor, I'm really not
sympathetic to arguments about "it's hard to unmask" etc. The only thing
that I've heard that resonates at all is that you have to know which
direction the connection is going, e.g. which is the client and which is the
server, that said it seems like any proxy doing anything interesting would
probably already know this?

-Ian

On Tue, Mar 8, 2011 at 11:29 PM, Brian <theturtle32@gmail.com> wrote:

> In hope of getting consensus on the idea that only the payload and
> extension data should be masked and not the framing itself, I took a
> pass at adjusting sections 4.1 and 4.2 accordingly.  It didn't take
> much, just a few minor tweaks.
>
> What do you think?  Any chance we could reach a rough consensus on
> masking only the extension/payload data?
>
>
>
> 4.1.  Overview
>
>   In the WebSocket protocol, data is transmitted using a sequence of
>   frames.  The payload portion of frames sent from the client to the
>   server is always masked to avoid confusing network intermediaries,
>   such as intercepting proxies.  The payload portion of frames sent
>   from the server to the client are not masked.
>
>   The base framing protocol defines a frame type with an opcode, a
>   payload length, and designated locations for extension and
>   application data, which together define the _payload_ data.  Certain
>   bits and opcodes are reserved for future expansion of the protocol.
>   As such, In the absence of extensions negotiated during the opening
>   handshake (Section 5), all reserved bits MUST be 0 and reserved
>   opcode values MUST NOT be used.
>
>   A data frame MAY be transmitted by either the client or the server at
>   any time after handshake completion and before that endpoint has sent
>   a close message (Section 4.5.1).
>
> 4.2.  Client-to-Server Masking
>
>   The client MUST mask the payload of all frames sent to the server,
>   including all extension data.
>
>   The masking-key is contained completely within the payload.
>
>   The masking-key is a 32-bit value chosen at random by the client.
>   The masking-key MUST be derived from a strong source of entropy, and
>   the masking-key for a given frame MUST NOT make it simple for a
>   server to predict the masking-key for the payload in a subsequent
>   frame.
>
>   Each masked payload consists of a 32-bit masking-key followed by
>   masked-data:
>
>
>     masked-payload  = masking-key masked-data
>     masking-key     = 4full-octet
>     masked-data     = *full-octet
>     full-octet      = %x00-FF
>
>
>   The masked-data is the clear-text payload "encrypted" using a simple
>   XOR cipher as follows.
>
>
>   Octet i of the masked-data is the XOR of octet i of the clear text
>   frame with octet i modulo 4 of the masking-key:
>     j              = i MOD 4
>     masked-octet-i = clear-text-octet-i XOR octet-j-of-masking-key
>
>
>   When preparing a masked-payload, the client MUST pick a fresh masking-
>   key uniformly at random from the set of allowed 32-bit values.  The
>   unpredictability of the masking-nonce is essential to prevent the
>   author of malicious application data from selecting the bytes that
>   appear on the wire.
>
>
>
>
> Brian McKelvey
> _______________________________________________
> hybi mailing list
> hybi@ietf.org
> https://www.ietf.org/mailman/listinfo/hybi
>