Brute force attacks: guessing until something works

A brute force attack tries passwords against a sign-in form, one after another, until one of them is accepted. It needs no weakness in the code, only a sign-in that answers every attempt. The defence is to make each wrong guess cost something, without turning that cost against the real owner of the account.

Bruteforce, written as one word, means the same thing: to bruteforce a password is to try candidate passwords until the service accepts one. By definition the attack relies on volume and on a sign-in that answers every attempt, so the spelling changes nothing about the defences below.

Section Bots Updated Targets sign-in

Quick facts

Target
Sign-in forms and authentication APIs
Weakness
CWE-307: improper restriction of excessive authentication attempts
Variants
Simple guessing, dictionary attacks, password spraying, credential stuffing
In your logs
Many failed sign-ins, concentrated on one account or spread across many from the same sources
Does a WAF stop it?
Partly. Rate and pattern of attempts can be limited; password policy, second factors and lockout logic live in the application

Definitions follow OWASP and CWE-307.

How a brute force attack works

The attacker picks a target, usually a username, and sends sign-in attempts with different passwords. Each attempt is an ordinary request; what makes it an attack is the number of them and the fact that almost all fail. Probing which accounts exist comes first in many attacks: user enumeration.

Pure brute force tries every combination and is slow against any password of reasonable length. Real attacks are smarter about which passwords to try first, which is why the variants below matter more than the textbook definition.

Brute force or bruteforce: which spelling?

"Brute force" as two words is the established form for the attack; "bruteforce" as one word is also used, including as a verb. "Brutal force attack" is a misspelling of the same thing: the word is brute, force applied without cleverness. Whichever spelling you search for, the definition is the same.

What is a password bruteforcer?

A password bruteforcer is a program that runs one loop: take a candidate password, submit it to the sign-in, read the response, take the next one. The brute force attack algorithm is that simple; what varies is the order of candidates, and a dictionary attack tries the likely ones first.

To your server this is a run of ordinary sign-in requests, almost all failing. It is caught by the rate and pattern of failures, not by the name of the program. Throttling and a second factor apply whichever tool sends the guesses.

How long a brute force attack takes

It depends on how many combinations there are and how fast they can be tried. Eight lowercase letters give 26 to the power of 8, about 209 billion combinations; adding capitals, digits and symbols to the same eight characters raises that to roughly 6.6 quadrillion. Every extra character multiplies the total again.

Speed depends on where the guessing happens. Against a live sign-in form, rate limits and lockouts hold an attacker to a handful of guesses per account per minute, which is why online attacks rely on lists of likely passwords rather than every combination. Against a stolen database of password hashes, guessing runs offline at whatever speed the hash allows, which is why slow password hashing matters.

How do I calculate how long a brute force attack would take?

Count the possible passwords: the size of the character set raised to the password length. Divide by the number of guesses per second. On average the password is found after searching about half of that space; the worst case is all of it.

The guess rate decides the result. Against a live sign-in form, limits hold it low, so a brute force attack calculator that assumes offline speed overstates the online risk. Against a stolen hash database with a fast hash, the same arithmetic understates it.

Dictionary attacks, spraying and stuffing

  • Dictionary attack. Tries likely passwords first: common words, leaked password lists and their usual variations.
  • Password spraying. Tries one or a few common passwords against many accounts, staying under per-account limits.
  • Credential stuffing. Tries username and password pairs leaked from other sites; see credential stuffing.
  • Reverse brute force. Starts from one known password and looks for an account that uses it.

The difference decides what catches them. Attempts concentrated on one account show up in per-account counts; spraying and stuffing show up only in totals per source and in the ratio of failures to successes.

WHICH DEFENCE SEES WHICH VARIANT PER-ACCOUNT LIMIT PER-SOURCE LIMIT SECOND FACTOR BRUTE FORCE / DICTIONARY PASSWORD SPRAYING CREDENTIAL STUFFING // a second factor is the only column that catches all three
// three variants, and the one defence that catches all of them

Types of password attacks

Guessing online: brute force, dictionary attacks and password spraying, all against the live sign-in. Reusing leaks: credential stuffing with pairs stolen from other sites. Cracking offline: guessing against stolen hashes, where no limit applies.

Taking the password directly: phishing pages, keyloggers and malware that reads saved passwords, none of which involve guessing at all. Rate limits and lockouts help only against the first group; multi-factor authentication helps against all of them, which is why it comes first in most advice.

What it looks like in your logs

A burst of failed sign-ins is the obvious sign. The quieter signs matter more: a steady rate of failures across many accounts, failures from hosting ranges rather than from homes and phones, usernames that do not exist on your site, and a success that follows a long run of failures from the same source.

That last pattern deserves an alert of its own. A success after many failures is a likely compromise, and the account should be checked before its owner notices.

Password guessing is often only one of the jobs a botnet is rented for; the same infrastructure also drives web scraping and click fraud.

How to investigate a brute force attack

To investigate a brute force attack, start from the failed sign-ins in your logs. Here is how to work through them.

  1. Count failures per account and per source. Many failures on one account point to guessing; a few failures on many accounts point to spraying.
  2. Check every account that had a success after a long run of failures from the same source, and treat it as compromised until it is verified.
  3. Reset the affected passwords, require a second factor, and set limits so the next run is slowed.

Why brute force still works

Brute force succeeds because people reuse and choose predictable passwords, and because many sign-in forms answer an unlimited number of attempts at full speed. Lists of leaked passwords give attackers the likely guesses first, so a weak password falls in minutes, not years.

Each part of that is fixable. Limits remove the unlimited attempts, breached-password checks remove the likely guesses, and a second factor makes a correct guess insufficient on its own.

How to prevent brute force attacks

  1. Add a second factor. Multi-factor authentication defeats a guessed password; the OWASP Authentication Cheat Sheet puts it first.
  2. Throttle failed attempts. Slow down or delay after failures without hard lockouts. NIST SP 800-63B section 5.2.2 sets a ceiling of 100 consecutive failed attempts per account and lists ways to avoid locking real users out.
  3. Limit per source as well as per account. Spraying and stuffing stay under per-account limits; choosing the subject of a limit explains the trade.
  4. Refuse known-bad passwords. Check new passwords against breached and common password lists.
  5. Answer every outcome the same way. Identical responses for wrong user and wrong password stop attackers from learning which usernames exist.

Hard lockout is the measure to use carefully: anyone who knows a username can then lock its owner out on purpose. CAPTCHA is one way to slow attempts; it costs real users, so it belongs after other signals, not on every sign-in.

Brute force outside the web layer

The same attack runs against remote-access services such as SSH and remote desktop. Those connections never reach a web application, so a request filter does not see them; they are protected with keys instead of passwords, network restrictions and the service's own attempt limits.

How to block RDP brute force attacks, and what about SMB or FTP?

To block RDP brute force attacks, a web request filter is the wrong tool: RDP, SMB and FTP logins use their own protocols and never reach a web application. A brute force attack on FTP or a file share is handled where the service runs: network restrictions, the service's own attempt limits, keys instead of passwords where the service supports them, and a second factor where it offers one.

Questions

What is a brute force attack?

A brute force attack is an attempt to break into an account by trying passwords until one works. It targets sign-in forms and authentication APIs and relies on the service answering every attempt.

What is a dictionary attack?

A dictionary attack is a brute force attack that tries likely passwords first, from lists of common and leaked passwords, instead of every possible combination.

How do I stop brute force attacks on my login page?

Add a second factor, throttle failed attempts per account and per source, refuse known-bad passwords, and give the same response for every failure. Avoid hard lockouts that let anyone lock an owner out.

Is brute force the same as credential stuffing?

No. Brute force guesses passwords for an account; credential stuffing tries username and password pairs leaked from other sites. They are caught by different limits.