

- High failure rate associated with a particular TLS fingerprint, credential, or device increases suspicion.
- Device tokens: when a device has previously authenticated successfully, issue a persistent device token. Future logins from that token are low risk.
- Request heuristics: analyze header shapes, User-Agent consistency, request inter-arrival times, and geolocation anomalies.
- IP reputation and known bot lists.
- Behavioral signals: click/timing patterns, login sequence steps, and success/failure ratios.

Three treatment categories for login requests
Classify each login request by risk and route it to one of three paths:
Operationally, the goal is to avoid running bcrypt for high-risk requests while keeping legitimate users’ experience smooth.
Use a risk score aggregator that combines TLS fingerprint, credential failure rate, device token presence, IP reputation, and request behavior. Only run bcrypt for requests below your risk threshold; escalate higher-risk requests to challenge or reject paths.
- Bcrypt concurrency control: run password hashing in a bounded worker pool or a dedicated service so hashing load cannot exhaust CPU resources used by other request handling.
- Adaptive bcrypt cost: tune bcrypt cost for your CPU capacity and expected load. Consider Argon2 if you require a memory-hard function, but still control concurrency.
- Per-credential throttling: limit attempts per account/email and per credential identifier to increase attacker cost without blocking legitimate users.
- Per-fingerprint throttling: track failure rates by TLS fingerprint and slow down or require challenges for fingerprints that show abusive patterns.
- Device-based trust: issue persistent device tokens for recognized devices and reduce friction for them.
- Challenge paths: use CAPTCHA or 2FA for suspicious flows instead of immediately performing bcrypt.
- Early filtering: place an authentication gateway or WAF in front of your app servers to reject or challenge suspicious traffic before it reaches bcrypt workers.
- Monitoring and alerting: track bcrypt queue length, hashing worker utilization, login latency percentiles, and failure rates by fingerprint/account. Use these metrics to trigger autoscaling or mitigation playbooks.
Do not rely on a single signal (like IP blocking or account lockouts). Overly aggressive blocking can lock out legitimate users; under-blocking lets attackers waste CPU. Combine multiple signals and prefer challenge/slow-paths before permanent rejection.
- Detect suspicious requests early with cheap signals (TLS fingerprints, device tokens, failure rates).
- Compute a risk score and route requests to normal, slow, or reject paths.
- Protect CPU by bounding bcrypt concurrency and moving hashing to controlled worker pools.
- Use adaptive friction (CAPTCHA, 2FA, delays) to let legitimate users prove they are human without performing expensive bcrypt for every attempt.
- Monitor and iterate: use metrics to tune thresholds and detect new attack patterns.
- bcrypt: https://en.wikipedia.org/wiki/Bcrypt
- TLS handshake and ClientHello: https://www.rfc-editor.org/rfc/rfc8446.html#section-4.1
- JA3 TLS fingerprinting: https://github.com/salesforce/ja3
- Web Application Firewalls (WAF): https://en.wikipedia.org/wiki/Web_application_firewall