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.
| Property | Online attack | Offline attack |
|---|---|---|
| Target | Live login service or API | Stolen hashes or encrypted files |
| Typical speed | A few to thousands of guesses per second | Millions to billions per second |
| Main limit | Rate limiting, lockout, CAPTCHA | Hash algorithm cost and hardware |
| Visibility | Generates log entries and alerts | Invisible to the victim |
| Key defense | Throttling and multi-factor authentication | Slow, salted password hashing |
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.
| Variant | Method | Best suited for |
|---|---|---|
| Exhaustive search | Every combination of a character set and length | Short PINs and short passwords |
| Dictionary attack | Words and leaked passwords from lists | Human-chosen passwords |
| Hybrid or rule-based | Dictionary words plus mutations like digits or symbols | Passwords such as Summer2024 with a symbol |
| Mask attack | Pattern-constrained search, for example six letters plus two digits | Known password policies |
| Reverse brute force | One common password tried against many usernames | Large user directories |
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 type | Approximate entropy | Worst-case time at 10 billion guesses per second |
|---|---|---|
| 4-digit PIN | 13 bits | Under one millisecond |
| 8 lowercase letters | 38 bits | About 20 seconds |
| 8 mixed characters (95 symbols) | 53 bits | About 8 days |
| 12 mixed characters | 79 bits | Millions of years |
| AES-128 key | 128 bits | Far beyond any feasible effort |
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.
| Control | How it works | Attack it counters |
|---|---|---|
| Rate limiting | Caps attempts per account, IP address or device | Online guessing |
| Progressive delays | Increases wait time after each failure | Online guessing without full lockout |
| Multi-factor authentication | Requires a second factor beyond the password | Online guessing and stuffing |
| Slow password hashing | Uses bcrypt, scrypt or Argon2 with a high cost | Offline cracking |
| Unique salts | Adds a random value to each stored hash | Precomputed rainbow tables |
| Breached-password screening | Rejects passwords found in leak lists | Dictionary attacks |
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.