Re: [OAUTH-WG] Implementation questions around refresh token rotation

Dave Tonge <dave.tonge@momentumft.co.uk> Mon, 12 October 2020 04:43 UTC

Return-Path: <dave.tonge@moneyhub.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 26AF73A0C45 for <oauth@ietfa.amsl.com>; Sun, 11 Oct 2020 21:43:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.749
X-Spam-Level:
X-Spam-Status: No, score=-1.749 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.249, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=momentumft.co.uk
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 5xfRjrNilbJN for <oauth@ietfa.amsl.com>; Sun, 11 Oct 2020 21:43:43 -0700 (PDT)
Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (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 61C513A0C43 for <oauth@ietf.org>; Sun, 11 Oct 2020 21:43:43 -0700 (PDT)
Received: by mail-ej1-x62a.google.com with SMTP id p15so21297743ejm.7 for <oauth@ietf.org>; Sun, 11 Oct 2020 21:43:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=momentumft.co.uk; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Q+bQC2VJmNc7JeWM924e8btFjRY63Fwpv6FAgIL+c50=; b=WaFo6zLMGyyDWlN/vw2cjT9tBslQ4//9AlelaUMv5H975hcAB7orbBh5E8hlRb7ddk OH++BUXuH4eDpM3ZGQOuB4GxUwlEmdPJ/4Oj3CL6N6cWnG8N4p1vY4l96IDSUz26OAiy W0x1H8YCxcLNIPXUenkvrzc1us1fUNOFvq++g=
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=Q+bQC2VJmNc7JeWM924e8btFjRY63Fwpv6FAgIL+c50=; b=ujfhNnJSCKFS4Tq3UditVXVK4LUA4E/zFHld2djonMjgQWNBKqFVPfZ+Z2a1RNWYEu HMhWDjiUtAJfxqLFAO+v8CRjPo5Iw/E2rewLUywsKQiaoFLrZ/Rwah83WhaHmJDeVU71 WWg8Z8CPOBGZuuMWErFXDVdyFNwTd5La8wmCBRdLSOTAMOWLZzvVTB+XZg57e+onvU4R JFSiS3iHE9/zwFnuE3HV8BZTfJZdwMSQv2j1QVdtwK/frWjJT5e0oZ/pNDiMuXKfK13v ugcJ9gp8PmD/fZ9djmoghnaiK3KyYB87VLwChrIfjfzxOUUoU2SZSNUV5OSdfCVGdWxt N1wg==
X-Gm-Message-State: AOAM531083kh7Pad0vkIcN+xoUvxW3vUuqgEW/gjEqRvk9uDfMTAVSpa /XiiFxalNyybCid4PkMhFM4T4FVpKN5IdmLKEY9Zre0qSau90Qcy3Q+QGWv18mAFs2PC644QoQ1 dU/WLowonrfWNWFSXP3l3x4utWaw=
X-Google-Smtp-Source: ABdhPJyM6na3l6RcnE3t8MmF2nk4110YWsxXl/eOd0l9+rUNbObrzGIlAuLSOH5b/kxcD5xgv+VUu8T3BFdrO1jVMB4=
X-Received: by 2002:a17:906:2709:: with SMTP id z9mr4343408ejc.277.1602477821654; Sun, 11 Oct 2020 21:43:41 -0700 (PDT)
MIME-Version: 1.0
References: <CAGBSGjqFV9miQLJu4nZZcHy6vpnVcSA5FQdOBtKAQ1UCu8p6Jg@mail.gmail.com> <067801d69c30$02119bc0$0634d340$@auth0.com> <CAKhDPzNPTRwf563=wAMZT0Fcw6z5zWb2Om9Gp6C0LpSFkRZTvg@mail.gmail.com>
In-Reply-To: <CAKhDPzNPTRwf563=wAMZT0Fcw6z5zWb2Om9Gp6C0LpSFkRZTvg@mail.gmail.com>
From: Dave Tonge <dave.tonge@momentumft.co.uk>
Date: Mon, 12 Oct 2020 06:43:30 +0200
Message-ID: <CAP-T6TQD=SNZVjub4Ot54-Rp=v5szy=M=8xabx-y+tbMRJ0+bg@mail.gmail.com>
To: Jeff Craig <jeffcraig=40google.com@dmarc.ietf.org>
Cc: vittorio.bertocci=40auth0.com@dmarc.ietf.org, OAuth WG <oauth@ietf.org>
Content-Type: multipart/alternative; boundary="000000000000520f8305b171f14c"
Archived-At: <https://mailarchive.ietf.org/arch/msg/oauth/xbchYpqHQhbXs0uqKGpEEF3tvsk>
Subject: Re: [OAUTH-WG] Implementation questions around refresh token rotation
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, 12 Oct 2020 04:43:46 -0000

> Our goal is to prevent cases where we lose the ability to Refresh a Token
due to transient issues (which have run the gamut from network problems to
bad software updates on the AS side).

We've seen this issue quite a bit and it's very frustrating. I would
suggest that refresh token rotation is not used for confidential clients
that authenticate with private_key_jwt or tls_client_auth.

On Wed, 7 Oct 2020 at 00:57, Jeff Craig <jeffcraig=
40google.com@dmarc.ietf.org> wrote:

> My experience is more from the Client side of the equation on this
> problem, but I do have some thoughts. Our goal is to prevent cases where we
> lose the ability to Refresh a Token due to transient issues (which have run
> the gamut from network problems to bad software updates on the AS side).
> Our use case also does all token handling server-side, so our threat model
> is not the same as the mobile application you described. There is a clear
> tradeoff in reducing user friction with additional authorization events,
> and securing access.
>
> The recommendation my team typically gives people building Authorization
> Servers with Refresh Token Rotation is to keep the old refresh token until
> they see the new one (which means that there are generally two refresh
> tokens valid at any point in time, an unfortunate trade-off). A more
> difficult, but potentially plausible implementation would be to hold onto
> the older Refresh Token until the newly issued Access Token is used (thus
> implying the refresh was successful on both sides).
>
> We aren't trying to protect against multiple in-flight refreshes though
> (we've done a LOT of work to attempt to remove that possibility in a
> globally consistent manner), we're trying to protect against a network
> interruption that prevents the first use of R1, so our assumption is that
> R2.1 was completely lost, and only R2.2 matters moving forward. Meaning: R1
> is sent, A/R2.1 is dropped in flight, R1 is sent again, A/R2.2 is returned
> and stored. Since R1 was seen a second time, we recommend that R2.1 be
> ignored in future. Next refresh will use R2.2, at which point R1 should
> never be seen again.
>
> The biggest issue that I see with a time-based grace period is that for
> many offline tasks, a single refresh failure may be ignored by the client,
> and it could be hours before the second refresh attempt using the older
> refresh token is made (depending on time of day and what these requests are
> being used for), making the grace period low value in that case.
>
> On Tue, Oct 6, 2020 at 5:28 PM <vittorio.bertocci=
> 40auth0.com@dmarc.ietf.org> wrote:
>
>> Hey Aaron,
>>
>> Auth0 does offer a configurable grace period, during which the
>> “preceding” token can be reused.
>>
>> I am not 100% sure what we do in the exact scenario you described, and I
>> will double check for you, but here’s my intuition.
>>
>>
>>
>> The operation redeem(RT_n) should result in AT, RT_n+1. The grace period
>> just extends the time in which the operation can occur, but every operation
>> should be idempotent. All repeats of that operation within the grace period
>> should have the same result, which means that every resulting RT is a
>> representative of the RT_n+1 class, hence all valid at the same time. After
>> the grace period elapses, RT_n is invalid, and that’s it.
>>
>> So, in your example I would consider RT1.1 and RT1.2 as equivalent, as
>> they are both representatives of the RT_n+1 equivalence class.
>>
>>
>>
>> It would be very hard to do otherwise, given that network operations
>> aren’t guaranteed to be concluded in the order they were executed without
>> semaphores, and above all the network failures the grace period is designed
>> to handle can apply to any of the requests, regardless of the order.
>>
>>
>>
>> *From:* OAuth <oauth-bounces@ietf.org> *On Behalf Of *Aaron Parecki
>> *Sent:* Tuesday, October 6, 2020 3:06 PM
>> *To:* OAuth WG <oauth@ietf.org>
>> *Subject:* [OAUTH-WG] Implementation questions around refresh token
>> rotation
>>
>>
>>
>> Hi all, I have a couple questions for those of you who have implemented
>> refresh token rotation...
>>
>>
>>
>> Have you included the option of a grace period on refresh token use,
>> allowing multiple uses within some time window? I'm wondering because a
>> grace period where a refresh token may be used more than once would work
>> around the problem that has been brought up, of a mobile app accidentally
>> using a refresh token more than once during normal operation because
>> different threads are unable to coordinate between themselves. However that
>> also kind of defeats the purpose since attacks within that grace period
>> would be hard to detect. I'm looking for an idea of where people have
>> landed on that issue in practice.
>>
>>
>>
>> If you have implemented a grace period, then how do you handle expiring
>> the additional refresh tokens that have been granted? For example, if RT
>> "R1" is used twice, resulting in new ATs "A1.1", "A1.2" and new RTs "R1.1"
>> and "R1.2", what happens if "R1.2" is then later used? Would you invalidate
>> "R1.1" at that point? If so, why, and if not, why not?
>>
>>
>>
>> It would be most interesting to hear practical experience from people who
>> have already built refresh token rotation into a system.
>>
>>
>>
>> Thanks!
>>
>>
>> ---
>>
>> Aaron Parecki
>>
>> https://aaronparecki.com
>>
>>
>> _______________________________________________
>> OAuth mailing list
>> OAuth@ietf.org
>> https://www.ietf.org/mailman/listinfo/oauth
>>
> _______________________________________________
> OAuth mailing list
> OAuth@ietf.org
> https://www.ietf.org/mailman/listinfo/oauth
>


-- 
Dave Tonge

-- 


Moneyhub Enterprise is a trading style of Moneyhub Financial Technology 
Limited which is authorised and regulated by the Financial Conduct 
Authority ("FCA"). Moneyhub Financial Technology is entered on the 
Financial Services Register (FRN 809360) at https://register.fca.org.uk/ 
<https://register.fca.org.uk/>. Moneyhub Financial Technology is registered 
in England & Wales, company registration number 06909772. Moneyhub 
Financial Technology Limited 2020 © Moneyhub Enterprise, Regus Building, 
Temple Quay, 1 Friary, Bristol, BS1 6EA. 

DISCLAIMER: This email 
(including any attachments) is subject to copyright, and the information in 
it is confidential. Use of this email or of any information in it other 
than by the addressee is unauthorised and unlawful. Whilst reasonable 
efforts are made to ensure that any attachments are virus-free, it is the 
recipient's sole responsibility to scan all attachments for viruses. All 
calls and emails to and from this company may be monitored and recorded for 
legitimate purposes relating to this company's business. Any opinions 
expressed in this email (or in any attachments) are those of the author and 
do not necessarily represent the opinions of Moneyhub Financial Technology 
Limited or of any other group company.