Review IAM password reuse prevention

Set the required password-history depth to prevent reuse when users change passwords.

Description

password_reuse_prevention stops an IAM user from choosing a recent console password again. Check how many previous passwords your policy requires IAM to remember.

Potential impact

A previously exposed password can be selected again once it falls outside the enforced history.

Remediation

Set the history to 1–24 passwords and check the minimum length and character requirements. Use MFA and replace an exposed password immediately.

Examples

Before

hcl
resource "aws_iam_account_password_policy" "example" {
  require_lowercase_characters   = true
  require_numbers                = true
  require_uppercase_characters   = true
  require_symbols                = true
  allow_users_to_change_password = true
  password_reuse_prevention      = 20
}

After

hcl
resource "aws_iam_account_password_policy" "example" {
  minimum_password_length        = 8
  require_lowercase_characters   = true
  require_numbers                = true
  require_uppercase_characters   = true
  require_symbols                = true
  allow_users_to_change_password = true
  password_reuse_prevention      = 24
}

Both configurations prevent reuse. The first covers the last 20 passwords and the second covers 24. The second also explicitly sets the minimum length to 8.

References