AWS Cognito
User Pool
Bruteforce Protection
Cybersecurity
Authentication

AWS Cognito brute force protection: lockout, MFA and password policy

Codemia Knowledge Hub ·

An Amazon Cognito user pool defends against brute-force password guessing mainly with a built-in account lockout: after five failed sign-in attempts the user is locked out, and the lockout grows with each further failure. On top of that you can require multi-factor authentication (MFA), enforce a strong password policy and use anomaly detection to challenge suspicious sign-ins.

Account lockout after failed sign-ins

After five failed sign-in attempts with a user's password, Cognito locks that user out for one second. The lockout then doubles with each additional failed attempt, up to a maximum of about 15 minutes. This makes rapid password guessing against one account impractical.

  • Fixed behavior: the threshold and durations are set by Cognito, not configured per user pool, and AWS notes that the behavior is subject to change.
  • Temporary, not permanent: users can try again once the lockout period ends, so a lockout does not permanently block legitimate users.
  • Reset: the counter resets when the user signs in successfully after a lockout expires, or makes no sign-in attempts for 15 consecutive minutes.

Throttling of authentication requests

Cognito also limits how quickly authentication requests can be made, which slows attempts that come from a single source. Combined with the doubling lockout, each consecutive failure makes the next guess wait longer.

Multi-factor authentication (MFA)

MFA requires a second form of verification besides the password, so an attacker who guesses the password still needs another factor.

  • Second factor options: Cognito supports SMS one-time passwords (OTPs) and time-based OTPs from authenticator apps.
  • Enforcement: you can configure the user pool to require MFA before users can access their accounts.

Password policies

Strong passwords make guessing much harder, and Cognito lets you customize the password policy.

  • Complexity: require a minimum length and a mix of character types such as letters, numbers and symbols.
  • History: with the Essentials or Plus feature tier, you can prevent users from reusing previous passwords.
  • No expiration: passwords for local users do not expire automatically. To force periodic changes, track password age yourself and require a reset.

Anomaly detection

Cognito can use machine learning to spot sign-in patterns that suggest an attack.

  • Sign-in analysis: models analyze behavior to flag irregular login attempts.
  • Automatic response: when it detects an anomaly, Cognito can require MFA for that session.

Summary of the defenses

Defensive mechanismDescription
Account lockoutLocks the user after five failed attempts, doubling up to about 15 minutes.
Rate limitingLimits authentication attempts to slow rapid attack cycles.
Multi-factor authenticationRequires an additional verification step beyond password entry.
Password policiesEnforces strong password requirements to minimize guessability.
Anomaly detectionUses ML models to detect unusual sign-in activities indicating attacks.

Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design