Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-4915

Last expired OTP token would be considered as still assigned to the user

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • ipa-4.12.2-2.el9
    • None
    • Moderate
    • ZStream
    • 1
    • rhel-idm-ipa
    • ssg_idm
    • 10
    • 12
    • 2
    • QE ack, Dev ack
    • False
    • False
    • Hide

      None

      Show
      None
    • Yes
    • 2024-Q4-Bravo-S3
    • Approved Blocker
    • Bug Fix
    • Hide
      .Bypassing two-factor authentication using an expired token is no longer possible

      Previously, it was possible to bypass two-factor authentication by creating an OTP token with a specific end-validity period.

      In cases where two-factor authentication is enforced, a user without an OTP token could use their password to log in *once* and configure an OTP token. Subsequently, they would be required to use both their password and the OTP token for authentication. However, if a user created an OTP token with an expired end-validity date, IdM would incorrectly fall back to password-only authentication, effectively bypassing two-factor authentication. This was due to IdM not differentiating between non-existent and expired OTP tokens.

      With this update, IdM now correctly differentiates between these scenarios. Consequently, two-factor authentication is now correctly enforced, preventing this bypass.
      Show
      .Bypassing two-factor authentication using an expired token is no longer possible Previously, it was possible to bypass two-factor authentication by creating an OTP token with a specific end-validity period. In cases where two-factor authentication is enforced, a user without an OTP token could use their password to log in *once* and configure an OTP token. Subsequently, they would be required to use both their password and the OTP token for authentication. However, if a user created an OTP token with an expired end-validity date, IdM would incorrectly fall back to password-only authentication, effectively bypassing two-factor authentication. This was due to IdM not differentiating between non-existent and expired OTP tokens. With this update, IdM now correctly differentiates between these scenarios. Consequently, two-factor authentication is now correctly enforced, preventing this bypass.
    • Done
    • None
    • 57,005

      Description of problem:

      The problem is that if a user is forced to use an OTP token, set in the Default User Authentication types in the UI and then selecting "Two factor authentication" and "Disable per-user override" settings, the first time when user doesn't have an OTP token, user can login with a password and generate their own OTP token, and afterwards will always be using OTP, which I think is the logical steps to make a migration from methods of authentication.

      The problem is that the user can make the trick to generate an OTP token with an "end-validity period", and after that the user can enter always only with the password (bypassing all the general configuration of OTP), for example:

      [idmuser01@server ~]$ ipa otptoken-add --not-after=20221107160000Z
      ipa: WARNING: QR code width is greater than that of the output tty. Please resize your terminal.
      ------------------
      Added OTP token ""
      ------------------
      Unique ID: 255c887e-28b4-4d05-9b25-3fdf474a1790
      Type: TOTP
      Owner: idmuser01
      Manager: idmuser01
      Validity end: 20221107160000Z
      Algorithm: sha1
      Digits: 6
      Clock interval: 30

      Before the token expires, always asks for the second factor:

      [root@server2 ~]# ssh -l idmuser01 server.lab.example.net
      (idmuser01@server.lab.example.net) First Factor:
      (idmuser01@server.lab.example.net) Second Factor:
      Last login: Mon Nov 7 15:06:33 2022 from 192.168.1.111
      [idmuser01@server ~]$ exit
      logout
      Connection to server.lab.example.net closed.

      But after the end validity period (set by the same user), only asks for password:

      [root@server2 ~]# ssh -l idmuser01 server.lab.example.net
      (idmuser01@server.lab.example.net) Password:
      Last login: Mon Nov 7 15:25:50 2022 from 192.168.1.111

      Version-Release number of selected component (if applicable):

      How reproducible:

      Always

      Steps to Reproduce:

      As described in the Description of problem section above, after a user makes login with ssh to a server, can add a token with end-validity date, as can be seen in

      [idmuser01@server ~]$ ipa otptoken-add --not-after=20221107160000Z
      ipa: WARNING: QR code width is greater than that of the output tty. Please resize your terminal.
      ------------------
      Added OTP token ""
      ------------------
      Unique ID: 255c887e-28b4-4d05-9b25-3fdf474a1790
      Type: TOTP
      Owner: idmuser01
      Manager: idmuser01
      Validity end: 20221107160000Z
      Algorithm: sha1
      Digits: 6
      Clock interval: 30

      Before the token expires, always asks for the second factor:

      [root@server2 ~]# ssh -l idmuser01 server.lab.example.net
      (idmuser01@server.lab.example.net) First Factor:
      (idmuser01@server.lab.example.net) Second Factor:
      Last login: Mon Nov 7 15:06:33 2022 from 192.168.1.111
      [idmuser01@server ~]$ exit
      logout
      Connection to server.lab.example.net closed.

      But after the end validity period (set by the same user), only asks for password:

      [root@server2 ~]# ssh -l idmuser01 server.lab.example.net
      (idmuser01@server.lab.example.net) Password:
      Last login: Mon Nov 7 15:25:50 2022 from 192.168.1.111

      Actual results:

      OTP token after expiration, fallback to password-only method of authentication

      Expected results:

      Right now, the code cannot diferentiate between "token does not exist" and "no valid token exists" making the fallback to password-only method in either case.

      What is needed is to consider the last expired OTP token to be treated
      as a token still assigned to a user, thus forcing to reject
      password-only authentication, in that case the token is still assigned to the user but cannot use that to make login, and also doesn't fallback to password-only authentication. A user would not be
      able to modify their token information until admin would extend the
      token validity or issue a new token, unless the said user has a valid
      Kerberos ticket. In the latter case the user would be able to modify the
      validity of the token by himself and then be able to login with the token
      but not with the password.

      Use cases:

      • user forced to use OTP:
      • has no token at all: allow password access to add a token
      • has all tokens expired: do not allow password access, let administrator to handle this case. Also if user still has a valid Kerberos ticket can extend the end-validity date of the token created by himself
      • has at least one valid token: do not allow password access

      Additional info:

              rhn-engineering-mareynol Mark Reynolds
              rh-ee-jfont Josep Andreu Font
              Florence Renaud Florence Renaud
              Anuja More Anuja More
              David Vozenilek David Vozenilek
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated:
                Resolved: