Disallow viewing recovery codes after first display

Created on 8 November 2022, over 2 years ago
Updated 28 June 2023, about 2 years ago

Problem/Motivation

As far as I can tell whenever I've seen TFA/MFA paired with recovery codes, its quite evident recovery codes are only shown for one page load.

After which they are never visible to any party and can only be used programmatically to restore access.

Users typically can completely regenerate recovery codes.

Proposed resolution

Never show recovery codes, or
Add configuration to opt in to allowing recovery codes to be shown so long as currentUser is the same as the recovery code user.

Remaining tasks

Decide on approach

User interface changes

Recovery codes are not visible.

User can only regenerate recovery codes.

API changes

Form/controller changes
Optionally config/schema/upgrade path depending on approach.

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia dpi Perth, Australia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡΅πŸ‡ΉPortugal jcnventura

    I still think that the default being TRUE would be easier for us maintainers, but I don't truly care about that. The one thing should be that the update hook for existing installations should leave it as TRUE, so as to not suddenly change running sites. However, the release that contains this should warn site admins to change the setting, in order to have better security.

  • πŸ‡ΊπŸ‡ΈUnited States cmlara

    It is worth considering SA-CONTRIB-2025-085 would not have been possible if the codes were hashed using only a 1-way algorithm.

    It is worth referencing NIST-800-63b rev3 section 5.1.2.2

    Verifiers SHALL store look-up secrets in a form that is resistant to offline attacks. Look-up secrets having at least 112 bits of entropy SHALL be hashed with an approved one-way function as described in Section 5.1.1.2. Look-up secrets with fewer than 112 bits of entropy SHALL be salted and hashed using a suitable one-way key derivation function, also described in Section 5.1.1.2. The salt value SHALL be at least 32 in bits in length and arbitrarily chosen so as to minimize salt value collisions among stored hashes. Both the salt value and the resulting hash SHALL be stored for each look-up
    (The draft of version 4 is even more strict and calls for a password hashing algorithm for those codes less than 112bit’s entropy)

    Given above I would suggest v2 implement this request as mandatory for v2 with non reversible storage of recovery codes.

Production build 0.71.5 2024