Skip to Content
Mengty Learns
Security

Passwords, Hashing, MFA & Rate Limiting

OWASP Password Storage Cheat Sheet parameters for Argon2id/bcrypt/scrypt, NIST SP 800-63B password rules, MFA choices, and rate limiting vs account lockout.

referencebeginnerTested with asvs 5.0.0 (V6), nist SP 800-63BUpdated Nov 26, 2026

TL;DR

Hash passwords with Argon2id (minimum 19 MiB memory, 2 iterations, parallelism 1 per OWASP), follow NIST SP 800-63B (long passphrases, breached-password checks, no forced rotation or symbol rules), pair with phishing-resistant MFA (WebAuthn/FIDO2), and use rate limiting + progressive backoff instead of permanent account lockouts.

Why it exists

Fast hashes like SHA-256 can be brute-forced at billions of guesses per second on a single GPU. Meanwhile, legacy password policies ("8 chars, 1 uppercase, 1 symbol, change every 90 days") push users toward predictable passwords like Spring2026! while doing nothing against credential stuffing.

Password hashing parameters (OWASP Cheat Sheet)

Use a memory-hard or work-factor-tuned Password-Based Key Derivation Function with a unique per-user cryptographic salt (handled automatically by standard libraries):

AlgorithmWhen to useOWASP minimum baselineKey caveat
Argon2idFirst choice for all new systemsm = 19 MiB (19,456 KiB), t = 2, p = 1 (or 46 MiB, t=1, p=1)Tune memory/iterations to target ~100–300 ms on your server.
scryptLegacy systems without Argon2idN = 2^17 (131,072), r = 8, p = 1High RAM usage (~128 MiB at 2^17); watch memory limits under concurrency.
bcryptLegacy systems where Argon2id/scrypt are unavailableWork factor (cost) ≥ 10 (higher if latency allows)Truncates at 72 bytes; not memory-hard against modern ASICs/FPGAs.
SHA-256 / MD5Never for passwords—Unsalted/fast hashes crack orders of magnitude faster.
// UNSAFE: fast general-purpose hash with no memory hardness
import { createHash } from 'node:crypto';
const unsafeHash = createHash('sha256').update(password).digest('hex');

// SAFE: Argon2id with OWASP minimum baseline (not run — requires argon2 package)
import argon2 from 'argon2';
const safeHash = await argon2.hash(password, {
  type: argon2.argon2id,
  memoryCost: 19456, // 19 MiB in KiB
  timeCost: 2,
  parallelism: 1,
});

NIST SP 800-63B password rules

  • Length over complexity: Require at least 8 characters with MFA, or 15 characters when password-only; allow at least 64 characters (and spaces/Unicode) so passphrases work.
  • No arbitrary composition rules: Do not force "1 uppercase + 1 number + 1 symbol".
  • Check against breached passwords: Reject passwords found in known breach corpuses (for example via k-anonymity range queries or local bloom filters) and common dictionary lists.
  • No forced periodic rotation: Only require a reset when there is evidence of compromise.

MFA hierarchy & lockout vs rate limiting

  • MFA strength: Prefer FIDO2/WebAuthn passkeys or security keys (phishing-resistant, origin-bound) over TOTP authenticator apps, and avoid SMS as a primary second factor (SIM-swapping risk).
  • Rate limiting vs lockout: Hard-locking an account after N failed logins lets anyone DoS your users. Instead, rate-limit by IP + account identifier, add exponential backoff, require MFA/CAPTCHA challenges only on suspicious spikes, and log failures for alerting (ASVS V16).

Gotchas

  • Bcrypt's 72-byte limit: A 75-character passphrase and a 72-character prefix produce the same bcrypt hash.
  • Memory exhaustion on /login: Setting Argon2id to 256 MiB with 50 concurrent logins needs 12.8 GB RAM; benchmark and bound login concurrency.
  • User enumeration on login/reset: Return generic messages ("Invalid credentials" / "If that email exists, a reset link was sent") and keep response timing consistent.

Production checklist

  • Passwords are hashed with Argon2id (m >= 19456 KiB, t >= 2, p >= 1), benchmarked on production hardware.
  • Passwords are checked against a breached-password blocklist on registration and password change.
  • Maximum password length is at least 64 characters with no arbitrary symbol-mixing rules or 90-day expiry.
  • Phishing-resistant MFA (WebAuthn/passkeys) or TOTP is offered, with single-use recovery codes.
  • Login and password-reset endpoints enforce rate limiting and backoff rather than permanent account lockout.

Check yourself

Check Yourself

1. Which password hashing configuration meets the OWASP Password Storage Cheat Sheet minimum baseline for Argon2id?

2. Under NIST SP 800-63B, when should a system force a user to change their password?

Sources