Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

How passwords break

After this lesson: I can match each way a password is broken to the defence that stops it.

60 min lesson5 commandsPassword lab: John the Ripper, MFA and passkeys

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

One password, four ways in

A college's staff sign in with a password. An attacker does not need to break the encryption on the page. They can guess at the sign-in form or copy the password table and guess offline. They can try passwords leaked from another site, or ask for the password with a fake email.

Each of those is stopped by a different defence. This lesson sorts them out.

By the end of this lesson

Note

I can match each way a password is broken to the defence that stops it.

Key words

WordWhat it meansExample
Online attackguessing at the real sign-in form
Offline attackguessing against a stolen copy of the hashes
Credential stuffingtrying pairs leaked from another site
Phishingtricking a person into typing their password
Keyspacehow many passwords of a given shape exist26 ** 8
Salta random value stored with each hash

The cells students fill in are left blank in this preview.

Starter

Have a go

Starter

4 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Four ways a password is broken

An online attack guesses at the real form, so the site sees every try and can slow it down. An offline attack guesses against a stolen copy of the hashes, at whatever speed the attacker's computers manage.

Credential stuffing needs no guessing: it replays pairs leaked elsewhere, betting that people reuse passwords. Phishing and malware steal the password itself, so its strength does not matter at all.

Worked example: each way and what stops it

Way inWhat the attacker needsWhat stops it
Online guessingThe sign-in formRate limits, a blocklist of common passwords
Offline crackingA copy of the password tableA slow, salted hash and long passwords
Credential stuffingPairs leaked from another siteBreached-password checks, MFA, no reuse
PhishingA believable fake pagePhishing-resistant sign-in such as passkeys

The cells students fill in are left blank in this preview.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Match each attack to its defence

Have a go

Loading…

Your answers are marked here and are not kept. An account keeps your marks.

People choose passwords that can be guessed

The keyspace of 8 lowercase letters is about 209 billion. That sounds large, but people do not pick at random. They pick words, names, teams and years, so a list of a few thousand common choices covers a large share of real accounts.

Four random words from a list of 7,776 give a far bigger keyspace than 8 mixed symbols. They are easier to remember, too.

The start of the word list

Command
docker exec john head -3 words.txt

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Count the keyspace of five shapes

Command
docker exec john python3 steps/guesses.py 1000000000

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Worked example: what guesses.py printed

ShapeKeyspace
8 lowercase letters208,827,064,576
8 letters, digits and symbols6,634,204,312,890,625
4 words from a 7,776-word list3,656,158,440,062,976
3 words from a 7,776-word list470,184,984,576
This lab's word list97 words
8 lowercase at a billion guesses a second208 seconds at most

The cells students fill in are left blank in this preview.

A common mistake

Warning

Many people think a capital letter and a symbol make a password strong. They only help if the password is random. Liverpool1 and P@ssw0rd follow patterns every cracking tool tries first, so length and randomness matter far more than the mix.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Try it: keyspaces

Code: python
# How many passwords of each shape are there?
letters = 26 ** 8
mixed = 95 ** 8
words = 7776 ** 4
print("8 lowercase:", letters)
print("8 of 95 symbols:", mixed)
print("4 random words:", words)
# Add a line for 15 lowercase letters, then press Run.

Make a free account to save your work and track your progress.

A stolen table gives away reuse

The lab stores six made-up accounts' passwords three ways. fast.txt is unsalted SHA-256: two accounts with one password have one hash, so the table shows the reuse before any guess.

shadow.txt is SHA-512 crypt, the scheme Linux used for years. Each line holds the scheme, a salt and the hash, so equal passwords look different. Running the same scheme with the same salt makes the same line again.

Read the unsalted table

Command
docker exec john cat hashes/fast.txt

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Read two salted lines

Command
docker exec john head -2 hashes/shadow.txt

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Make amira's salted line again

Command
docker exec john openssl passwd -6 -salt Qm4tR8vLwZ2c sunshine

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Assignment: a guess budget

Write three functions. keyspace(symbols, length) returns how many passwords of that length can be made from that many symbols. worst_seconds(space, rate) returns how many whole seconds it takes to try every password at rate guesses a second, rounded down. on_list(passwords, words) takes a dictionary from a name to a password and a list of lowercase words, and returns the names whose password, in lower case, is on the list, in the order the dictionary gives them.

Code: python
def keyspace(symbols, length):
    return 0


def worst_seconds(space, rate):
    return 0


def on_list(passwords, words):
    return []

Make a free account to save your work and track your progress.

Exit quiz

Have a go

Exit quiz

5 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.