Bypassing AAL2 in Settings Flow Using Email OTP fo...
# ory-copilot
h
Bypassing AAL2 in Settings Flow Using Email OTP for Both Factors With the following configuration:
Copy code
selfservice:
  methods:
    code:
      mfa_enabled: true
  flows:
    settings:
      required_aal: highest_available
A user who normally requires MFA to access settings ( has
available_aal = aal2
) can bypass the AAL2 requirement by using email OTP for both factors: 1. Start account recovery → receive an email OTP (recovery code) as the first factor. 2. Authenticate with that email OTP. 3. When prompted for MFA, use another email OTP (mfa email code) as the second factor. 4. Access the settings flow without providing a distinct second factor. Questions • Is this expected behavior in Kratos when
highest_available
is used? • How can we prevent the same factor from being used twice to meet the AAL2 requirement? • Should Kratos enforce a distinct second factor for AAL2? (edited)
f
hi! You have to use @chilly-king-10285 to get an answer from the bot
b
A message from kapa.ai
I apologize, but I'm not sure I understand your question correctly. It seems like you might have intended to include some specific information or instructions, but they're missing from your message. As an AI assistant specialized in answering questions about Ory, I'm here to help with any queries related to Ory's products, services, or documentation. Could you please rephrase your question or provide more details about what you're trying to ask regarding Ory? I'll do my best to assist you based on the information available in the Ory documentation.
h
@chilly-king-10285 Bypassing AAL2 in Settings Flow Using Email OTP for Both Factors With the following configuration:
Copy code
selfservice:
  methods:
    code:
      mfa_enabled: true
  flows:
    settings:
      required_aal: highest_available
A user who normally requires MFA to access settings ( has
available_aal = aal2
) can bypass the AAL2 requirement by using email OTP for both factors: 1. Start account recovery → receive an email OTP (recovery code) as the first factor. 2. Authenticate with that email OTP. 3. When prompted for MFA, use another email OTP (mfa email code) as the second factor. 4. Access the settings flow without providing a distinct second factor. Questions • Is this expected behavior in Kratos when
highest_available
is used? • How can we prevent the same factor from being used twice to meet the AAL2 requirement? • Should Kratos enforce a distinct second factor for AAL2?
b
A message from kapa.ai
Based on the available knowledge sources, here are answers to your questions regarding bypassing AAL2 in the settings flow using email OTP for both factors: --- ### 1. Is this expected behavior in Kratos when
highest_available
is used? According to a [GitHub issue](https://github.com/ory/kratos/issues/4317), this behavior is currently possible in Ory Kratos. The system treats the recovery code (email OTP used for account recovery) and the MFA email code (email OTP used for step-up authentication) as distinct authentication methods, even though both are delivered via email. As a result, a user can satisfy the AAL2 requirement by using two email OTPs, which may not be the intended security posture. > "The system marks these as distinct methods (or factors) and does not treat them as the same factor of authentication." > — [Bypassing AAL2 in Settings Flow Using Email OTP for Both Factors](https://github.com/ory/kratos/issues/4317) --- ### 2. How can we prevent the same factor from being used twice to meet the AAL2 requirement? The knowledge sources do not provide a direct configuration option to prevent this scenario. However, a comment in the referenced issue suggests a possible workaround: require that, if recovery via email is enabled, another backup MFA method (such as lookup codes or TOTP) must also be enforced. This ensures that after account recovery, the user must use a different method for MFA, not just another email OTP. > "One possible fix for this will require that if recovery via email is enabled, some other backup MFA must be enforced (e.g., lookup_code) so the MFA options available after account recovery include something other than technically the same option used to gain aal1." > — [Bypassing AAL2 in Settings Flow Using Email OTP for Both Factors](https://github.com/ory/kratos/issues/4317) --- ### 3. Should Kratos enforce a distinct second factor for AAL2? The knowledge sources do not explicitly state whether Kratos should enforce a distinct second factor for AAL2. However, the issue highlights that, as of now, Kratos does not enforce this distinction when both factors are delivered via the same channel (email OTP). The discussion suggests that enforcing distinct factors would be a desirable security improvement, but this is not currently implemented by default. --- Summary: - The described behavior is possible and currently expected in Kratos with the given configuration. - To prevent it, you should require users to configure a backup MFA method that is distinct from the recovery method. - Kratos does not currently enforce distinct factors for AAL2, but this is recognized as a potential area for improvement. If you need strict enforcement of distinct factors, you may need to implement additional checks or policies outside of Kratos until this is addressed in the product itself. [Bypassing AAL2 in Settings Flow Using Email OTP for Both Factors](https://github.com/ory/kratos/issues/4317)
h
@chilly-king-10285 can you give more solutions for the second point ? (How can we prevent the same factor from being used twice to meet the AAL2 requirement?)
b
A message from kapa.ai
Based on the knowledge sources, there is only one concrete solution mentioned for preventing the same factor (e.g., email OTP) from being used twice to meet the AAL2 requirement: require users to configure and use a backup MFA method that is distinct from the recovery method. For example, if recovery via email is enabled, you should also enforce another MFA method such as TOTP or lookup codes. This ensures that after account recovery, the user must use a different method for MFA, not just another email OTP. > "One possible fix for this will require that if recovery via email is enabled, some other backup MFA must be enforced (e.g., lookup_code) so the MFA options available after account recovery include something other than technically the same option used to gain aal1." > — [Bypassing AAL2 in Settings Flow Using Email OTP for Both Factors](https://github.com/ory/kratos/issues/4317) The knowledge sources do not provide additional solutions or configuration options to address this scenario. There is no mention of a built-in Kratos feature to enforce distinct factors for AAL2 beyond the workaround above. If you require stricter enforcement, you may need to implement custom logic outside of Kratos, but this is not covered in the provided documentation. I'm sorry, but there is no further information in the knowledge sources about other solutions to prevent the same factor from being used twice for AAL2.