Re: Signing Set-Cookie

Watson Ladd <watsonbladd@gmail.com> Mon, 06 June 2022 22:52 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id DED79C15AAC0 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 6 Jun 2022 15:52:18 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.76
X-Spam-Level:
X-Spam-Status: No, score=-7.76 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, HTML_MESSAGE=0.001, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aRfpWgR7Yu90 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 6 Jun 2022 15:52:14 -0700 (PDT)
Received: from lyra.w3.org (lyra.w3.org [128.30.52.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 8F66FC159497 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Mon, 6 Jun 2022 15:52:14 -0700 (PDT)
Received: from lists by lyra.w3.org with local (Exim 4.92) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1nyLXn-0003lI-Eb for ietf-http-wg-dist@listhub.w3.org; Mon, 06 Jun 2022 22:49:55 +0000
Resent-Date: Mon, 06 Jun 2022 22:49:55 +0000
Resent-Message-Id: <E1nyLXn-0003lI-Eb@lyra.w3.org>
Received: from mimas.w3.org ([128.30.52.79]) by lyra.w3.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <watsonbladd@gmail.com>) id 1nyLXl-0003kJ-K3 for ietf-http-wg@listhub.w3.org; Mon, 06 Jun 2022 22:49:53 +0000
Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]) by mimas.w3.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <watsonbladd@gmail.com>) id 1nyLXk-0004ga-5q for ietf-http-wg@w3.org; Mon, 06 Jun 2022 22:49:53 +0000
Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-e5e433d66dso20951311fac.5 for <ietf-http-wg@w3.org>; Mon, 06 Jun 2022 15:49:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RSaQ0dssyyrrJDqxVMaYW1KV9YyaX11Iw0FPwylMTGk=; b=GGjCbovLiSD33lL5nOcWncblJ0qtd5ldpnwdbmcIVDYoRkVerhvMqbUhjhpBskjckP eM9zEFTWfjc9mDU+5FTnqcKQnoeASjzfJGXqc/UJeFMVDVq/ek/aj/WnASqeQE7CgjlG psI/zG28Jp8JQyOU0ODnNx+WI2dtupRT1ap16d360bkMGfd1cm5OY3EKUKpJ8ScMTRGT zEpBv7ojlRPzXEdZSRQFySIipOl9MiwWtTeH7FniZf0Xp5z5Gn+VuAl6tL6HPLdtguQM aw//uSYrzVtGQSY1fNJhNxXCr05clkt6/K5IT8qbpQErIM2WerP1anCNCIvZQsdBHxzP nrXw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RSaQ0dssyyrrJDqxVMaYW1KV9YyaX11Iw0FPwylMTGk=; b=P2XZ+70M4Qz/xsDHpbtEuzZ+dhSXbM8TC5n07XnpvCFspbYjmdyuJei3aR/XNoCuVx MZHnq/eGg+Vtw6WLlPjeW9i9JNjWMCMiPUkKSmxMZuZBVpYWAP2MF8ND4Ah/C865W2Eq WOX/5W1kmL6rpgfvXzyE3zt0mpZLwHxJ7cFiXhsVUjIlX3t1ItkI8s/6mxNFPTcRP9V6 Im963SBiJKrAnW8X+adTwexkZubrL2QrADv5kh3xHcmfTymmXxZHopvFtxBJJede8rU1 e+OlcUDRQzKQmh90hXA1fInPEc9gvtNy3q1NGvhF0Q0TflYfS995LBz0/OG2P6q18LAK saJQ==
X-Gm-Message-State: AOAM531eHW1fCnD/PP8KZe/PuYVzrycg0Ec0iG3c0AU1U7tlknVSZORF SmCw687xswbGBmHLVP9IZo2f6ahjZthUPOeoFB8=
X-Google-Smtp-Source: ABdhPJxLKXi3+Sbp1m3SYSguFkl+Wf9irG48Taxu3MSjKWP2n92vgD9QWH1RarMb6o47nfTl4eCJdoQ8IDA2joxqEvU=
X-Received: by 2002:a05:6870:e995:b0:f2:9b89:2f14 with SMTP id r21-20020a056870e99500b000f29b892f14mr32111172oao.84.1654555781062; Mon, 06 Jun 2022 15:49:41 -0700 (PDT)
MIME-Version: 1.0
References: <A0601849-2870-4150-9926-5FA706D7F6DE@mit.edu> <CACcvr==K0gjhOaBaxt8vK80UYo1tAHVrh78yCcAEMvwx4tT=ag@mail.gmail.com> <7dff30c8-faac-413f-8387-f0a5a51fc6ff@beta.fastmail.com> <A659F1C6-97D6-48FB-BDED-B885AF93E553@mit.edu> <5f586a5b-4d62-40c8-8fa8-f747d08fd52f@beta.fastmail.com>
In-Reply-To: <5f586a5b-4d62-40c8-8fa8-f747d08fd52f@beta.fastmail.com>
From: Watson Ladd <watsonbladd@gmail.com>
Date: Mon, 06 Jun 2022 15:49:29 -0700
Message-ID: <CACsn0cnMk=3R8nAwiBhwVrJdf-OtE+E5GKc=ur6jmOxtaNrYaw@mail.gmail.com>
To: Martin Thomson <mt@lowentropy.net>
Cc: Justin Richer <jricher@mit.edu>, HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="0000000000009766c005e0cf49eb"
Received-SPF: pass client-ip=2001:4860:4864:20::32; envelope-from=watsonbladd@gmail.com; helo=mail-oa1-x32.google.com
X-W3C-Hub-DKIM-Status: validation passed: (address=watsonbladd@gmail.com domain=gmail.com), signature is good
X-W3C-Hub-Spam-Status: No, score=-4.1
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: mimas.w3.org 1nyLXk-0004ga-5q d14b8ee41612fbb8509cf06f3f3870ea
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Signing Set-Cookie
Archived-At: <https://www.w3.org/mid/CACsn0cnMk=3R8nAwiBhwVrJdf-OtE+E5GKc=ur6jmOxtaNrYaw@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/40075
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <https://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

This would also apply to treating MAC as a Signature wouldn't it?

On Mon, Jun 6, 2022, 3:31 PM Martin Thomson <mt@lowentropy.net> wrote:

> Hey Justin,
>
> I don't agree that this is an acceptable way of dealing with this
> problem.  It makes the content under signature malleable.  Even if that is
> extremely narrowly applicable, I don't see how we could publish a
> specification where the only defense against an attack like this is text to
> the effect of "this might happen".
>
> On Tue, Jun 7, 2022, at 06:50, Justin Richer wrote:
> > What I’ve done is create a new security consideration for this, and
> > discussing how it might possibly lead to the foothold for an attack.
> >
> >
> https://github.com/httpwg/http-extensions/pull/2143/files#diff-1d57bca6223a0fee3ef29148c2550c0f862e72f67a56cc7f57b5a72fbd8320e3R1802
> >
> > — Justin
> >
> >> On Jun 1, 2022, at 7:58 PM, Martin Thomson <mt@lowentropy.net> wrote:
> >>
> >> Yeah, what Nick said.
> >>
> >> Cookie concatenation has a special carve-out in all HTTP versions past
> 1.x; I see no real harm in making another for Set-Cookie.
> >>
> >> On Thu, Jun 2, 2022, at 09:20, Nick Harper wrote:
> >>> A Set-Cookie header could have a comma in it (e.g. in the Expires= or
> >>> Path= parts), which means that it's probably possible for two
> different
> >>> combinations of Set-Cookie headers to be concatenated/canonicalized to
> >>> the same value. I'm not certain there's an attack here, but this seems
> >>> potentially problematic enough that this should be given more
> >>> consideration.
> >>>
> >>> On Wed, Jun 1, 2022 at 2:39 PM Justin Richer <jricher@mit.edu> wrote:
> >>>> The Set-Cookie header syntax is weird in that it doesn’t allow for
> concatenation in the normal List syntax. The Signature spec relies on this
> concatenation for the combination of values of headers that show up
> multiple times. This discrepancy is called out in this issue:
> >>>>
> >>>> https://github.com/httpwg/http-extensions/issues/1183
> >>>>
> >>>> However, on further investigation, I don’t think this actually causes
> a problem. The concatenation process outlined in Signatures still works on
> multiple Set-Cookie values, the only weird thing is that the RESULT of that
> process cannot itself be parsed as a valid Set-Cookie header.
> >>>>
> >>>> But the thing is, it doesn’t have to be parsed. It just has to exist
> as a string in the signature base, and be re-created by both signer and
> verifier in a consistent way.
> >>>>
> >>>> I’m planning on closing this issue with a note in the appropriate
> section of the signature spec, but if there’s something I’m missing about
> this, please chime in.
> >>>>
> >>>> — Justin
> >>
>
>