---
title: "Lab: A Risk Register for a Small Online Shop"
domain: cybersecurity
level: beginner
duration: "35 min"
cost: "free"
environment: "your own computer (Linux, macOS, or Windows with WSL2) with Python 3.9 or later; no accounts, no network access"
---

# Lab: A Risk Register for a Small Online Shop

## Goal
Act as the security adviser of a tiny online shop. First list what the shop must protect and which CIA property matters most for each asset. Then match threats to weaknesses. Then run a short Python script that scores six risks and ranks them. Finally, choose a control for the three biggest risks.

## Objectives
- Classify assets by the CIA property that matters most for each.
- Tell apart a threat from a vulnerability and match them.
- Rank risks by likelihood × impact and see how one change moves the ranking.
- Choose a preventive, detective or corrective control for a risk.

## Prerequisites
- Python 3.9 or later (`python3 --version`). You only run a script; you don't need to know Python.
- A terminal and a text editor.
- No cloud account, no payment details and no network access.
- [The Security Fundamentals lesson](lesson.md) of this module.

> [!WARNING]
> Everything here is a thinking exercise on paper plus one small script. The shop, its staff and its risks are **invented**, and nothing in this lab scans, probes or attacks any real system. In real life, only assess and test systems you own or have written permission to test.

## Architecture
![Lab scenario. On the left, the invented online shop Harbour Candles with four assets: the web shop where customers order, the customer and order data (names, addresses, orders), the owner's laptop (admin login, accounting files) and the order inbox (shared e-mail address). An arrow labelled "you assess" leads to four steps on the right, done in the folder ~/risk-lab: step 1, assets and which CIA property matters most; step 2, match each threat to a weakness; step 3, the script risks.py that scores and ranks six risks; and step 4, choose preventive, detective and corrective controls.](../../../assets/diagrams/secfund-lab-architecture.svg)

*Figure 1. Steps 1, 2 and 4 are thinking exercises; step 3 runs one small script.*

## Steps

### Step 1 — List the assets (8 min)
**The scenario.** *Harbour Candles* is an invented online shop. The owner, Marta, makes candles at home and sells them through a website. One helper, Leo, packs orders. They have four assets:

| # | Asset |
|---|---|
| 1 | The web shop (where customers order) |
| 2 | The customer and order data (names, addresses, what they bought) |
| 3 | Marta's laptop (admin login to the shop, accounting files) |
| 4 | The order inbox (a shared e-mail address that receives order notifications) |

For each asset, decide which CIA property matters **most**: **C** (confidentiality), **I** (integrity) or **A** (availability). Write down your answer and a few words of reason. Try all four before opening the answers.

<details>
<summary>Show one good set of answers</summary>

| # | Asset | Most important | Why |
|---|---|---|---|
| 1 | Web shop | A | If the site is down, nobody can buy. |
| 2 | Customer and order data | C | A leak exposes customers' names and addresses and breaks data-protection rules. (Integrity matters too: wrong addresses mean lost parcels.) |
| 3 | Marta's laptop | C | It holds the admin login and the accounts; whoever gets it gets the shop. |
| 4 | Order inbox | I | If someone can forge or change notifications, Leo packs the wrong orders. (Availability also matters.) |

Several answers can be right if the reason is good. The point is to pick **one** property first, because that tells you which risk to worry about first.

</details>

### Step 2 — Match threats to weaknesses (8 min)
Remember: a **threat** is something that could cause harm, and a **vulnerability** is the weakness it uses. Here are four threats and four weaknesses of Harbour Candles, in mixed order.

| Threats | |
|---|---|
| T1 | A criminal sends a fake "your payment account is locked" e-mail to Leo |
| T2 | Someone finds a web address and downloads the files behind it |
| T3 | A thief takes Marta's bag in a café |
| T4 | The hosting company has a technical fault |

| Weaknesses | |
|---|---|
| W1 | The shop has no backup site and no plan for an outage |
| W2 | Marta's laptop disk isn't encrypted |
| W3 | The admin login has no second step (no multi-factor authentication) |
| W4 | The online storage holding the customer file was left set to "public" |

Write the four pairs, for example `T1 - W?`. Try before opening the answers.

<details>
<summary>Show the answers</summary>

| Threat | Weakness | Why they go together |
|---|---|---|
| T1 | W3 | A stolen password is enough to get in, because there is no second step to stop the criminal. |
| T2 | W4 | The files are public, so anyone who finds the address can download them. |
| T3 | W2 | Without disk encryption, the thief can read the files on the stolen laptop. |
| T4 | W1 | With no backup or plan, a fault at the host means the shop is offline until it is fixed. |

Notice that the weaknesses are things Marta can fix. The threats mostly aren't: criminals, thieves and faults will exist whatever she does. This is why security work focuses on weaknesses and impact.

</details>

### Step 3 — Score the risks with a script (12 min)
Now give each risk two scores from 1 (lowest) to 5 (highest): **likelihood** (how probable this year) and **impact** (how bad if it happens). The script multiplies them and sorts the list. The scores below are invented judgements, as in the lesson.

Create a folder and the script:

```bash
mkdir ~/risk-lab
cd ~/risk-lab
cat > risks.py <<'EOF'
# A tiny risk register for Harbour Candles (an invented shop).
# Each risk: (description, likelihood 1-5, impact 1-5).
risks = [
    ("Staff member falls for a phishing e-mail and gives away the admin password", 4, 4),
    ("Customer data exposed because online storage was left public", 3, 5),
    ("Ransomware locks the files on the owner's laptop", 2, 5),
    ("Hosting provider outage takes the shop offline for a day", 3, 3),
    ("Owner's laptop is lost or stolen with an unencrypted disk", 3, 4),
    ("A former freelancer's account still works", 2, 3),
]

def band(score):
    if score >= 15:
        return "HIGH"
    if score >= 8:
        return "MEDIUM"
    return "LOW"

register = sorted(risks, key=lambda r: r[1] * r[2], reverse=True)
for description, likelihood, impact in register:
    score = likelihood * impact
    print(f"{score:>2}  {band(score):<6}  {likelihood} x {impact}  {description}")
EOF
python3 risks.py
```

Expected output:
```text
16  HIGH    4 x 4  Staff member falls for a phishing e-mail and gives away the admin password
15  HIGH    3 x 5  Customer data exposed because online storage was left public
12  MEDIUM  3 x 4  Owner's laptop is lost or stolen with an unencrypted disk
10  MEDIUM  2 x 5  Ransomware locks the files on the owner's laptop
 9  MEDIUM  3 x 3  Hosting provider outage takes the shop offline for a day
 6  LOW     2 x 3  A former freelancer's account still works
```

How to read a line: the first number is the **score** (likelihood × impact), then the **band**, then the two numbers that made the score, then the risk. The list is sorted so the biggest risk is first. The bands are the ones from the lesson: 15 or more is high, 8 to 14 is medium and below 8 is low.

Notice two things. The ransomware risk has the highest impact (5) but scores only 10 because it is judged unlikely (2). And the phishing risk tops the list because it is both likely and costly.

**Change one value and predict.** Marta runs a short training session on spotting phishing, so a successful phishing attack becomes less likely. Before running anything, guess: will phishing stay at the top?

Open `risks.py` in your text editor and change the first risk from `4, 4` to `2, 4`:

```text
    ("Staff member falls for a phishing e-mail and gives away the admin password", 2, 4),
```

Save the file and run it again:

```bash
python3 risks.py
```

Expected output:
```text
15  HIGH    3 x 5  Customer data exposed because online storage was left public
12  MEDIUM  3 x 4  Owner's laptop is lost or stolen with an unencrypted disk
10  MEDIUM  2 x 5  Ransomware locks the files on the owner's laptop
 9  MEDIUM  3 x 3  Hosting provider outage takes the shop offline for a day
 8  MEDIUM  2 x 4  Staff member falls for a phishing e-mail and gives away the admin password
 6  LOW     2 x 3  A former freelancer's account still works
```

Phishing falls from 16 (high) to 8 (medium), and the public storage risk becomes the top one. A control that lowers likelihood moves a risk down the list. That is how a register shows whether your work is paying off. Put the value back to `4, 4` before the next step.

### Step 4 — Choose a control for the top three (7 min)
Use the first run, where the top three were the phishing risk, the public-storage risk and the laptop risk. For each one, pick **one control** and say whether it is **preventive**, **detective** or **corrective**. Aim for a different purpose for each of the three risks if you can.

<details>
<summary>Show one good set of answers</summary>

| Risk | Control | Purpose | Type |
|---|---|---|---|
| Phishing gives away the admin password | Turn on multi-factor authentication (MFA) for the admin login, so a stolen password isn't enough | Preventive | Technical |
| Customer data exposed by public storage | Send an alert, or run a regular check, that warns when storage is set to public | Detective | Technical |
| Laptop lost or stolen | Enable disk encryption, and be able to remotely lock the laptop and change the admin password | Preventive (encryption) and corrective (lock, reset) | Technical and administrative |

Other controls are fine if they fit. For example, a **corrective** answer for phishing would be a written plan: reset the password, check recent orders, and tell affected customers. A **preventive** answer for public storage would be to make "private" the default and to review who may change it. A good plan has all three purposes, because prevention alone isn't enough.

</details>

## Verification
Put the first risk back to `4, 4`, save, and run the script once more:

```bash
python3 risks.py
```

You pass if:
- the first line is `16  HIGH    4 x 4  Staff member falls for a phishing e-mail ...`;
- the last line is `6  LOW     2 x 3  A former freelancer's account still works`;
- you wrote down an answer (even a wrong one) for every question in steps 1, 2 and 4, and checked it against the answers.

## Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| `python3: command not found` | Python isn't installed, or it is called `python` | Install Python 3.9 or later; on Windows, use WSL2 or install it from python.org and run `python` instead of `python3` |
| `SyntaxError` or `IndentationError` | A line lost its spaces at the start, or part of the block wasn't pasted | Delete `risks.py` and run the whole Step 3 block again |
| `mkdir: cannot create directory ... File exists` | You already ran Step 3 once | Fine: run `cd ~/risk-lab` and continue |
| Your output differs from the lab | A score is still changed from the original | Check that the first risk reads `4, 4` and that the others match the block above |

## Challenge (optional)
1. Add a seventh risk of your own to the `risks` list, for example "A customer's card details are stolen from the shop". Score it, run the script and see where it lands.
2. Imagine Marta also turns on MFA and moves the data to private storage. Lower the likelihood of the two top risks and run the script. Does the order change? What is the new top risk?

## Cleanup
The lab created one folder in your home directory and nothing else. Remove it:

```bash
cd ~
rm -r ~/risk-lab
```

## What you learned
- Every asset has one property that matters most (confidentiality, integrity or availability), and that guides where to look for risk.
- A threat is something that could cause harm; a vulnerability is the weakness it uses. You usually can't remove the threat, but you can fix the weakness.
- Likelihood × impact gives a score that lets you rank risks and put the biggest first. Lowering one number moves a risk down the list.
- A good set of controls mixes preventive, detective and corrective ones.
