Re: [OAUTH-WG] Downgrade attacks on PKCE

Ryan Kelly <rfkelly@mozilla.com> Mon, 01 June 2020 00:03 UTC

Return-Path: <rkelly@mozilla.com>
X-Original-To: oauth@ietfa.amsl.com
Delivered-To: oauth@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 10A323A086C for <oauth@ietfa.amsl.com>; Sun, 31 May 2020 17:03:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level:
X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=mozilla.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x5pXhDzpZ_cj for <oauth@ietfa.amsl.com>; Sun, 31 May 2020 17:03:46 -0700 (PDT)
Received: from mail-ua1-x92c.google.com (mail-ua1-x92c.google.com [IPv6:2607:f8b0:4864:20::92c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 48A283A086B for <oauth@ietf.org>; Sun, 31 May 2020 17:03:46 -0700 (PDT)
Received: by mail-ua1-x92c.google.com with SMTP id g14so2769950uaq.0 for <oauth@ietf.org>; Sun, 31 May 2020 17:03:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mozilla.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qRYwmjCsikH9nYMdJjRcjNJ16V215ujobhfHyW+K/Z8=; b=CgCji0iWCNHOH4eZo95H8lMuMTQjcIC2R/9PQ6abHm13F8+Eur1n4YOOWliVtORTb+ wUj7HMzYxK3b94Xqcx5l271NTQt5daAHzy68ZBSm48rxBHAgqieHPla8MAxDAy3symDA gcJrn18boxtC4GXtcVFqrhIXXu90g05S75Bqo=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qRYwmjCsikH9nYMdJjRcjNJ16V215ujobhfHyW+K/Z8=; b=VdidNUr1UQIrZu8sIvGG2lz8NmWN0Qh62ipRYUIYRRt3t5HfUN5UtW5TD3hWLsGaqH gdjRxWFdZmd8eY1lxZg8zJJkSvvBg8UROjSzvQhQTh+fBFUmaXbcUZ7DzW27abIq3wMw R6BHyP9/MJwUdJdrYqm1MizrVCAzlKWt7n4flYHkVV1QfYkoxfG7FLPMRwEH6rFF3zIJ Wb2CCjnLgWaIButJrE9zH0ZjFsoslUXCIjmxt3ir4wfJZ0kylQyYbhucRkIzV/OCTeHX vchUqHBwzqK3x1CrEql7eqrs1xD7/FwzqJRvxndztD2/sqXBqVkLFOfE7E3hGWokkmMq i+8g==
X-Gm-Message-State: AOAM533UlT9N06+DMiLJq8HF2iFvqdVVpsljEJ9vA+yZmf4nA4TCoO7d H/5o2ZF6H1/T26RC2f1XFfPTzK7dE3RsVqE9wfMWf2c6
X-Google-Smtp-Source: ABdhPJzXCjrANyVWBBLTTXqAwJAI6uWfUvhzuXsCFE/9wzPPW34vvBNADS2A5vyR2DCNDOEYRkLbnOMQru8mCz/a/aY=
X-Received: by 2002:ab0:7202:: with SMTP id u2mr11788124uao.119.1590969824001; Sun, 31 May 2020 17:03:44 -0700 (PDT)
MIME-Version: 1.0
References: <3e18622b-5135-be90-0ce9-23676be4fc50@danielfett.de>
In-Reply-To: <3e18622b-5135-be90-0ce9-23676be4fc50@danielfett.de>
From: Ryan Kelly <rfkelly@mozilla.com>
Date: Mon, 1 Jun 2020 10:03:33 +1000
Message-ID: <CAB3n-YY8nfqz2s3fMov4=B0J_BRL=+WVAj2t6Q0Qba7gNx+NNQ@mail.gmail.com>
To: Daniel Fett <fett@danielfett.de>
Cc: "oauth@ietf.org" <oauth@ietf.org>
Content-Type: multipart/alternative; boundary="00000000000035615905a6fa871e"
Archived-At: <https://mailarchive.ietf.org/arch/msg/oauth/yG4jA8Rbmf34NYb48F7CAk33TxQ>
Subject: Re: [OAUTH-WG] Downgrade attacks on PKCE
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: OAUTH WG <oauth.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/oauth>, <mailto:oauth-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/oauth/>
List-Post: <mailto:oauth@ietf.org>
List-Help: <mailto:oauth-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/oauth>, <mailto:oauth-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 01 Jun 2020 00:03:48 -0000

On Sat, 30 May 2020 at 17:59, Daniel Fett <fett@danielfett.de> wrote:

> Aaron, Dick, Torsten and I today discussed the downgrade attacks on PKCE
> [1] and how to mitigate them in OAuth 2.1 and 2.0. We came to the
> conclusion that we have two options:
>
[..snip..]
> *2. "Dynamic" Solution*
>
> Each AS that supports PKCE MUST check whether a code challenge is
> contained in the authorization request. This information MUST be bound to
> the code that is issued.
>
> When a code arrives at the token endpoint, the AS MUST do the following
> check:
>
>    1. If there was a code_challenge in the authorization request for
>    which this code was issued, there must be a code_verifier in the token
>    request and it must be verified according to RFC7636. (This is no change
>    from the current behavior in RFC7636.)
>    2. If there was no code_challenge in the authorization request, any
>    request to the token endpoint containing a code_verifier MUST be rejected.
>
> Properties:
>
>    - No change in behavior needed for properly implemented clients.
>    Backwards compatible for all existing deployments.
>    - Implementation is mainly some logic for the authorization endpoint,
>    token endpoint, and a new data field in the authorization session
>    maintained by the AS.
>    - Slightly more complex to implement for the AS, maybe.
>
> We would like to hear the feedback from the working group on these two
> solutions before proceeding to propose wording for the affected documents.
>

When we added PKCE support in Firefox Accounts, we implemented the
suggested check (2) above purely as a defensive-coding measure, expecting
that it might help us catch buggy clients. I think it makes sense to add as
a required behaviour since it seems like a pretty clear signal of
mismatched expectations between client and server.

  Cheers,

     Ryan