Re: [OAUTH-WG] Certificate-bound refresh tokens and certificate expiration handling in case of the confidential clients

Aaron Parecki <aaron@parecki.com> Wed, 24 August 2022 19:30 UTC

Return-Path: <aaron@parecki.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 BF9AAC1522A1 for <oauth@ietfa.amsl.com>; Wed, 24 Aug 2022 12:30:28 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.106
X-Spam-Level:
X-Spam-Status: No, score=-2.106 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, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=parecki.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 Xlii1MTsN2ZQ for <oauth@ietfa.amsl.com>; Wed, 24 Aug 2022 12:30:24 -0700 (PDT)
Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 92E0BC14F725 for <oauth@ietf.org>; Wed, 24 Aug 2022 12:30:24 -0700 (PDT)
Received: by mail-il1-x12e.google.com with SMTP id y17so5552617ilp.10 for <oauth@ietf.org>; Wed, 24 Aug 2022 12:30:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=parecki.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=WLPMCj/0alJ4stNXmVpfUNZUR8n8J09mRSUhUpYMcxs=; b=Co8hLlLBggACC6ldGY5h6cnqN6Ev4guFucbt7NtGefdBgH8UEefOIrIU2aMmlzlw+u d0wS5o9caalhaAbojFOFc5sScHby9L2owmE8E9pTvgM7DSDUChoXcLJgJE5qbPf20ZPt QhTvkD4S6gnryn/MG5FTGOcZVK2WVwUmVjMjMta8iF9NbDHIz87jJyy8aBp5LP3kPHQo RrGNYxbx1BkaT69/pYopSkJc7uEMghf77TO0zc988CBW2vrgYxMD9Y76pTLJh4rhSZIK OtF5M3vsjmWMj6Eedpy/olcDiBvUnjMZzQ+70hngkljpeQrUa8On+Tyzr+1i0jLJUMo7 Ah0Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=WLPMCj/0alJ4stNXmVpfUNZUR8n8J09mRSUhUpYMcxs=; b=BZG4Klckw6hcjoI3mJeTf0Dj2y6Osx1DSdUW/FVNej1FYKudYF38y3L3egDGfk4/iw +Zqs8ta5xBmGSx8xM2ovCu7lzZRsrLxbIwoE3ZCd12G9s6UyJC6dUCaGJpOh/Na1OzTb C617ys+uURT7i4clAO5mluSM0EDf6NeOvkN/ScrUWhZiLciXZoZhPXs/FPgohMTcw0gN YBP2QGT3m10AVND1xYlVXilgvYAjT+s+HWI9lK7yx0FCQlGE6tvw8M0aNiywEmZ6fNdb pOCcrWEYnXzhvUYNeg9qQU+32aPq31V8o9CwkMmyNLzj+NfdlB4busPmq75eEG2jQUkz Mkxw==
X-Gm-Message-State: ACgBeo303CsqJr9cm9P+CQ5cKCdPMUF8VJ0at0LjUy0sYhlVRwIYhQp+ 66pk3dTf6fOM3dfhylDCE+0D6yfTaXgc0Q==
X-Google-Smtp-Source: AA6agR6BI+cjCw1qWwpPjRkYFQWgzmGnzWCUrPFSY4XWZrMjMijYzOhPfg+X+rgJ+hAjic/QaRKxJw==
X-Received: by 2002:a92:ca47:0:b0:2de:a702:7a20 with SMTP id q7-20020a92ca47000000b002dea7027a20mr238608ilo.307.1661369423231; Wed, 24 Aug 2022 12:30:23 -0700 (PDT)
Received: from mail-io1-f45.google.com (mail-io1-f45.google.com. [209.85.166.45]) by smtp.gmail.com with ESMTPSA id f37-20020a0284a8000000b00349fbd5ba58sm139232jai.146.2022.08.24.12.30.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Aug 2022 12:30:21 -0700 (PDT)
Received: by mail-io1-f45.google.com with SMTP id z72so14222481iof.12; Wed, 24 Aug 2022 12:30:21 -0700 (PDT)
X-Received: by 2002:a5d:9651:0:b0:684:8fe1:35e6 with SMTP id d17-20020a5d9651000000b006848fe135e6mr238044ios.6.1661369421057; Wed, 24 Aug 2022 12:30:21 -0700 (PDT)
MIME-Version: 1.0
References: <006c01d8ad93$776364f0$662a2ed0$@association.ge> <007201d8ad94$710026b0$53007410$@association.ge> <CA+k3eCSzUaNiO=NpqT5284+JQK=fDK_uGP_QuD65M_J5oWdWzA@mail.gmail.com> <00c001d8adae$5f33ba90$1d9b2fb0$@association.ge> <CAODMz5HZESoLP+ZfhgwLOmFWHo13AanrfchTBMubVU55CDSROg@mail.gmail.com> <49c224f2-13a1-6580-51a4-5f2f1c28ba39@hackmanit.de> <CAODMz5HK5gLv4atQgMxn1e13b8kW29=tXCiDY5Q9+2gJX209zQ@mail.gmail.com> <DDBBF80B-87F1-4211-AA69-33D51F9C7789@lodderstedt.net> <CAODMz5HeS1ZQkEBw1YgiO=G+w2n-drheNfVWy=ti2FGAunNudQ@mail.gmail.com>
In-Reply-To: <CAODMz5HeS1ZQkEBw1YgiO=G+w2n-drheNfVWy=ti2FGAunNudQ@mail.gmail.com>
From: Aaron Parecki <aaron@parecki.com>
Date: Wed, 24 Aug 2022 12:30:10 -0700
X-Gmail-Original-Message-ID: <CAGBSGjqPEiM-ea8rtU0f=FS-MjmyP7LrPWK=8+-zuEZuz5YdAQ@mail.gmail.com>
Message-ID: <CAGBSGjqPEiM-ea8rtU0f=FS-MjmyP7LrPWK=8+-zuEZuz5YdAQ@mail.gmail.com>
To: Jaimandeep Singh <jaimandeep.phdcs21@nfsu.ac.in>
Cc: Torsten Lodderstedt <torsten=40lodderstedt.net@dmarc.ietf.org>, draft-ietf-oauth-v2-1@ietf.org, oauth@ietf.org
Content-Type: multipart/alternative; boundary="0000000000002ed6bc05e701b66c"
Archived-At: <https://mailarchive.ietf.org/arch/msg/oauth/W1WsM1rL9lQAXX91bzfr0BKe2pY>
Subject: Re: [OAUTH-WG] Certificate-bound refresh tokens and certificate expiration handling in case of the confidential clients
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.39
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: Wed, 24 Aug 2022 19:30:28 -0000

The consent is typically associated with the user and client_id pair, the
authorization code is just a temporary artifact used for the client to
obtain a token regardless of consent.

Whether a client_id is used for a large number of instances of a client is
up to a particular deployment and is not always true or false.

Plus there's the issue of public clients mentioned in RFC6749, suggesting
that public clients should not bypass the consent screen even if the user
has already approved a particular client.

Basically what you're asking about is already possible and already done by
many systems, I'm not sure there is anything that needs to be done in terms
of the specification to enable what you're suggesting.

Aaron



On Wed, Aug 24, 2022 at 11:01 AM Jaimandeep Singh <
jaimandeep.phdcs21@nfsu.ac.in> wrote:

> Hi Torsten,
> 1. You are right that consent can be preserved at the AS. The concern here
> is what happens when the refresh token expires? Do we again go back to the
> user and ask for consent or is there some way for the AS to bind the client
> with the consent that has already been given? As I understand, the AS does
> this binding by way of tuple (client_id, authorization code). If we remove
> the authorization code from this tuple there is no way for the AS to know
> that authorization was given to which client, as client_id is common for a
> large number of instances of the same client application.
>
> 2. As we discuss, the WG may also consider including an additional claim
> called "duration_of_consent". The user while giving the consent can have
> the option to choose the duration for which the consent has been given.
> This will be in line with the privacy requirements all over the world.
> Also, it will give a definite time period after which the consent
> automatically expires. It will also improve the overall security of the
> protocol.
>
> Kind Regards
> Jaimandeep Singh
>
>
> On Wed, Aug 24, 2022 at 8:23 PM Torsten Lodderstedt <torsten=
> 40lodderstedt.net@dmarc.ietf.org> wrote:
>
>> Hi,
>>
>> the consent is not bound to the code. As you correctly pointed out, the
>> code is a temporary artifact. It’s purpose is to bridge insecure
>> frontchannel communication to more secure backchannel communication. You
>> don’t need to preserve the code in order to preserve the consent. The code
>> is merely intended to be a reference to the consent (or grant). So even if
>> the code expires, the consent can be preserved and updated in the AS. In
>> the simplest case, it is transferred to the refresh token. In more
>> sophisticated implementations, the consent is a first class object in the
>> AS.
>>
>> best regards,
>> Torsten.
>>
>> Am 19.08.2022 um 16:23 schrieb Jaimandeep Singh <
>> jaimandeep.phdcs21=40nfsu.ac.in@dmarc.ietf.org>:
>>
>> Hi Karsten,
>>
>> Thx a lot for all the time and effort in explaining the things. This
>> brings up an important discussion point as we are revising OAuth 2.0. Do we
>> need to make the authorization code a temporary token? Section 1.3.1 of the
>> draft RFC states:
>>
>>> An authorization code is a temporary credential used to obtain an access
>>> token.
>>
>> Here, I am only considering the case of human interaction where it is
>> necessary to take the consent of the human (resource owner) before granting
>> access to his protected resources. As I have already mentioned in the trail
>> mail, OAuth is a two step process: Step 1: Take consent from the user. Step
>> 2: Handover that consent to the third party to access resources on the
>> user's behalf.
>>
>> Now, if we make authorization code a temporary artifact, we will never be
>> able to go back to the previous step and will have to per-force start the
>> process again. Now, with RFC 8705 client applications can be identified
>> with the private key, which are also of rotating nature. We also have DPoP
>> and certificate thumbprints coming up. Then, how wise it is to discard this
>> important token and start all over again.
>>
>> So, my recommendation is not to make the authorization code temporary
>> especially when used with DPoP and thumbprint cnf. This will reduce the
>> headache of asking the consent from a human user because the refresh token
>> expired.
>>
>> For kind consideration of the members please.
>>
>> Regards and Best Wishes
>> Jaimandeep Singh
>>
>> On Fri, Aug 19, 2022 at 7:07 PM Karsten Meyer zu Selhausen <
>> karsten.meyerzuselhausen@hackmanit.de> wrote:
>>
>>> Hi Jaimandeep,
>>>
>>> I disagree with both of your points. See my comments inline.
>>>
>>> Best regards,
>>> Karsten
>>> On 12.08.2022 05:40, Jaimandeep Singh wrote:
>>>
>>> Hi Mikheil,
>>> 1. Well explained by Brain. I will just add my perspective.
>>>
>>>> >From the practical perspective, if the confidential client got a
>>>> refresh
>>>> token for the offline access and sufficient time (e.g., for a month),
>>>> this
>>>> would be quite impractical and not very user-friendly to ask a lot of
>>>> users
>>>> to give consents again when the confidential client wants to upgrade its
>>>> certificate. But seems like software vendors did not interpret the RFC
>>>> that
>>>> way.
>>>>
>>> For confidential clients, authorization code flow is recommended. It is
>>> a two step process. In the first step you get the authorization code when
>>> the user provides his/her consent. In the second step you use this
>>> authorization code along with client credentials to obtain access tokens
>>> and refresh tokens. If the refresh token expires either due to expiry of
>>> its lifetime or certificate, it only needs to follow step two. So, the
>>> question of asking for consent again does not arise unless the
>>> authorization code itself has limited lifespan.
>>>
>>> IMHO authorization codes should always be implemented as one-time-use
>>> tokens. Even when there is a grace period allowing a client to redeem a
>>> code a second time (e.g., in case of network failure) this period should be
>>> very short - much shorter than the validity of refresh tokens in practice.
>>>
>>> If the refresh token is expired, the client should start a new
>>> authorization flow and ask the user for consent again unless the AS
>>> provides a way for users to grant access for clients "permanently".
>>>
>>>
>>> 2.
>>>
>>>> While RFC 8705 indeed requires binding refresh token to the certificate
>>>> in
>>>> case of the public clients in Section 4 and Section 7.1
>>>
>>> The RFC 8705 talks about public clients and refresh tokens in the same
>>> breath and seems to have legitimized the use of refresh tokens for public
>>> clients. However, if we look at the original OAuth 2.0 specifications RFC
>>> 6749, Section 4.2, talks about implicit grant optimized for public clients.
>>> It does not support issuing refresh tokens by AS in the first place. I
>>> think there is a need to deliberate on this issue in the next update /
>>> errata  for RFC 8705.
>>>
>>> RFC 6749 is much older than RFC 8705. Both drafts "OAuth 2.0 Security
>>> Best Current Practice" (hopefully soon to be finished) and OAuth 2.1
>>> deprecate issuing access tokens from the authorization endpoint (which is
>>> more or less the implicit grant). Today's best practice is to use the
>>> authorization code grant for both confidential and public clients.
>>> Therefore, I do not think there is a need for an updated RFC replacing 8705.
>>>
>>>
>>>
>>> Regards and Best Wishes
>>> Jaimandeep Singh
>>>
>>>
>>> On Thu, Aug 11, 2022 at 11:46 PM <mikheil@association.ge> wrote:
>>>
>>>> Hi Brian,
>>>>
>>>> Thanks for the prompt response. We will work with our vendors to get
>>>> this done according to the RFC.
>>>>
>>>> Best Regards,
>>>> Mikheil Kapanadze
>>>>
>>>> From: Brian Campbell <bcampbell@pingidentity.com>
>>>> Sent: ხუთშაბათი, 11 აგვისტო, 2022 21:04
>>>> To: mikheil@association.ge
>>>> Cc: oauth@ietf.org
>>>> Subject: Re: [OAUTH-WG] Certificate-bound refresh tokens and
>>>> certificate expiration handling in case of the confidential clients
>>>>
>>>> Hi Mikheil,
>>>>
>>>> Your assumption is the correct reading of the RFC. Or the intent of the
>>>> RFC anyway. For confidential clients, refresh tokens are bound to the
>>>> client id (not the certificate thumbprint or anything else for that matter).
>>>>
>>>> RFCs can't be changed after publication so adding more clarification
>>>> isn't really possible.
>>>>
>>>>
>>>>
>>>> On Thu, Aug 11, 2022 at 9:11 AM <mailto:mikheil@association.ge> wrote:
>>>> Hi,
>>>>
>>>> I have noticed is that some OAuth2 AS implementations use certificate
>>>> thumbprints to bind not only access tokens but also refresh tokens to
>>>> client
>>>> certificates. This happens for both public and confidential clients. As
>>>> a
>>>> result, when the certificate is replaced (e.g., it is about to expire
>>>> soon),
>>>> both access and refresh tokens are drawn unusable.
>>>>
>>>> While RFC 8705 indeed requires binding refresh token to the certificate
>>>> in
>>>> case of the public clients in Section 4 and Section 7.1, the wording is
>>>> not
>>>> that explicit for the confidential clients. More specifically, Section
>>>> 7.1
>>>> of the RFC 8705 is worded in a way which does not explicitly deny
>>>> keeping
>>>> refresh tokens alive after certificate change: it talks about binding to
>>>> client ID, thus binding "indirectly" to the certificate. Also, Section
>>>> 6.3
>>>> requires access tokens to be invalidated after certificate change and
>>>> mentions refresh tokens as typical tools for renewing them.
>>>>
>>>> >From the practical perspective, if the confidential client got a
>>>> refresh
>>>> token for the offline access and sufficient time (e.g., for a month),
>>>> this
>>>> would be quite impractical and not very user-friendly to ask a lot of
>>>> users
>>>> to give consents again when the confidential client wants to upgrade its
>>>> certificate. But seems like software vendors did not interpret the RFC
>>>> that
>>>> way.
>>>>
>>>> So, the questions:
>>>> 1) Is my assumption correct and it will not be a violation of the RFC if
>>>> refresh tokens issued to the confidential clients survive certificate
>>>> change
>>>> (e.g., by binding them to Client ID, not the certificate thumbprint)?
>>>> 2) If the answer on the 1st question is “yes”, would it be better to
>>>> provide
>>>> more clarification in the section 7.1 to avoid misinterpretations in the
>>>> future?
>>>>
>>>> Best Regards,
>>>> Mikheil Kapanadze
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> OAuth mailing list
>>>> mailto:OAuth@ietf.org
>>>> https://www.ietf.org/mailman/listinfo/oauth
>>>>
>>>> CONFIDENTIALITY NOTICE: This email may contain confidential and
>>>> privileged material for the sole use of the intended recipient(s). Any
>>>> review, use, distribution or disclosure by others is strictly prohibited.
>>>> If you have received this communication in error, please notify the sender
>>>> immediately by e-mail and delete the message and any file attachments from
>>>> your computer. Thank you.
>>>>
>>>> _______________________________________________
>>>> OAuth mailing list
>>>> OAuth@ietf.org
>>>> https://www.ietf.org/mailman/listinfo/oauth
>>>
>>>
>>> --
>>> Regards and Best Wishes
>>> Jaimandeep Singh
>>> LinkedIn <http://www.linkedin.com/in/jaimandeep-singh-07834b1b7>
>>>
>>> _______________________________________________
>>> OAuth mailing listOAuth@ietf.orghttps://www.ietf.org/mailman/listinfo/oauth
>>>
>>> --
>>> Karsten Meyer zu Selhausen
>>> Senior IT Security Consultant
>>> Phone:	+49 (0)234 / 54456499
>>> Web:	https://hackmanit.de | IT Security Consulting, Penetration Testing, Security Training
>>>
>>> Is your OAuth or OpenID Connect application vulnerable to mix-up attacks? Find out more on our blog:https://www.hackmanit.de/en/blog-en/132-how-to-protect-your-oauth-client-against-mix-up-attacks
>>>
>>> Hackmanit GmbHUniversitätsstraße 60 <https://www.google.com/maps/search/Universit%C3%A4tsstra%C3%9Fe+60?entry=gmail&source=g> (Exzenterhaus)
>>> 44789 Bochum
>>>
>>> Registergericht: Amtsgericht Bochum, HRB 14896
>>> Geschäftsführer: Prof. Dr. Jörg Schwenk, Prof. Dr. Juraj Somorovsky, Dr. Christian Mainka, Prof. Dr. Marcus Niemietz
>>>
>>>
>>
>> --
>> Regards and Best Wishes
>> Jaimandeep Singh
>> LinkedIn <http://www.linkedin.com/in/jaimandeep-singh-07834b1b7>
>> _______________________________________________
>> OAuth mailing list
>> OAuth@ietf.org
>> https://www.ietf.org/mailman/listinfo/oauth
>>
>>
>>
>
> --
> Regards and Best Wishes
> Jaimandeep Singh
> LinkedIn <http://www.linkedin.com/in/jaimandeep-singh-07834b1b7>
>
-- 
---
Aaron Parecki
https://aaronparecki.com