Hi all, There was a previous discussion on whether to allow a grace period during refresh token rotation, allowing the client to retry a refresh if the response fails to be received due to some transient network issue/timeout [1]. Vittorio mentioned that Auth0 already implement such a grace period. We (ForgeRock) currently do not, but we do periodically receive requests to support this. The current security BCP draft is silent on whether implementing such a grace period is a good idea, but I think we should add some guidance here one way or another.
My own opinion is that a grace period is not a good idea, and if it is to be supported as an option then it should be kept as short as possible. The reason (as I mentioned in the previous thread) is that it is quite easy for an attacker to observe when a legitimate client performs a refresh flow and so can easily sneak in their own request afterwards within the grace period. There are several reasons why it is easy for an attacker to observe this: - RT rotation is primarily intended for public clients, such as mobile apps and SPAs. These clients are geographically distributed across the internet, and so there is a good chance that the attacker is able to observe the network traffic of at least some of these client instances. - The refresh flow is typically the only request that the client makes directly to the AS after initial authorization, so despite the traffic being encrypted it is very easy for an observer to determine that the client is performing a refresh whenever it makes any connection to the AS. - As well as observing the request itself, an attacker may be able to observe the DNS lookup for the AS hostname instead, which is even more likely to be observable and also in plaintext most of the time. - An attacker in a position to steal RTs from e.g. localStorage, is probably also in a good position to either observe when the legitimate client refreshes or to actually force it to refresh early (e.g., by deleting the corresponding AT from the same storage). I know some people argue that a grace period is a reasonable trade-off between security and usability. But I think that this kind of attack would be quite easy to carry out in practice for the reasons I suggest above, so I think the security actually degrades extremely quickly if you allow a grace period of any reasonable length. On the other hand, if we discourage this entirely then people may use dubious workarounds instead (e.g., one proposal I’ve seen was to use an ID token with the JWT Bearer grant, effectively turning the ID Token into an ad-hoc RT with much fewer protections). As a strawman, what would people think of wording like the following: --- The AS MAY allow the original RT to be replayed for a short grace period to allow the client to recover if the response is not received due to a network problem or other transient issue. However, implementors should be aware that an attacker may be able to easily observe when the legitimate client makes a refresh request to the AS and so time their use of a stolen RT to occur within the grace period. Any grace period MUST be kept as short as possible, and MUST NOT exceed 60 seconds. Clients should prefer sender-constrained refresh tokens if recovery from network issues is a priority. — (The 60 seconds limit here is based on Auth0’s grace period). [1]: https://mailarchive.ietf.org/arch/msg/oauth/WXwKxQM2poW7bqOOGGp4POYolFk/ <https://mailarchive.ietf.org/arch/msg/oauth/WXwKxQM2poW7bqOOGGp4POYolFk/> Kind regards, Neil
_______________________________________________ OAuth mailing list OAuth@ietf.org https://www.ietf.org/mailman/listinfo/oauth