Tutorial: How to protect accounts from brute force attacks

What is a brute force attack?

Brute force attacks are one of the oldest and most persistent online threats, leveraging sheer computing power to break into user accounts. By guessing username and password combinations over and over, attackers attempt to gain unauthorized access to accounts without needing a database of leaked credentials.

These attacks are often automated, enabling attackers to quickly test thousands of credentials. One of the key reasons these attacks remain successful is the prevalence of weak passwords and poor password practices. 

In fact, weak passwords are responsible for an estimated 35% of hacks. With “123456” and “password” ranking among the most common choices, attackers can exploit predictable patterns without needing advanced techniques.

Some of the types of brute force account attacks include:

  • Trial and error hacking is the most basic form of brute force attack. In this approach, attackers repeatedly try different username and password combinations, often using automated scripts, until they find a valid match. The approach relies on guessing random or weak credentials, making it time-consuming but effective against simple passwords.
  • Credential stuffing fraudsters use large sets of previously leaked usernames and passwords, often obtained from data breaches, to attempt logins on various other websites. Since 85% of people reuse passwords across multiple services, attackers can gain access to accounts without needing to guess new credentials.
  • Password spraying involves trying a small set of commonly used passwords (like “123456” or “password”) across many accounts instead of focusing on one account with many password attempts. This method takes advantage of users choosing weak, common passwords while also avoiding triggering security mechanisms like account lockouts.

Why is preventing brute force attacks important?

Brute force attacks are a persistent and dangerous threat that can have far-reaching consequences for both individuals and businesses. Preventing these attacks is critical because they can result in unauthorized access to user accounts, leading to significant financial loss, data breaches, and damaged brand reputation. For businesses, the impact goes beyond individual accounts — customer trust is eroded and recovery costs can skyrocket.

These attacks can affect businesses of any size and for various reasons. For instance, Dunkin’ Donuts faced a loyalty point scam starting in 2015, with over 300,000 customer accounts compromised and funds stolen. The following year, Alibaba experienced a breach involving over 20 million accounts, which were later sold or used for fake reviews. More recently, in 2024, Microsoft suffered a password spraying attack by Russian-state hackers, where a weak password on a legacy test account allowed access to corporate email, including that of senior leadership, for up to seven weeks before detection.

These examples show the ongoing importance of strong password policies and fraud prevention strategies in defending against brute force attacks.

How to stop brute force attacks

Businesses can take several proactive measures to prevent brute force attacks. Implementing the right security practices can significantly reduce the likelihood of a successful attack and protect user accounts from being compromised. Below are some effective strategies to strengthen your defenses.

  1. Strong password policies are a foundational defense against brute force attacks. They require complex passwords incorporating a mix of characters, numbers, and symbols and prompt users to change them regularly. This reduces the chances of attackers successfully guessing or cracking weak passwords.
  2. Passwordless authentication alternatives, such as biometrics or magic email links, further strengthen security since attackers cannot guess the password.
  3. Multi-factor authentication (MFA) adds an additional layer of security that ensures that even if a password is compromised, attackers still need a second form of verification, such as a code sent to a user’s phone. This makes brute force attacks much less effective.
  4. Account lockout mechanisms temporarily disable access to an account after a certain number of failed login attempts. This disrupts automated brute force attacks, making it harder for attackers to continue guessing credentials for an account.
  5. Rate limiting the number of login attempts to any account from the same device within a specific time frame can slow down or block brute force attempts altogether.
  6. Bot detection on login pages can help differentiate between legitimate users and automated tools attempting brute force attacks.

By combining multiple measures, businesses can create a robust defense against brute force attacks, protecting user accounts and sensitive data.

Using Fingerprint for brute force prevention

Many of the above prevention methods depend on accurately identifying and recognizing devices, whether it’s enforcing account lockouts, applying rate limits, detecting unfamiliar devices, or spotting bots. This is where Fingerprint comes in!

Fingerprint is a device intelligence platform that assigns a unique identifier to every visitor on your website or mobile app. It works seamlessly in the background whenever someone visits a page with our JavaScript fingerprinting agent installed. This identifier remains stable over time, even with browser updates, incognito mode, VPN use, or cleared cookies. Fingerprint’s Smart Signals also detect suspicious behaviors like bot activityVPN use, or browser tampering.

By reliably recognizing returning browsers or devices, you can enforce account lockouts and rate limits more effectively while providing smoother logins for legitimate users. With bot detection, you can block automated tools from accessing your login system altogether. 

In the following tutorial, I’ll show you how to integrate Fingerprint into your login logic to prevent brute force attacks and protect user accounts. While the way you use Fingerprint data to prevent fraud will vary based on your specific use case, the following steps outline some best practices.

Identifying a visitor

To get started, you’ll need a Fingerprint account to access the features we’ll be integrating. You can sign up for a 14-day free trial. Once you have your public and secret API keys from the Fingerprint dashboard, you’re ready to install the JavaScript agent.

The JavaScript agent is a client-side script that collects device and browser attributes, sending them to Fingerprint for processing, identification, and bot detection. You can use the Fingerprint CDN as seen below or one of our various SDKs for popular frameworks.

You’ll want to load the agent as soon as possible on your login page:

It’s been an exciting year for FingerprintJS, the most advanced, source-available browser fingerprinting library on GitHub. No, we haven’t yet figured out how to get

What is a brute force attack? Brute force attacks are one of the oldest and most persistent online threats, leveraging sheer computing power to break

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!