Free tech learning for everyone, from basics to pro

Ethical HackingCyber SecurityIntermediate

Password attacks and defences: spraying, stuffing and cracking

In short: Attackers get passwords by guessing, spraying common passwords across many accounts, reusing leaked credentials, or cracking stolen hashes offline. Strong defences combine MFA, long unique passwords, rate limiting, monitoring and slow salted hashing.

Why passwords are targeted

Stolen or weak credentials are one of the most common ways into an organisation. A valid username and password lets an attacker log in like a normal user, often without triggering any malware alerts. Understanding the main attack types helps you pick the right defence for each.

Password attack typesGuessingone account, many triesSprayingmany accounts, few triesStuffingleaked pairs reusedOffline crackingstolen hashesPhishinguser hands it overMFA fatiguerepeated push prompts
Figure 1. Common ways attackers obtain or misuse passwords; each needs a different mix of defences.

Online attacks

Online attacks try passwords against a live login page or service.

  • Brute force and guessing: many attempts against one account. Easy to slow down with rate limiting and lockout.
  • Password spraying: one or two very common passwords (such as a season and year) tried against many accounts. Because each account sees only a few failures, per-account lockout does not trigger.
  • Credential stuffing: username and password pairs leaked from another website are tried automatically. It works because people reuse passwords.
  • MFA fatigue: if an attacker already has the password, they trigger repeated push approvals hoping the user taps "approve" to make it stop.

Offline cracking and hashing

Systems should never store passwords in plain text. They store a hash, a one-way fingerprint. If an attacker steals the hash database, they can try candidate passwords offline at high speed, hashing each guess and comparing results, with no lockout to stop them. This is offline cracking.

Storage choiceResistance to cracking
Plain text or reversible encryptionNone: never acceptable
Fast unsalted hash (MD5, SHA-1)Very poor: precomputed tables and fast hardware break most passwords
Fast hash with a unique saltBetter, but still too fast
Slow, salted password hash (Argon2id, scrypt, bcrypt, PBKDF2)Good: each guess is deliberately expensive

A salt is a random value stored with each hash so identical passwords produce different hashes and precomputed tables are useless. Try the hash tool to see how a tiny change in input completely changes the output.

Defences that work

Layers of password defencePhishing-resistant MFApasskeys, security keysLong, unique passwordsmanager, blocklistRate limits and lockoutslow online attacksSlow salted hashingArgon2id, bcryptMonitoringspot sprays and stuffing
Figure 2. Layered defences: MFA stops most account takeover, while hashing and monitoring cover what gets through.
  1. Turn on MFA everywhere, preferring phishing-resistant methods such as passkeys or FIDO2 security keys. Use number matching for push approvals.
  2. Follow current guidance such as NIST SP 800-63B: favour length over complexity rules, check new passwords against lists of breached and common passwords, and do not force routine expiry without cause.
  3. Encourage a password manager so every account gets a long, unique password. The password generator shows what good looks like.
  4. Rate-limit and lock out sensibly, using progressive delays to avoid letting attackers lock everyone out.
  5. Monitor for many failed logins across many accounts from one source (spraying) and for logins from unusual places.
  6. Hash correctly in any application you build.

Example lockout settings for a Windows standalone host and a Linux host using pam_faillock:

net accounts /lockoutthreshold:10 /lockoutwindow:15 /lockoutduration:15

# /etc/security/faillock.conf
deny = 10
fail_interval = 900
unlock_time = 900

Tip: password auditing (for example checking your domain's hashes against breached lists) is a legitimate defensive task, but it handles very sensitive data. Do it only with written approval and a clear process.

Practice

Why does per-account lockout fail to stop password spraying?
Spraying tries only one or two passwords per account, so no single account reaches the lockout threshold.
What does a salt protect against?
It makes identical passwords hash differently and defeats precomputed lookup tables, forcing the attacker to crack each hash separately.
Which single control prevents most account takeovers from stolen passwords?
Multi-factor authentication, ideally a phishing-resistant method such as passkeys or security keys.

Key takeaways

  • Online attacks include guessing, spraying, stuffing and MFA fatigue.
  • Offline cracking targets stolen hashes and is not limited by lockout.
  • Store passwords with a slow, salted algorithm such as Argon2id or bcrypt.
  • MFA, long unique passwords and breached-password checks stop most attacks.
  • Monitor for spraying patterns across many accounts.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.