Prompt
How do I stop credential stuffing against API logins and tokens?
Latest observation
Oct 29, 2026
OpenAI APIWeb search: off
To stop credential stuffing against API logins and tokens, you want layers of defense, because no single control is enough.
1) Protect login endpoints
- MFA/WebAuthn for human accounts, especially admins and support users.
- Rate limit by IP, account, device fingerprint, ASN, and global burst patterns.
- Progressive throttling: slow down repeated failures instead of hard-locking immediately.
- Bot detection / challenge on suspicious traffic, but avoid breaking API clients.
- IP reputation / geo-risk checks and block or step-up auth for high-risk sources.
- Credential stuffing detection: alert on many usernames from one IP or many IPs against one username.
2) Make passwords less useful
- Block breached passwords at creation and reset time.
- Enforce strong, unique passwords and discourage reuse.
- Watch for password-spray patterns: many accounts, few passwords.
3) Harden tokens and API auth
- Use short-lived access tokens.
- Prefer refresh tokens with rotation and reuse detection.
- Store tokens hashed if you persist them server-side.
- Bind tokens to context where possible:
- mTLS
- DPoP / proof-of-possession
- device/session binding
- Scope tokens narrowly: least privilege, audience restrictions, and per-app/per-device tokens.
- Support token revocation and immediate invalidation on suspicious activity.
4) Separate human login from machine/API auth
- Use OAuth client credentials or signed assertions for service-to-service auth, not shared passwords.
- For public APIs, prefer API keys with rotation, scoping, and quotas, or better, signed requests.
- Don’t let a stolen password directly grant broad API token issuance without checks.
5) Detect abuse in real time
Track:
- login failure rates
- unique usernames per source
- unique sources per username
- token issuance spikes
- new device/location patterns
- impossible travel / anomalous user agents
- refresh token reuse events
Then:
- step-up MFA
- temporary account protection
- session/token revocation
- manual review for high-value accounts
6) Reduce blast radius
- Use least privilege for accounts and tokens.
- Segment sensitive APIs behind additional auth or network controls.
- Apply per-tenant quotas if you’re multi-tenant.
- Limit what a newly issued token can do until trust increases.
7) Make automation harder without hurting clients
- Use nonce/challenge-response for high-risk flows.
- Require signed payloads for critical actions.
- Add idempotency keys and request validation to reduce abuse value.
- Consider proof-of-work only as a last resort.
8) Operational response
- Maintain fast token revocation and password reset workflows.
- Have a credential stuffing playbook:
- identify attack source patterns
- block/slow them
- invalidate suspicious sessions
- notify affected users
- force resets/MFA when needed
- Monitor for token replay and session hijacking after successful logins.
Practical “best first steps”
If you want the biggest impact quickly:
- Add MFA for all privileged users and encourage/passkey support for everyone.
- Implement rate limiting + throttling on login and token issuance.
- Add breached-password screening.
- Move to short-lived access tokens + rotating refresh tokens.
- Add anomaly detection and token revocation on suspicious activity.
If you want, I can also give you:
- a reference architecture for API auth defense,
- specific rate-limit rules,
- or a checklist for OAuth/JWT/refresh token hardening.
Brands