Login and authentication basics: what OWASP's Authentication Cheat Sheet recommends
Review OWASP's guidance on passwords, authentication flows, account changes and defenses against automated login attacks.
At a glance
- OWASP calls MFA by far the best defense against the majority of password-related attacks.
- Passwords under 8 characters are weak with MFA on, under 15 without (OWASP, citing NIST SP 800-63B).
- Link federated identities by issuer + subject — never by matching email.
- Device, IP and location are risk signals, not substitutes for authentication.
Many apps still enforce rules like "one capital letter, one number, one symbol" and "change every 90 days". OWASP's Authentication Cheat Sheet (https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html), drawing on NIST SP 800-63B, says something different. This article summarises the whole sheet, which we read on 15 November 2026. For storing passwords and for sessions, see our separate articles. This is a developer checklist from one source, not a certification of any system as secure.
Passwords
- Enforce a minimum length. Citing NIST SP 800-63B, the sheet says passwords under 8 characters are weak when MFA is on, and under 15 when it is not.
- Allow a maximum of at least 64 characters so passphrases work. Do not silently truncate.
- Allow all characters, including Unicode and spaces. No composition rules (no forced upper case, digits or symbols).
- Block common and previously breached passwords. It names the Pwned Passwords service and notes you can host its database yourself.
- Do not force periodic changes. Rotate credentials after a leak, compromise or authenticator change. Encourage strong passwords and MFA.
- A strength meter can help; the sheet mentions zxcvbn-ts.
- Compare hashes with a safe function: a constant-time comparison, a maximum input length, and explicit types.
- Send credentials only over TLS or another strong transport, including the login page itself.
User IDs and usernames
Random user IDs avoid predictable or sequential values. Allow an email as a username only if it is verified at signup, and let users pick a non-email username. Do not allow sensitive internal accounts (for backends or databases) to log in through the front end.
Re-authentication
Ask for the current credentials before sensitive changes such as password, email, payment details or a new shipping address. Re-authenticate after risk events: suspicious activity, account recovery, or adding a trusted device. The sheet says to use a bound authenticator such as the current password or a passkey, not security questions, and to rotate sessions afterwards.
Generic error messages
Login, password recovery and signup should respond the same whether the user exists, the password is wrong or the account is locked. The sheet's examples: "Login failed; Invalid user ID or password." and "If that email address is in our database, we will send you an email to reset your password." Watch for differences in response time (a "quick exit" for unknown users reveals them) and in HTTP status codes. It admits generic messages can confuse real users, and suggests brute-force protection and CAPTCHA where messages cannot be generic.
Automated attacks
The sheet defines brute force (many passwords, one account), credential stuffing (pairs from other breaches) and password spraying (one weak password, many accounts).
Brute force
Many passwords tried against one account.
1 accountCredential stuffing
Email/password pairs taken from other breaches replayed here.
Many accountsPassword spraying
One common weak password tried across many accounts.
Many accountsDefences are layered:
- MFA, which it calls by far the best defence against most password attacks.
- Account lockout counted per account rather than per IP, with a threshold, observation window and duration. Exponential lockout is an alternative. Beware lockout being used to deny service to other users; letting forgotten-password still work is one mitigation.
- CAPTCHA as defence in depth only, perhaps after a few failures.
- No security questions.
- Log and review authentication failures and lockouts.
Other sign-in methods
OAuth is for authorisation to APIs; OpenID Connect adds identity (validate iss, aud, signature and exp of ID tokens). When linking a federated identity, key on iss plus sub, never auto-link by matching email, and require an authenticated session. TLS client certificates suit narrow cases such as intranets, not public sites. Make password-manager-friendly forms: standard HTML inputs with proper type.
More on federated sign-in
- OIDC clients should validate ID tokens (issuer, audience, signature using the provider's keys, expiry), prefer maintained libraries, and use the UserInfo endpoint for extra claims. OpenID 2.0 is obsolete; new systems should not implement it.
- Linking: identify a federated identity by issuer plus subject, do not auto-link on matching email or username, require an authenticated session before adding or removing links, validate the ID token before saving the link, cut off access through a removed identity, and notify the user when links change.
- OWASP says never let third-party apps store a user's username and password; use OAuth, OIDC or SAML instead. SAML is XML-based, can be started by the identity provider as well as the service, and is often the choice for enterprise single sign-on, while OpenID Connect dominates consumer use per the sheet.
- FIDO2 combines WebAuthn and CTAP and underlies passkeys. OWASP says not to assume passkey private keys are hardware-backed and non-exportable unless verified, since some are synchronised or backed up. See our passkeys article.
Changing the registered email address
OWASP gives a recommended process, since account takeover often starts here. Both variants first confirm the session is valid, describe the process, take the proposed new address, verify identity, store the change as pending, and use time-limited nonces in emailed links, with handling of the responses.
- User has MFA: verify with MFA. Send a notification-only email to the current address (with a link to report unexpected activity) and a confirmation-required email to the proposed new address.
- User has no MFA: verify with the current password. OWASP calls for three time-limited nonces and two confirmation-required emails, one to the current address and one to the new one.
OWASP frames the MFA process differently because of the additional identity proof. This article does not establish any identity provider's current account-change behavior. Admins and help-desk staff also need social-engineering training.
Adaptive (risk-based) authentication
Illustrative password-based adaptive flow, after OWASP's guidance
OWASP describes requiring different authentication depending on context: data sensitivity, time, location, IP address or device fingerprint. Example: MFA on the first login from a device but not later ones; or a day-long single sign-on session that asks again before the profile page. It says to use device fingerprints, IP addresses and remembered-device cookies as risk signals, not as substitutes for authentication, and to require a valid authenticated session before exposing private account data. The sheet lists design questions: which signals to monitor and how often to refresh them, how accurate they are, how a score maps to actions (allow, CAPTCHA, step-up MFA, block, revoke session), where the risk engine runs and its latency budget, how decisions apply consistently across web, mobile and API clients, and how to change or revoke tokens when a mid-session check escalates.
What to ask your developer
- What are our minimum and maximum password lengths, and do we check against a breached-password list?
- Do we force a periodic change, and if so why?
- Are our user IDs predictable?
- Do login, signup and recovery respond the same whether or not an account exists, including timing?
- Do we offer MFA, and what happens when someone changes their email address?
- How do we link federated identities?
Limits
We read the whole sheet. We did not read the sheets and standards it links (OAuth 2.0, NIST SP 800-63B-4 and 63C-4, ASVS), so those are only as summarised by OWASP. The sheet's SAML and enterprise remarks reflect its own view of the market and we did not check them. We quote no breach statistics. Regulated sectors may have extra rules. Our related articles cover multi-factor options, forgot-password flows, credential stuffing and session management in more detail.
By Omnistu.