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

Preview

Hackers and attacks on websites

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

50 minutes

What if you type code, not a name?

A website asks for your name. You type "Sam". The site says "Hello Sam".

Now a different person types something strange. The site shows every name in its list.

The site made a mistake: it trusted what a stranger typed. Many attacks start in this way.

Key words

WordWhat it meansExample
HackerA person who gets into a system. A malicious hacker has no permission.a criminal
HacktivistA hacker who attacks to support a cause.a protest attack
Nation stateA country's government hackers.spying on another country
Brute forceTrying every possible password until one works.0000, 0001, 0002 ...
Cross-site scriptingXSS. An attacker gets a page to run their code in other people's browsers.a harmful comment
DatabaseA store of organised data that programs can ask questions.a table of users
QueryA question that a program asks a database.find the user called sam
SQL injectionTyped text that changes what a database query does.a search box that shows secrets
Buffer overflowToo much data is put in a small space. It spills into the next space.20 letters in a 10 letter box
Man-in-the-middleAn attacker secretly sits between two people and reads their messages.a fake Wi-Fi hotspot
DNSThe internet's phone book. It turns a name like shop.com into an address.shop.com becomes 203.0.113.5
APIA way for one program to ask another program for data.a weather app asking a weather service

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

Quick check: who attacks and why?

Have a go

Quick check: who attacks and why?

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

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Who attacks?

AttackerWantsExample
HacktivistTo make a pointTakes down a site of a company they dislike
Nation stateSecrets and powerSpies on another country's government
Organised crimeMoneySteals card numbers and sells them
IndividualMoney, fun or revengeA student who tries to change their own marks

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

Password cracking

A computer can try millions of passwords a second. Brute force tries all of them.

The more characters you use, the more combinations there are. Each new character multiplies the number.

See the table. A 4 digit PIN has 10 choices for each of 4 places.

Worked example: how many guesses?

Password typeChoices per placePlacesWorkingCombinations
4 digit PIN10410 x 10 x 10 x 1010,000
6 digit PIN10610 x 10 x 10 x 10 x 10 x 101,000,000
3 lowercase letters26326 x 26 x 2617,576

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

Try it: count the combinations

Code: python
# In Python, ** means "to the power of".
# 10 ** 4 means 10 x 10 x 10 x 10.
print(10 ** 4)

# A computer that tries 1000 guesses a second:
guesses_per_second = 1000
seconds = (10 ** 4) / guesses_per_second
print("A 4 digit PIN takes", seconds, "seconds")

# Change 10 ** 4 to 10 ** 6 in both places. How long now?

Extra: Going further: longer passwords

Password typeChoices per placePlacesCombinations
3 lowercase letters26317,576
6 lowercase letters266308,915,776
8 lowercase letters268208,827,064,576

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

The lesson goes on

15 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.