Re: [OAUTH-WG] OAuth 2.1 - require PKCE?

Torsten Lodderstedt <torsten@lodderstedt.net> Mon, 11 May 2020 06:40 UTC

Return-Path: <torsten@lodderstedt.net>
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 58F7F3A084B for <oauth@ietfa.amsl.com>; Sun, 10 May 2020 23:40:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.099
X-Spam-Level:
X-Spam-Status: No, score=-2.099 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, 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 (2048-bit key) header.d=lodderstedt.net
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 OOi2dnGs020C for <oauth@ietfa.amsl.com>; Sun, 10 May 2020 23:40:43 -0700 (PDT)
Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (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 E7CB13A0837 for <oauth@ietf.org>; Sun, 10 May 2020 23:40:41 -0700 (PDT)
Received: by mail-wr1-x431.google.com with SMTP id y3so9390392wrt.1 for <oauth@ietf.org>; Sun, 10 May 2020 23:40:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lodderstedt.net; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=j2szNaOl+asOian+b8zZ7R/1NCprJtkB4qLOegO9/PU=; b=biwwWJWfLIvJD0Ny48mjI5aTqesdFfnd+4TdmAnymLXWGaoelXbg/lN/iFiwrCJV2q j5TrRY/anNfKhDrS93DHr3nrTRHPHN1BuycNm2rz6/WVIN814oBmDVz2xYdKJFgktcv0 jxzCxCxoMGehGq/c1w9z9nQ6DTlLGuRxP/xjXsduauG1qWt+4DzaNqaK114NKFPAxXb0 L/HF7yqGsUNst7o5ilWn5RJENfsthKLGc2FuSn9zWWbx1lQuONd9SPiH8mJYHDk0vT6t MJrpDM7A5sNTp1uLGD1QbiNvWkaFx8r1iiPx0r0geFUWlBxtoMWrf06lTdXvNQ/2B6Ry FF5g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=j2szNaOl+asOian+b8zZ7R/1NCprJtkB4qLOegO9/PU=; b=n6zXFDvlEUWqhlLk5hvjFdmaEDBdw0zak1T3vwpaHYds0pzrg+unUINsG2IJTKb4W/ 86qzvMqL9oP+J2RABP6+1u4zWJkS9x8XwlYxFNGMEu+ImOPqAwgp9VHFg3ftfCWHQpyZ 468WM5V0K6PhmINRhU0PiZY9eqQZd9HvTaaVtTMyNrCOHYfuKjaycAJbAdAX5Vzf0Qen k0OhUKH+6VoYsz4JVk1U+3Iwhe3RvlU2UURxcAhlSEVw5Wc7GGDDSdZp7vb5C6e8FUbJ cLkRBpp+b+yi5SmXy9wDCwpRpUaxUT9JTiy8itjZWuFCvaFFJlzNFVAAO+0kcsQCeU7K Pc3A==
X-Gm-Message-State: AGi0Pub2dw6eKvOshj8LjQCMd/yqdZw7xGitVthxWYOhiA711npQ31iy rTtRpJ+15ExxbIokJMjRXmMwGA==
X-Google-Smtp-Source: APiQypLzQzBgPTkOQzNuikTNpVby3lyusXCQGWf+Hj6UJPO/N8bHOhawrDHDIoVOltRCqbk6G8yFfQ==
X-Received: by 2002:a5d:614b:: with SMTP id y11mr18062123wrt.77.1589179239624; Sun, 10 May 2020 23:40:39 -0700 (PDT)
Received: from p200300eb8f301f67a4ec9c1a06d87114.dip0.t-ipconnect.de (p200300EB8F301F67A4EC9C1A06D87114.dip0.t-ipconnect.de. [2003:eb:8f30:1f67:a4ec:9c1a:6d8:7114]) by smtp.gmail.com with ESMTPSA id r11sm13248067wma.35.2020.05.10.23.40.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 May 2020 23:40:39 -0700 (PDT)
Content-Type: text/plain; charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\))
From: Torsten Lodderstedt <torsten@lodderstedt.net>
In-Reply-To: <MN2PR00MB0688E35CB78EA69D1A3F0A65F5A00@MN2PR00MB0688.namprd00.prod.outlook.com>
Date: Mon, 11 May 2020 08:40:35 +0200
Cc: Aaron Parecki <aaron@parecki.com>, Dick Hardt <dick.hardt@gmail.com>, OAuth WG <oauth@ietf.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <81A18E7D-44BB-4BE1-B93F-6584FC6DA862@lodderstedt.net>
References: <MN2PR00MB0688E35CB78EA69D1A3F0A65F5A00@MN2PR00MB0688.namprd00.prod.outlook.com>
To: Mike Jones <Michael.Jones@microsoft.com>
X-Mailer: Apple Mail (2.3608.80.23.2.2)
Archived-At: <https://mailarchive.ietf.org/arch/msg/oauth/au9HXGa2fbtsoqSnkJ1rgYybCoM>
Subject: Re: [OAUTH-WG] OAuth 2.1 - require 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, 11 May 2020 06:40:49 -0000


> On 10. May 2020, at 21:02, Mike Jones <Michael.Jones@microsoft.com> wrote:
> 
> > Did I got it right that nonce does not protect public clients from code theft/replay?
>  
> I believe that the OpenID Connect Code Hash (“c_hash”) claim protects against this.  

c_hash is designed to prevent injection at a legit client and must be enforced by the client - just like nonce. 

That might work with a confidential client, but in case of a public client, the attacker does not need to inject the code in order to redeem it. The attacker can just directly redeem the code for an access token without checking c_hash or nonce.

> I’d be interested in hearing John Bradley’s take on this.
>  
>                                                        -- Mike
>  
> From: Torsten Lodderstedt <torsten@lodderstedt.net> 
> Sent: Sunday, May 10, 2020 3:17 AM
> To: Mike Jones <Michael.Jones@microsoft.com>
> Cc: Aaron Parecki <aaron@parecki.com>om>; Dick Hardt <dick.hardt@gmail.com>om>; OAuth WG <oauth@ietf.org>
> Subject: Re: OAuth 2.1 - require PKCE?
>  
> Mike Jones <Michael.Jones@microsoft.com> schrieb am Sa. 9. Mai 2020 um 20:46:
> There’s a huge ecosystem of successful, secure OAuth 2.0 and OpenID Connect deployments that we have the responsibility to be stewards of.  This working group should be proud of what it’s accomplished.  Part of good stewardship is not unnecessarily bifurcating the ecosystem into non-interoperable segments.  OAuth 2.1 should facilitate the already secure OAuth 2.0 deployments remaining part of the interoperable OAuth 2.1 set of deployments – not intentionally doing the opposite.
>  
> If it ain’t broke, don’t fix it!
> Did I got it right that nonce does not protect public clients from code theft/replay? I would consider this a security issue.
>  
>                                                        -- Mike
>  
> From: Aaron Parecki <aaron@parecki.com> 
> Sent: Friday, May 8, 2020 8:34 PM
> To: OAuth WG <oauth@ietf.org>
> Cc: Dick Hardt <dick.hardt@gmail.com>om>; Torsten Lodderstedt <torsten@lodderstedt.net>et>; Mike Jones <Michael.Jones@microsoft.com>
> Subject: Re: OAuth 2.1 - require PKCE?
>  
> Aaron, I believe you’re trying to optimize the wrong thing.  You’re concerned about “the amount of explanation this will take”.  That’s optimizing for spec simplicity – a goal that I do understand.  However, by writing these few sentences or paragraphs, we’ll make it clear to developers that hundreds or thousands of deployed OpenID Connect RPs won’t have to change their deployments.  That’s optimizing for interoperability and minimizing the burden on developers, which are far more important.
>  
> I appreciate the concern about optimizing for spec simplicity. I also agree that spec simplicity should not necessarily be the driving goal.
>  
> However, what you've described is the opposite of interoperability and minimizing the burden on developers. Requiring PKCE in OAuth 2.1, without any exceptions, will optimize for interoperability between OAuth 2.1 clients and servers. Without the requirement of PKCE, there will always be the question of "but does this OAuth 2.1 client work with this OAuth 2.1 server or not?", which will only be able to be answered by investigating the docs to look for PKCE support, or by checking the AS metadata document if it publishes one (which it is not required to do).
>  
> Optimizing for interoperability and minimizing the burden on developers is absolutely a good goal, and requiring PKCE is a great way to accomplish that. OAuth 2.0 and OpenID Connect implementations that don't support PKCE will continue to work as they currently do, they just won't be able to call themselves OAuth 2.1 compliant, just as is the case as if they don't follow the other recommendations that are in OAuth 2.1 and the Security BCP.
>  
> Aaron 
>  
>  
> On Thu, May 7, 2020 at 6:42 PM Mike Jones <Michael.Jones@microsoft.com> wrote:
> Aaron, I believe you’re trying to optimize the wrong thing.  You’re concerned about “the amount of explanation this will take”.  That’s optimizing for spec simplicity – a goal that I do understand.  However, by writing these few sentences or paragraphs, we’ll make it clear to developers that hundreds or thousands of deployed OpenID Connect RPs won’t have to change their deployments.  That’s optimizing for interoperability and minimizing the burden on developers, which are far more important.
>  
> As Brian Campbell wrote, “They are not equivalent and have very different ramifications on interoperability”.
>  
> Even if you’re optimizing for writing, taking a minimally invasive protocol change approach will optimize that, overall.  If we proceed as you’re suggesting, a huge amount of writing will occur on StackOverflow, Medium, SlashDot, blogs, and other developer forums, where confused developers will ask “Why do I have to change my deployed code?” with the answers being “Despite what the 2.1 spec says, there’s no need to change your deployed code.”
>  
> I’d gladly write a few sentences in our new specs now to prevent ongoing confusion and interop problems that would otherwise result.  Let me know when you’re ready to incorporate them into the spec text.
>  
>                                                        -- Mike
>  
> From: Aaron Parecki <aaron@parecki.com> 
> Sent: Thursday, May 7, 2020 4:39 PM
> To: Dick Hardt <dick.hardt@gmail.com>
> Cc: OAuth WG <oauth@ietf.org>rg>; Torsten Lodderstedt <torsten@lodderstedt.net>et>; Mike Jones <Michael.Jones@microsoft.com>
> Subject: Re: OAuth 2.1 - require PKCE?
>  
> Backing up a step or two, there's another point here that I think has been missed in these discussions.
>  
> PKCE solves two problems: stolen authorization codes for public clients, and authorization code injection for all clients. We've only been talking about authorization code injection on the list so far. The quoted section of the security BCP (4.5.3) which says clients can do PKCE or use the nonce, is only talking about preventing authorization code injection.
>  
> The nonce parameter solves authorization code injection if the client requests an ID token. Public clients using the nonce parameter are still susceptible to stolen authorization codes so they still need to do PKCE as well.
>  
> The only case where OpenID Connect clients don't benefit from PKCE is if they are also confidential clients. Public client OIDC clients still need to do PKCE even if they check the nonce.
>  
> OpenID Connect servers working with confidential clients still benefit from PKCE because they can then enforce the authorization code injection protection server-side rather than cross their fingers that clients implemented the nonce check properly.
>  
> I really don't think it's worth the amount of explanation this will take in the future to write an exception into OAuth 2.1 or the Security BCP for only some types of OpenID Connect clients when all clients would benefit from PKCE anyway.
>  
> Aaron
>  
>  
>  
> On Wed, May 6, 2020 at 10:48 AM Dick Hardt <dick.hardt@gmail.com> wrote:
> Hello!
>  
> We would like to have PKCE be a MUST in OAuth 2.1 code flows. This is best practice for OAuth 2.0. It is not common in OpenID Connect servers as the nonce solves some of the issues that PKCE protects against. We think that most OpenID Connect implementations also support OAuth 2.0, and hence have support for PKCE if following best practices.
>  
> The advantages or requiring PKCE are:
>  
> - a simpler programming model across all OAuth applications and profiles as they all use PKCE
>  
> - reduced attack surface when using  S256 as a fingerprint of the verifier is sent through the browser instead of the clear text value
>  
> - enforcement by AS not client - makes it easier to handle for client developers and AS can ensure the check is conducted
>  
> What are disadvantages besides the potential impact to OpenID Connect deployments? How significant is that impact?
>  
> Dick, Aaron, and Torsten
>  
> ᐧ