Cybersecurity Intro
Cybersecurity is the practice of protecting computers, networks, programs and data from people who want to steal, change or break them. It covers everything from choosing a good password to designing how a bank's systems talk to each other.
This course takes a defensive point of view: you will learn how common attacks work, on small toy examples that run entirely inside your browser, so that you can recognise them and build the right defences. Nothing in this course touches a real network.
Note: Testing the security of a system you do not own, or have no written permission to test, is illegal in most countries. Every tool and technique mentioned here is only for systems you own or are explicitly authorised to test.
Track: this course is the on-ramp to the Cybersecurity track, sixteen in-depth courses from Security Foundations to Security Research, and most lessons here end with a pointer to the matching lesson there (the track map shows the order).
Why it matters
Almost every part of daily life now runs on software: payments, hospitals, power grids, school records, messaging. A single weakness can leak millions of records or stop a service for days. Security is therefore not a separate "add-on" but a quality of good software, like correctness or performance.
The vocabulary you will use all the time
| Term | Meaning | Example |
|---|---|---|
| Asset | Something of value you want to protect | Customer database, a laptop, a reputation |
| Vulnerability | A weakness that could be exploited | A login form that does not limit attempts |
| Threat | Something or someone that could exploit a weakness | A criminal group, a careless employee, a flood |
| Exploit | A concrete way to use a vulnerability | Using a leaked password list against that login form |
| Risk | The chance and impact of a threat using a vulnerability | "High: the database is reachable and unpatched" |
| Control | A measure that reduces risk | Rate limiting, encryption, backups, training |
A useful sentence to remember: a threat exploits a vulnerability in an asset, and controls reduce the resulting risk.
Here is that idea as a tiny Python model. Each asset has vulnerabilities, and each control fixes some of them:
assets = {
"web server": {"outdated software", "default admin password"},
"laptop": {"no disk encryption"},
"database": {"reachable from the internet"},
}
controls = {
"patching": {"outdated software"},
"password policy": {"default admin password"},
"full-disk encryption": {"no disk encryption"},
}
applied = ["patching", "password policy"]
fixed = set().union(*(controls[c] for c in applied))
for asset, weaknesses in assets.items():
remaining = sorted(weaknesses - fixed)
status = "OK" if not remaining else "AT RISK: " + ", ".join(remaining)
print(f"{asset:<12} {status}")web server OK
laptop AT RISK: no disk encryption
database AT RISK: reachable from the internet
Attackers and defenders
People who attack systems have very different goals and skills:
- Cyber criminals want money: ransomware, stolen card numbers, fraud.
- Hacktivists want attention for a cause: defacing sites, leaking documents.
- Nation-state groups want intelligence or disruption and have large budgets.
- Insiders already have access: an angry employee, or simply a careless one.
- Script kiddies use ready-made tools without understanding them.
Defenders are usually split into colours you will hear often:
| Team | Role |
|---|---|
| Red team | Authorised attackers who simulate real adversaries to find weaknesses |
| Blue team | Defenders who monitor, detect and respond |
| Purple team | Red and blue working together to improve detection |
Defence in depth
No single control is perfect, so good security stacks several independent layers. If a phishing email gets past the spam filter, multi-factor authentication may still stop the attacker; if that fails too, logging and alerts may catch them early. This idea is called defence in depth.
layers = [
("spam filter", 0.90),
("user training", 0.60),
("multi-factor auth", 0.95),
]
# Probability that one phishing attempt gets through every layer,
# assuming the layers fail independently.
chance = 1.0
for name, blocks in layers:
chance *= 1 - blocks
print(f"after {name:<18} {chance:.4f}")
print(f"1 in {round(1 / chance)} attempts succeeds")after spam filter 0.1000
after user training 0.0400
after multi-factor auth 0.0020
1 in 500 attempts succeeds
No layer alone is anywhere near perfect, yet together they make success rare. Real layers are not perfectly independent, but the principle holds.
What you will learn
- Basics: the CIA triad, risk, threats and threat modeling.
- Network security: how data moves, IP addresses, protocols, firewalls, segmentation and wireless security.
- Cryptography: encoding vs encryption, hashing, HMAC, password storage, AES, public-key crypto, signatures, certificates and TLS, using real Python libraries.
- Identity & access: multi-factor authentication, sessions and tokens, and access-control models.
- Web security: SQL injection, XSS, CSRF, input validation, the OWASP Top 10 and secure coding.
- Defence & operations: logging and detection, the SOC, incident response, vulnerability management, malware, phishing and backups.
- Cloud, privacy & careers: cloud basics, privacy law, ethics and responsible disclosure.
All examples use Python, because it is readable and has excellent security libraries. If you are new to Python, the Python course on this site covers everything you need.
Test yourself
A login form that allows unlimited password guesses is best described as a…
- threat
- vulnerability
- control
- asset
What does "defence in depth" mean?
- Using one very strong firewall
- Stacking several independent security layers
- Hiding the network deep inside a building
- Encrypting data twice
Which team is made of authorised attackers who simulate real adversaries?
- Blue team
- Red team
- Purple team
- Green team