Brute-force attack

On this page 7

A brute-force attack is a method of guessing a secret by systematically trying candidate values until the correct one is found, applied to passwords, PINs, encryption keys or hidden URLs. In cybersecurity, it belongs to the malware and attacks family as one of the oldest techniques, because it needs no software flaw at all: it succeeds whenever the search space is small enough or the target does not limit attempts.

The feasibility of a brute-force attack is a matter of arithmetic. The attacker needs, on average, to test half of all possible values, so the defender wins by making that number so large, or each guess so slow, that the attack becomes economically pointless.

How a brute-force attack works

A brute-force attack enumerates candidates from a defined set and checks each one against a verification oracle, which is anything that reveals whether a guess is correct. The oracle may be a live login form, an API endpoint, or a stolen password hash that the attacker can test on their own hardware.

This distinction produces the two main operating modes. In an online attack, every guess travels over the network to the real service, so speed is limited by latency and by defenses such as lockouts. In an offline attack, the attacker has obtained hashes or an encrypted file and guesses locally with GPUs, at rates that can reach billions of guesses per second for fast hash functions.

PropertyOnline attackOffline attack
TargetLive login service or APIStolen hashes or encrypted files
Typical speedA few to thousands of guesses per secondMillions to billions per second
Main limitRate limiting, lockout, CAPTCHAHash algorithm cost and hardware
VisibilityGenerates log entries and alertsInvisible to the victim
Key defenseThrottling and multi-factor authenticationSlow, salted password hashing
Online and offline brute-force attacks compared

Variants of brute-force attacks

Pure exhaustive search is rarely the first choice, because attackers know that human-chosen passwords are predictable. Most real attacks combine enumeration with knowledge of common patterns, which dramatically shrinks the effective search space.

The table lists the principal variants and how they differ from neighboring attack types in the same Topic.

VariantMethodBest suited for
Exhaustive searchEvery combination of a character set and lengthShort PINs and short passwords
Dictionary attackWords and leaked passwords from listsHuman-chosen passwords
Hybrid or rule-basedDictionary words plus mutations like digits or symbolsPasswords such as Summer2024 with a symbol
Mask attackPattern-constrained search, for example six letters plus two digitsKnown password policies
Reverse brute forceOne common password tried against many usernamesLarge user directories
Main brute-force variants and related techniques

Password spraying is a reverse brute-force form that tries a few popular passwords across many accounts to stay below lockout thresholds. Credential stuffing, by contrast, is not guessing at all: it replays username and password pairs leaked from other breaches, relying on password reuse.

Why password length and entropy decide the outcome

The strength of a secret against brute force is measured in bits of entropy, where each additional bit doubles the number of guesses required. A truly random password drawn from an alphabet of N symbols with length L has N to the power L possibilities, so length grows the search space exponentially.

The figures below assume randomly generated secrets and an offline attacker at ten billion guesses per second against a fast, unsalted hash. They are order-of-magnitude estimates; slow hashing algorithms raise them by many orders.

Secret typeApproximate entropyWorst-case time at 10 billion guesses per second
4-digit PIN13 bitsUnder one millisecond
8 lowercase letters38 bitsAbout 20 seconds
8 mixed characters (95 symbols)53 bitsAbout 8 days
12 mixed characters79 bitsMillions of years
AES-128 key128 bitsFar beyond any feasible effort
Approximate exhaustive search effort for random secrets

Real passwords carry much less entropy than their length suggests, because people choose words, names and predictable substitutions. This is why dictionary and rule-based attacks crack many long but patterned passwords quickly, and why random passphrases or password managers are the reliable remedy.

Defending against brute-force attacks

Effective defense against a brute-force attack combines controls that limit guesses with controls that make each guess expensive or useless. No single measure suffices, because online and offline attacks are stopped by different mechanisms.

ControlHow it worksAttack it counters
Rate limitingCaps attempts per account, IP address or deviceOnline guessing
Progressive delaysIncreases wait time after each failureOnline guessing without full lockout
Multi-factor authenticationRequires a second factor beyond the passwordOnline guessing and stuffing
Slow password hashingUses bcrypt, scrypt or Argon2 with a high costOffline cracking
Unique saltsAdds a random value to each stored hashPrecomputed rainbow tables
Breached-password screeningRejects passwords found in leak listsDictionary attacks
Defensive controls and what they counter

Standards such as NIST SP 800-63B recommend favoring length over composition rules, screening against known compromised passwords and limiting failed attempts. Hard account lockout should be used with care, since attackers can exploit it to lock out legitimate users as a denial-of-service tactic.

Detection signals and common mistakes

Online brute-force activity leaves characteristic traces in authentication logs: bursts of failures for one account, many accounts failing from one source, or low-and-slow failures spread across distributed botnet addresses. Correlating these events in a security monitoring platform reveals attacks that each individual system would miss.

  • Exposing SSH or RDP directly to the internet with password authentication invites constant guessing.
  • Counting failures only per IP address misses distributed attacks from botnets.
  • Fast hashes such as MD5 or SHA-1 for password storage make offline cracking trivial.
  • Complexity rules without length produce predictable passwords that rule-based attacks crack.
  • Ignoring secondary endpoints such as legacy APIs leaves an unthrottled path open.

The short version

Imagine a bicycle lock with four number wheels. Someone who tries every combination from 0000 to 9999 will open it eventually. That patient guessing is a brute-force attack, done by computers at enormous speed.

The key takeaway: long, random passwords and limits on attempts defeat it. A longer secret means far more combinations, and a system that slows down or blocks repeated guesses makes the attacker give up.

Where it makes a difference

A small accounting firm exposed a Windows server through Remote Desktop on port 3389 so staff could work from home. Within days, its logs showed over 40,000 failed logins per day from hundreds of addresses, cycling through common usernames such as administrator and scanner with dictionary passwords.

An external administrator moved remote access behind a VPN with multi-factor authentication, enabled account lockout after ten failures within fifteen minutes, and replaced a reused administrator password with a randomly generated 20-character one. Failed external login attempts dropped to zero and the firm avoided the ransomware intrusion that such exposed servers frequently suffer.