Description
The Cognito user pool default for mfa_configuration is OFF. For local password sign-ins, choose ON to require MFA or OPTIONAL to let users enroll voluntarily.
Potential impact
An unenrolled user with optional MFA can still sign in with a password alone.
Remediation
For optional MFA, provide an enrollment flow in your app. Test sign-in with and without enrollment and test recovery after device loss. Supply a delivery role and permissions for SMS. Check an external IdP’s MFA settings separately for federated users.
Examples
The excerpts omit the required pool name and the SMS role referenced by the first configuration.
Before
resource "aws_cognito_user_pool" "example" {
mfa_configuration = "OFF"
sms_authentication_message = "Your code is {####}"
sms_configuration {
external_id = "example"
sns_caller_arn = aws_iam_role.example.arn
}
software_token_mfa_configuration {
enabled = true
}
}
After
resource "aws_cognito_user_pool" "example" {
mfa_configuration = "OPTIONAL"
sms_authentication_message = "Your code is {####}"
software_token_mfa_configuration {
enabled = true
}
}
The first configuration lists MFA methods but sets OFF. The second enables optional authenticator codes for users who enroll.