Re: [OAUTH-WG] Downgrade attacks on PKCE

Ryan Kelly <> Mon, 01 June 2020 00:03 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 10A323A086C for <>; Sun, 31 May 2020 17:03:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.098
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: (amavisd-new); dkim=pass (1024-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id x5pXhDzpZ_cj for <>; Sun, 31 May 2020 17:03:46 -0700 (PDT)
Received: from ( [IPv6:2607:f8b0:4864:20::92c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 48A283A086B for <>; Sun, 31 May 2020 17:03:46 -0700 (PDT)
Received: by with SMTP id g14so2769950uaq.0 for <>; Sun, 31 May 2020 17:03:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; 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;; 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: <>
In-Reply-To: <>
From: Ryan Kelly <>
Date: Mon, 1 Jun 2020 10:03:33 +1000
Message-ID: <>
To: Daniel Fett <>
Cc: "" <>
Content-Type: multipart/alternative; boundary="00000000000035615905a6fa871e"
Archived-At: <>
Subject: Re: [OAUTH-WG] Downgrade attacks on PKCE
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: OAUTH WG <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Mon, 01 Jun 2020 00:03:48 -0000

On Sat, 30 May 2020 at 17:59, Daniel Fett <> 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:
> *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.