Password policies for Cognito user pools should have strong configurations
Checks that a Cognito user pool's password policy requires at least 8 characters, an uppercase letter, a lowercase letter, a number and a symbol, and expires temporary passwords within 7 days, the baseline of AWS's control. Weak passwords leave users' credentials open to guessing, especially in internet-facing applications.
- service
- Cognito
- severity
- Medium
- scope
- evaluated in every region
How to fix it
In the console
Amazon Cognito → User pools → the pool → Authentication methods → Password policy
- Password policy mode
- Custom
- Password minimum length
- 8 or more
- Password requirements
- All four: numbers, special characters, uppercase letters and lowercase letters
- Temporary passwords set by administrators expire in
- 7 days or fewer
With the AWS CLI
- Overwrites existing settings: update-user-pool resets every setting it is not given to its default, including the sign-in policy beside the password policy, so read the pool with describe-user-pool and resupply the rest.
aws cognito-idp update-user-pool --user-pool-id <user-pool-id> --policies 'PasswordPolicy={MinimumLength=8,RequireUppercase=true,RequireLowercase=true,RequireNumbers=true,RequireSymbols=true,TemporaryPasswordValidityDays=7}' --region <region>With Terraform
resource "aws_cognito_user_pool" "this" {
name = var.user_pool_name
password_policy {
minimum_length = 8
require_uppercase = true
require_lowercase = true
require_numbers = true
require_symbols = true
temporary_password_validity_days = 7
}
}
See which of your accounts this check is failing on.
Book a live scan