Switch to:
Brute force protection: authentication that holds

Brute force protection: authentication that holds

Brute force attacks do not rely on ingenuity but on repetition. An automated process systematically tries credential combinations one after another until it finds the right one. There is no need to intercept network traffic or exploit a complex vulnerability in the application code. The only requirement is a login form that responds and time to spare. This is precisely why protection against this class of attacks is considered a baseline requirement in the vast majority of modern security standards, including ISO 27001, and represents one of the controls most easily overlooked when the team’s attention is focused on features.

The mechanics of the attack

A classic brute force attack tries every possible character combination until the correct password is found. In practice, this variant is rarely used against exposed systems because the computational time required would be prohibitive. What appears frequently in production logs is instead a dictionary attack, where automation sequentially tries the most common passwords, those leaked in previous breaches, or those derived from publicly available information about the target user. The most insidious variant is credential stuffing: email and password pairs taken from a compromised database belonging to another service are systematically verified against the one being targeted. This works because many users reuse the same credentials across different services, and the attacker knows it.

Defensive mechanisms

The first line of defence is rate limiting. Restricting the number of login attempts allowed within a given time window from the same IP address dramatically reduces the speed at which an attacker can operate. The threshold must be calibrated carefully: too permissive and the protection is ineffective, too restrictive and legitimate users risk being locked out when on the move or behind corporate proxies. A common strategy is to introduce a progressive delay between failed attempts, known as exponential backoff, which makes the iterative process increasingly slow without erecting an absolute barrier.

Example of brute force attack

Temporarily locking an account after a certain number of failed attempts is another established tool, but it must be managed with awareness because it introduces a secondary vector: an attacker who knows the usernames of existing accounts could deliberately trigger lockouts to produce a distributed denial of service. For this reason many systems pair account-level lockouts with IP-level lockouts, using differentiated thresholds and unlock procedures that cannot be automated. CAPTCHAs, imperfect and often frustrating for the user, add a further layer of friction that makes large-scale automated execution economically unattractive.

Tokens, sessions, and multi-factor authentication

The most robust protection against brute force is not technical but architectural. A system that requires a second authentication factor, whether a time-based code from a dedicated app or a push notification, renders any credential attack pointless because knowledge of the password alone is not sufficient to complete the login. Multi-factor authentication does not remove the need to protect the login form, but it radically reduces the potential damage if credentials are in fact compromised.

Example of two factor authentication

Token and session management is an area frequently overlooked when assessing the attack surface. Short-lived tokens, explicit revocation mechanisms, and automatic invalidation of inactive sessions narrow the time window during which a stolen token can be reused. In the context of exposed APIs, the use of request signing ensures that even an intercepted token cannot be replayed without the signature becoming invalid.

The role of logging in incident response

An authentication system that blocks attacks without recording what happens is blind to evolving threats. Granular logging of failed login attempts, complete with timestamp, IP address, user agent, and target account, does not simply satisfy formal compliance requirements; it is the raw material on which incident response is built. Without it, there is no way to establish whether an access event at a given moment was legitimate or the outcome of a successful attack following hundreds of failed attempts in the preceding hours.

Correlating these events over time is what makes it possible to distinguish a forgetful user who has forgotten their password from an automated process testing ten thousand combinations within an hour. Alerting systems must be configured to detect volume anomalies and patterns, not just absolute thresholds, because an attack distributed across multiple IP addresses can easily circumvent a rule that counts failures per single source.

ISO 27001 perspective

Control A.9.4.4 of ISO 27001 explicitly requires that systems implement measures to prevent unauthorised access through repeated attempts. It does not prescribe specific implementations but defines the objective: the system must make a systematic credential attack economically and operationally impractical. This translates into a need to document the architectural choices adopted, the parameters configured, and the criteria by which they were established, so that they can be evaluated during an audit.

Control A.8.15, which concerns event logging, is complementary: without adequate recording of access attempts it is impossible to demonstrate that protection is active or to produce forensic evidence in the event of an incident. Together, these two controls define a perimeter of accountability that runs from prevention to detection, covering it more completely than either would do alone.

Treating brute force protection as a configuration problem almost always leads to incomplete solutions. The strength of an authentication system does not come from enabling a framework feature but from understanding the actual attack vectors, calibrating thresholds against the expected behaviour of legitimate users, and building the operational visibility that allows a team to know, in real time, whether something unexpected is happening on the login form.

Ranieri Vannozzi

The author

Ranieri Vannozzi

Freelance software developer and consultant

I have been writing code since 2008, working on enterprise development, cloud-native architectures and technical leadership. On HeroHubs I write about what I run into every day on real projects, from code to architecture and artificial intelligence.

Article written with AI assistance and reviewed by the author.

Related Posts

Performant npm: the package manager that rethinks node_modules

Development

September 2026

Performant npm: the package manager that rethinks node_modules

Performant npm is not just a faster npm. The global store with hard links and the strict node_modules structure change the way a JavaScript project declares and uses its dependencies.

Conventional Commits: the commit message as a technical document

Development

June 2026

Conventional Commits: the commit message as a technical document

Writing commit messages freely is a convention that forms through inertia. Conventional Commits replaces it with a structure that generates value automatically.

Why is ignoring package-lock architectural suicide?

Development

May 2026

Why is ignoring package-lock architectural suicide?

Many developers treat the lock file as background noise in commits. In reality, it is the only thing standing between your code and a sudden crash in production.

Biome: the modern toolchain that simplifies web development

Development

October 2025

Biome: the modern toolchain that simplifies web development

Discover Biome: the unified toolchain for linting, formatting, and code analysis in JavaScript/TypeScript. Benefits, integration, and productivity for modern developers.

Test driven development: a silent ally for software heroes

Development

October 2025

Test driven development: a silent ally for software heroes

Learn about Test Driven Development (TDD): benefits, Red-Green-Refactor cycle, practical examples, and how TDD and BDD improve software quality and maintainability.

Astro: islands architecture and hybrid rendering for performant content

Development

October 2025

Astro: islands architecture and hybrid rendering for performant content

A guide to Astro: the modern framework for static and hybrid sites, islands architecture, server-first rendering, SEO, performance, and integration with React, Vue, and Svelte.

Feature flags: the key to safe, controlled, and continuous releases

Development

October 2025

Feature flags: the key to safe, controlled, and continuous releases

Learn how feature flags revolutionize software releases: gradual rollout, instant rollback, A/B testing, and best practices for DevOps and CI/CD.

Pull and merge requests: same goals but different approaches

Development

September 2025

Pull and merge requests: same goals but different approaches

Pull requests vs merge requests: differences, advantages, and best practices for code review on GitHub and GitLab, with a focus on DevOps and team collaboration.

Hono: simplicity and power for modern web applications

Development

September 2025

Hono: simplicity and power for modern web applications

A guide to Hono: the minimalist JavaScript web framework for building modern, fast, and maintainable applications. Features, examples, and benefits for developers.