Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-82838

MFA Token can easily be accidentally resubmitted

XMLWordPrintable

    • MOODLE_403_STABLE, MOODLE_404_STABLE, MOODLE_405_STABLE
    • MOODLE_404_STABLE, MOODLE_405_STABLE
    • MDL-82838-403
    • MDL-82838-404
    • MDL-82838-main
    • Hide

      Setup

      More detailed setup instructions for MFA testing can be found in MDL-78509, the following setup are just the basics and there is some assumed knowledge.

      1. Apply the patch
      2. Log into the site as an admin
      3. Navigate to: Site administration > plugins > administration tools > Multi-factor authentication
      4. In the factor table enable the factor "Authenticator app". The factor defaults can be left as they are:
      5. Scroll down to "General MFA Settings"
      6. Enable the "MFA plugin enabled" Checkbox
      7. Click save changes
      8. While still logged in as an admin, click on the users profile picture from the top nav bar.
      9. Click "preferences"
      10. Under "User account" click on "Multi-factor authentication"
      11. Click "Setup App" and follow the instructions to set up your TOTP authenticator app factor
      12. Log out the administrator user

      Tests

      1. Enter the username and password and click login for the admin user you set up the factors for
      2. Enter an incorrect TOTP token and
      3. Confirm that the token input field becomes readonly (grey) and the "Continue"-button disabled, before the page quickly reloads (although this might be hard to spot on local instances because of the low latency)
      4. After the page has loaded again, click on the token input field, press the arrow keys, the escape key and Ctrl+A and
      5. Confirm that the key presses did not cause a failed attempt, so you still have for example 9 attempts left

       

      The attempt counter can be reset by inputting a valid authentication token from your TOTP app and logging out and in again.

       

      NOTE: If you mess things up and locked yourself out, you can disable the whole MFA plugin from the CLI:

      php admin/cli/cfg.php --component=tool_mfa --name=enabled --set=0

       

      Show
      Setup More detailed setup instructions for MFA testing can be found in MDL-78509 , the following setup are just the basics and there is some assumed knowledge. Apply the patch Log into the site as an admin Navigate to: Site administration > plugins > administration tools > Multi-factor authentication In the factor table enable the factor "Authenticator app". The factor defaults can be left as they are: Scroll down to "General MFA Settings" Enable the "MFA plugin enabled" Checkbox Click save changes While still logged in as an admin, click on the users profile picture from the top nav bar. Click "preferences" Under "User account" click on "Multi-factor authentication" Click "Setup App" and follow the instructions to set up your TOTP authenticator app factor Log out the administrator user Tests Enter the username and password and click login for the admin user you set up the factors for Enter an incorrect TOTP token and Confirm that the token input field becomes readonly (grey) and the "Continue"-button disabled, before the page quickly reloads (although this might be hard to spot on local instances because of the low latency) After the page has loaded again, click on the token input field, press the arrow keys, the escape key and Ctrl+A and Confirm that the key presses did not cause a failed attempt, so you still have for example 9 attempts left   The attempt counter can be reset by inputting a valid authentication token from your TOTP app and logging out and in again.   NOTE : If you mess things up and locked yourself out, you can disable the whole MFA plugin from the CLI : php admin/cli/cfg.php --component=tool_mfa --name=enabled --set=0  

      Currently when pressing enter (or pretty much any key except backspace) after entering a MFA token, the form will be resubmitted. If the token was invalid, this leads to two failed attempts, or even more if more keys were pressed afterwards. If the token was valid, it might happen that the first form submission gets accepted, but then the form gets resubmitted, and the user get displayed an error, because they used an token twice.

      After inputting an invalid token, that invalid token is displayed again, and when clicking into the token field pressing for example Ctrl+A, or the arrow keys, the form is submitted again, which leads to a failed attempt (or even two in the case of Ctrl+A).

      Obviously, the field should not submit on those keypresses, and it also should not submit multiple times

        1. (1) 3 Passed -- (Main)MDL-82838.png
          169 kB
          Kim Jared Lucas
        2. (1) 5 Passed -- (Main)MDL-82838.png
          202 kB
          Kim Jared Lucas

            justusdieckmann Justus Dieckmann
            justusdieckmann Justus Dieckmann
            Stevani Andolo Stevani Andolo
            Jun Pataleta Jun Pataleta
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 21 minutes
                1h 21m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.