Authentication
Table of Contents
Verifying that an entity is who it claims to be. The second step in the IAAA model — after identification (claiming an identity) comes authentication (proving it). Successful authentication is a prerequisite for authorisation (deciding what the authenticated identity is permitted to do).
Related: IAAA Multi-Factor Authentication Identity Provider Federated Services OAuth 2.0 Hashing Broken Authentication Insecure Authentication Mechanism Session Management Testing
Authentication Factors
Classified by what they require the user to present:
| Factor | Category | Examples |
|---|---|---|
| Password, PIN, security question | Something you know | Most common — weakest alone |
| Hardware token, smart card, phone OTP | Something you have | TOTP, FIDO2, SMS (weak) |
| Fingerprint, face, iris, voice | Something you are | Biometrics |
| GPS location, network, time of day | Somewhere/sometime you are | Contextual / adaptive |
MFA combines two or more factors. SMS OTP is technically "something you have" but is weak due to SIM-swapping and interception — prefer TOTP or FIDO2 hardware keys.
Authentication Methods
Password-based
The most common. Weak alone — susceptible to brute force, credential stuffing, phishing, and database breaches.
Mitigations: — Strong password policy (length over complexity) — Bcrypt/Argon2 hashing — never store plaintext or MD5 — Account lockout or exponential backoff after failures — Breach database checking (HaveIBeenPwned API) on login
See Hashing for algorithm comparison.
Token-based
The server issues a signed token on successful login; the client presents it on subsequent requests.
Session cookie — server-side session lookup JWT — self-contained, server-side validation only API key — long-lived static credential for service auth TOTP code — time-based one-time password (RFC 6238)
See JSON Web Tokens for JWT-specific detail and attacks.
Certificate / PKI
The client presents a digital certificate signed by a trusted CA. Used in mutual TLS (mTLS), SSH key authentication, and smart card login.
# SSH key authentication ssh-keygen -t ed25519 -C "user@host" ssh-copy-id user@server # install public key on server ssh user@server # authenticate with private key
Biometric
Fingerprint, face, or iris used to unlock a local device or app. The biometric data never leaves the device — the device then uses a local credential (key, PIN) to authenticate to the server.
Federated / SSO
Authentication is delegated to an external Identity Provider. The service trusts the IdP's assertion rather than managing credentials itself.
Protocols: SAML 2.0, OpenID Connect, OAuth 2.0 Examples: "Login with Google", Azure AD/Entra ID SSO, Okta
See Federated Services for protocol detail.
Common Weaknesses
— Weak or reused passwords — No MFA on privileged accounts — Password stored as MD5 or plaintext — No account lockout — brute force possible — Username enumeration via different error messages — Insecure password reset (predictable tokens, no expiry) — JWT algorithm confusion or weak secret — Session token not invalidated on logout
See Broken Authentication for testing methodology and Insecure Authentication Mechanism for SPA/API-specific bypasses.
Tips
- MFA is the single highest-impact control for account security — a stolen password alone is insufficient with MFA in place
- Password length matters more than complexity — a 20-character passphrase is stronger than an 8-character complex password
- "Something you know" answers to security questions are effectively second passwords — treat them as credentials and store them as such, not as public information
- Always test whether session tokens are invalidated server-side on logout — many applications delete the cookie client-side but leave the server-side session valid