---
title: "Password Attacks | FiveStudy"
description: "Online and offline password attacks: reused leaks, password spraying, default credentials, credential stuffing, brute force, dictionary attacks, rainbow tables, and how salt helps."
url: https://fivestudy.com/guides/ap-cybersecurity-4-2-b-password-attacks
---

[AP Cybersecurity](https://fivestudy.com/ap-cybersecurity) · Study guide

# Password Attacks

[Figure: FiveStudy]

FiveStudy

AP® Cybersecurity · Unit 4 · Device Security, Malware & Authentication

AP® Cybersecurity · Unit 4 · Device Security, Malware & Authentication

# Password Attacks

How attackers get passwords: reused leaks, guessing, default credentials, and cracking stolen hashes with brute force, dictionaries, and rainbow tables.

1. Why passwords are such a target 2. Online and offline attacks 3. Reused and leaked passwords 4. Guessing and spraying 5. Default credentials and credential stuffing 6. Cracking stolen hashes 7. Rainbow tables 8. Worked examples 9. Common mistakes

## 1 Why passwords are such a target

If an adversary gets a legitimate user's password and the organization has not enabled MFA or other protections, the adversary can act inside that organization with all the access and rights of that user: read their email, open their files, approve their requests. That is why so many attacks aim at passwords first.

## 2 Online and offline attacks

Password attacks are classified as **online** or **offline**:

- **Online attacks** try username and password combinations on an active login page or service.
- **Offline attacks** work on a captured database of usernames and password hashes, running guesses on the attacker's own computer. This bypasses any account lockout protections.

**Figure 1.** An offline attack bypasses every account lockout, because the guessing never touches the real login page.

## 3 Reused and leaked passwords

Many people reuse the same password, or small variations of it, everywhere, despite warnings. When an organization's user database is stolen, the usernames, emails, and passwords are sold to adversaries or posted online. Adversaries often begin an attack on a person by trying their stolen or leaked credentials on other services.

## 4 Guessing and spraying

Many people choose easy-to-guess passwords, and adversaries try common passwords against accounts. **Password spraying** tries one common password (like `Summer2024!`) against many different accounts. Because each account sees only one or two failures, account lockout rules rarely trigger.

## 5 Default credentials and credential stuffing

Some devices and services, such as switches, routers, and IoT devices, come preconfigured with a default administrator username and password, often printed in the manual and published online (`admin` / `admin`). **Credential stuffing** is an attack that tries to log in using common default credentials or stolen account credentials, often automatically, across many devices or sites.

## 6 Cracking stolen hashes

Hashes cannot be reversed, but an attacker with stolen hashes can use automated **hash-cracking tools**: hash a possible password, compare it with the captured hash, and repeat. A match means the attacker has found a password that produces that hash, which they can use to log in.

- **Brute force**: test every possible password. Even all 6-letter lowercase passwords is 26^6 = 308,915,776 guesses; longer passwords quickly become impractical.
- **Dictionary attack**: test a list of common passwords. Weak passwords fall almost instantly.

**Figure 2.** Hashes cannot be reversed, but guesses can be hashed and compared. A common password falls within a few guesses.

## 7 Rainbow tables

A **rainbow table** attack does the hashing ahead of time. The attacker takes a list of common passwords, computes each one's hash, and builds a table of password and hash pairs, sorted by hash. With a stolen hash, an automated tool looks it up in the table instead of hashing guesses on the spot. A match gives a password that will log in.

Part of a rainbow table (sorted by hash)

```
1c8bfe8f801d79745c46…  letmein
323725e8eff4df0a4974…  Summer2024!
5e884898da28047151d0…  password
6382deaf1f5dc6e792b7…  football
65e84be33532fb784c48…  qwerty
8d969eef6ecad3c29a3a…  123456
```

**Salt defeats rainbow tables.** The table was built from plain passwords. A salted hash, `hash(salt + password)`, will not appear in it, so the attacker would need a new table for every salt.

| Attack | Online or offline | What it exploits | Main defense |
| --- | --- | --- | --- |
| Password spraying | Online | Common passwords across many accounts | Ban common passwords; watch for many-account failures; MFA |
| Credential stuffing | Online | Default credentials, or credentials leaked elsewhere | Change defaults; unique passwords; MFA |
| Brute force | Usually offline | Short passwords | Long passwords |
| Dictionary attack | Usually offline | Common or predictable passwords | Random, uncommon passwords |
| Rainbow table | Offline | Unsalted hashes of common passwords | Salt every hash |

The key idea

Online attacks guess at the login page and can be slowed by lockouts and MFA. Offline attacks crack stolen hashes on the attacker's own computer, where only strong passwords and salt slow them down.

## 8 Worked examples

Worked Example 1 Name the attack

### Five scenarios

Name each attack: (a) one password, `Welcome1!`, tried once against 3,000 employee accounts; (b) a home router still using `admin/admin` is logged into; (c) a stolen hash file is run against a list of 10 million common passwords on the attacker's laptop; (d) a precomputed table of hashes is searched for a stolen hash; (e) a person's leaked password from a game site is tried on their email.

1. 1

   (a) One common password, many accounts: password spraying (online).

2. 2

   (b) Logging in with default credentials: credential stuffing.

3. 3

   (c) Testing a list of common passwords against stolen hashes: an offline dictionary attack.

4. 4

   (d) Looking up the hash in a precomputed table: a rainbow table attack.

5. 5

   (e) Trying leaked credentials on another service: using reused, stolen credentials (credential stuffing).

**Answer:** (a) spraying, (b) default-credential stuffing, (c) offline dictionary, (d) rainbow table, (e) stolen-credential reuse.

Worked Example 2 Online or offline

### Why the lockout didn't help

A company locks accounts after 5 failed logins. Attackers stole the password-hash database last month, and several accounts were later accessed with correct passwords and no failed attempts. How?

1. 1

   With the hash database, the attackers ran an offline attack on their own computers.

2. 2

   Offline guesses never touch the login page, so the 5-attempt lockout never triggered.

3. 3

   Once cracked, the correct passwords were used directly, with no failures to notice.

**Answer:** Offline cracking bypasses lockouts. Salted, slow hashing, strong passwords, and MFA are the defenses.

Worked Example 3 Crack a hash

### The seventh guess

An attacker has the unsalted SHA-256 hash of a user's password and the word list in Figure 2. Explain how the password is found.

1. 1

   The tool hashes `123456` and compares: no match.

2. 2

   It continues through `password`, `qwerty`, `letmein`, `dragon`, `football`: no match.

3. 3

   It hashes `sunshine`: the hash matches the stolen hash.

**Answer:** The password is sunshine, found on the seventh guess. A random, uncommon password would not be on the list.

Worked Example 4 Salt versus rainbow tables

### The table that stopped working

An attacker has a rainbow table built from common passwords. The site stores `hash(salt + password)` with a random salt per user. Why does the table fail?

1. 1

   The table contains hashes of plain passwords, like hash("sunshine").

2. 2

   The stored value is hash("9be41f" + "sunshine"), a different input, so a completely different hash.

3. 3

   To use a table, the attacker would need one built for each user's salt, which defeats the point of precomputing.

**Answer:** Salt makes stored hashes different from anything in a precomputed table.

## 9 Common mistakes

Common Mistake 1 · Thinking lockouts stop all password attacks

Lockouts slow online guessing. Offline attacks on stolen hashes never touch the login page.

Common Mistake 2 · Thinking hashes can be decrypted

Cracking does not reverse a hash. It guesses passwords, hashes them, and compares.

Common Mistake 3 · Mixing up brute force and dictionary attacks

Brute force tries every possibility; a dictionary attack tries a list of likely ones. Rainbow tables precompute hashes for a list.

Common Mistake 4 · Leaving default passwords on devices

Default credentials are public. Routers, switches, and IoT devices need their admin password changed on setup.

Explain a password attack like this

“This is an offline dictionary attack: the adversary stole the database of password hashes, then used a tool to hash each word in a list of common passwords and compare it to the stolen hashes. Because it runs on the adversary's own computer, the site's account lockout never triggers.”

Name the attack, say whether it is online or offline, and explain what it exploits.

FiveStudy AP® Cybersecurity · Password Attacks
