Lesson 12 of 14 · 15m
Password Storage in 2025
Argon2id's memory hardness, bcrypt's 72-byte edge, a pepper outside the DB, and NIST 800-63-4's breach-check mandate.
What a stored password should look like
$argon2id$v=19$m=19456,t=2,p=1$<salt>$<hash> — the PHC string format, self-describing: algorithm, version, memory cost, iteration cost, parallelism, salt, hash. Verification is re-derivation with the embedded parameters and constant-time comparison. If your users table doesn't look like this, the rest of this lesson is why it should.
Why fast hashes lose
SHA-256 of password-plus-salt was the 2010 default and it fails on arithmetic: an RTX-class GPU runs billions of SHA-256 candidate hashes per second. The salt does exactly one job — defeat precomputed rainbow tables — and people keep assigning it a second job it can't do: slowing guessing. Per-attempt cost is what stops cracking, and fast hashes have none. Argon2 (RFC 9106, the 2015 Password Hashing Competition winner) adds the dimension GPUs hate: memory. argon2id's m parameter forces tens of megabytes per attempt, which serializes parallel cracking on commodity silicon. OWASP's current floor: m=19456 (19 MiB), t=2, p=1. bcrypt remains acceptable at cost ≥12; scrypt likewise; PBKDF2 needs ≥600,000 iterations of HMAC-SHA256 to matter now.
bcrypt's 72-byte edge
bcrypt silently truncates input at 72 bytes — not errors, truncates. A 200-character passphrase verifies identically to its own first 72 bytes, and two different passwords sharing that prefix collide. The pragmatic fixes: enforce a max length at the form and API layer, or switch to Argon2id where the edge doesn't exist. (Pre-hashing with SHA-256 before bcrypt fixes truncation but introduces hash-shucking attacks when the pre-hash itself is leaked — another reason to just use Argon2id.)
Pepper: the half that isn't in the DB
A pepper is a server-side secret mixed into the hash input and stored outside the database — KMS, HSM, an env var with IAM around it. A DB dump then contains hashes that can't be cracked without also compromising your secrets infrastructure. Cost: rotation is painful (every stored hash must be re-derived) and pepper loss is unrecoverable. Worth it for anything high-value; document it before you deploy it.
The policy layer: NIST 800-63-4
NIST finalized SP 800-63-4 in July 2025, and it codified what the data already proved: no forced periodic rotation (users respond with Spring2026! increments), no composition rules (length beats alphabet soup — 15 characters minimum for password-only auth, 8 where MFA is present), and mandatory screening of new passwords against breached-credential lists. The screening is cheap now — the HIBP Pwned Passwords range API does k-anonymity: send the first 5 hex chars of the SHA-1, get back every suffix hash starting with it, compare locally. The candidate password never leaves your server and can't be reconstructed from the prefix.
Migrating without a flag day
You can't rehash a stored hash into Argon2id — you don't have the plaintext. The standard migration is rehash-on-login: verify against the old scheme; on success, immediately re-derive with Argon2id and replace the row. The user base self-migrates through normal traffic; dormant accounts can keep the old hash or be force-reset. Double-wrapping (argon2id(bcrypt_hash)) as a batch operation works too and is a documented upgrade path — it preserves the old scheme inside the new envelope and upgrades cleanly on next login either way.
A related trap that lives in the same code path: login-response timing and text. "Wrong password" vs "no such user" — in body text or in response latency — is user enumeration as a service. Same response, same rough timing, for both failure modes.
Evidence it mattered
RockYou, December 2009: 32 million plaintext passwords from a SQLi against a company storing them un-hashed — the corpus that seeded a decade of cracking dictionaries. Collection #1, January 2019: 87 GB, ~773 million addresses, ~21 million passwords — industrialized credential stuffing, where breach combos get replayed against every login form on the internet by bots. Stuffing isn't a hashing problem; it's why the defenses are breach-screening, rate limiting, and MFA rather than a faster lock on the same door.
What to actually do
Argon2id at OWASP floor or bcrypt ≥12, per-user salt, optional pepper outside the DB, breach-check on set, never force rotation, rate-limit the login endpoint, and MFA as the real second wall.
Keep reading
Related articles from the SudoSecurity blog.
A 257-Byte Password Is the Key: Inside the OpenSSH musl Bypass
CVE-2026-123158 lets an attacker log into a locked account on musl-based systems like Alpine by sending a password nobody set. The trigger is one number, 257, and the reason is a C library returning a single asterisk. I reproduced the exact boundary against musl 1.2.4 and read the fix.
Zero-Trust Access for Homelabbers: Teleport vs. Tailscale vs. WireGuard vs. Cloudflare Tunnel
Four tools solve four different problems that all get pitched as the same problem. Here's what each one does, where each one breaks, and the combination that covers a real homelab without paying an SSO tax you didn't see coming.
The SSO Tax: Why Self-Hosted Projects Are Gating Login Behind a Paywall
A growing list of open-core self-hosted projects, from Grafana to Planka, gate single sign-on behind an Enterprise tier. Here's which protocol actually gets paywalled, and what to check before you deploy.
Zero Trust Everything: The Complete Guide to Self-Hosting Teleport for Secure Infrastructure Access
SudoSecurity runs Teleport internally for everything — admin panel access, secure database connections, Kubernetes, and zero-trust philosophy across our entire team. This is the complete technical guide to installing, configuring, and running your own self-hosted Teleport cluster from scratch.