SyntaxPilot
Courses/Cybersecurity Fundamentals/Lesson 1

Cybersecurity Fundamentals · Lesson 1 of 90 · 13 min

What cybersecurity is: assets, threats, vulnerabilities and risk

cybersecurity vs information securityassetthreatthreat actorvulnerabilityexploit (concept)risk = likelihood x impactattack surfaceattack vectorsecurity controlcountermeasuredefender's dilemmared teamblue team

These are the notes for Cybersecurity Fundamentals (defensive), episode 1. We start from absolute zero. No security background and only a little Python is needed. We invent the language of security ourselves, one problem at a time: what we protect (assets), what could go wrong (threats, threat actors), the weak spots (vulnerabilities) and how they get used (exploits, as an idea only), how to decide what to fix first (risk = likelihood × impact), all the ways in (attack surface, attack vector, the defender's dilemma), a real bug in a toy program and its fix (security controls, countermeasures), how organisations test their defences (red, blue and purple teams), and the rule this whole course stands on: only with permission. Every word is explained the first time it appears, and the Glossary at the end defines all of them again with an example. Every code sample runs as-is; the outputs shown are real (Python 3).

This is a defender's course. We learn how attacks work as ideas so we can stop them. We only ever "attack" small toy programs we write ourselves, on our own machine.

The problems you'll solve

Problem What it teaches
What are we even protecting? Asset, threat, threat actor, vulnerability, exploit; information security vs cybersecurity
You can't lock everything Likelihood, impact, risk = likelihood × impact, the risk register
So many ways in Attack surface, attack vector, the defender's dilemma, reducing the attack surface
A bug in a chai shop Trusting input; security control, countermeasure; preventive, detective, corrective controls
Do the defences work? Red team, blue team, purple team
Where's the line? Ethics, authorisation, scope, India's IT Act 2000 (sections 43 and 66)

Problem 1: what are we even protecting?

Look at your phone. Photos, family chats, your UPI (Unified Payments Interface) payment app, email. What's on it is worth far more than the phone itself. One morning a message arrives: "Your KYC is expiring, tap this link." (KYC, "know your customer", is the identity check banks do.) Someone wants what's on your phone. And an old app you never updated has a known weak spot.

To defend anything, we first need names for its parts. A house explains them:

Your house In security Meaning
Gold, cash, documents Asset Anything of value: data, devices, money, reputation, even people's time
A burglar Threat actor The person or group behind an attack
"A break-in could happen" Threat Anything that could cause harm to an asset (a flood is a threat with no actor)
A broken window latch Vulnerability A weakness a threat can use
Lifting the broken latch Exploit (concept) A method, or piece of code, that uses a vulnerability to do something the owner never allowed

Put together:

threat actor  --uses-->  exploit  --through-->  vulnerability  --harms-->  asset
 (who)                    (how)                  (weak spot)                (what we protect)

We study exploits only as ideas, so we can close the weak spots. We never build working exploits for real software.

Information security vs cybersecurity

Information security Cybersecurity
Protects information in any form Protects the digital world: computers, phones, networks, apps, cloud, and their data
A paper file in a locked cupboard, a printed salary slip, what you say on a phone call, and everything digital Your UPI app, a company's servers, your home Wi-Fi
The bigger circle Mostly the digital part of information security

This course is about cybersecurity, but the ideas (assets, threats, risk) apply to both.

Problem 2: you can't lock everything (risk)

You have ₹1,000 to spend on security this month and a list of twenty worries: phone theft, fire, scam calls, a lost key. The obvious attempt is to spend ₹50 on each. ₹50 buys nothing useful, so every worry gets a little protection and none is really protected. Spreading money equally fails. We need a way to rank worries.

A family asks two questions:

  • Likelihood: how probable is the bad event? Phones get stolen on crowded trains a lot.
  • Impact: how much harm if it happens? Losing your savings is far worse than losing an umbrella.

Combine the two and you get risk. A simple way to score it:

risk = likelihood × impact        (each scored 1 to 5, so risk is 1 to 25)

The US standards body NIST (National Institute of Standards and Technology) describes risk the same way: a measure of how much you are threatened by a possible event, depending on the harm it would cause and how likely it is to happen (NIST SP 800-30 Rev. 1, via the NIST CSRC glossary).

Demo 1: a risk register in Python

A risk register is a table of risks with their scores, so the biggest ones get fixed first.

# a risk register: score = likelihood x impact (1 to 5)
risks = [
    ("phone stolen on a local train", 4, 3),
    ("laptop disk dies, no backup",   2, 5),
    ("bank OTP shared on a fake call", 3, 5),
    ("neighbour sees your Wi-Fi name", 5, 1),
]

for name, likelihood, impact in risks:
    print(likelihood * impact, name)

Output:

12 phone stolen on a local train
10 laptop disk dies, no backup
15 bank OTP shared on a fake call
5 neighbour sees your Wi-Fi name

Right scores, but in the order we typed them. With twenty rows you'd still hunt for the biggest.

Demo 1b: sort by risk, biggest first

# a risk register: score = likelihood x impact (1 to 5)
risks = [
    ("phone stolen on a local train", 4, 3),
    ("laptop disk dies, no backup",   2, 5),
    ("bank OTP shared on a fake call", 3, 5),
    ("neighbour sees your Wi-Fi name", 5, 1),
]

def score(r):
    return r[1] * r[2]          # likelihood x impact

for name, like, imp in sorted(risks, key=score, reverse=True):
    print(f"{like} x {imp} = {like * imp:>2}  {name}")

Output:

3 x 5 = 15  bank OTP shared on a fake call
4 x 3 = 12  phone stolen on a local train
2 x 5 = 10  laptop disk dies, no backup
5 x 1 =  5  neighbour sees your Wi-Fi name

sorted(..., key=score, reverse=True) sorts using our score function, largest first. The OTP scam (one-time password, the code your bank texts you) goes to the top: fix it first (never share an OTP, ever). The Wi-Fi name is seen often but harmless, so it goes last.

Insight: risk needs both a threat and a vulnerability. No threat, or no weakness, means no risk. A broken latch on a house on the Moon is no risk at all.

Problem 3: so many ways in (attack surface)

Your house In security Meaning
Doors, windows, balcony, terrace Attack surface All the points where an attacker could try to get in or pull data out
Climb the pipe, in through the bathroom window Attack vector The path or method one attack uses (for your phone: a scam link in a message)
Brick up the unused window Reducing the attack surface Turning off features, apps, accounts and services you don't need

Demo 2: the defender's dilemma

A dictionary in Python is a set of name: value pairs.

# every way into the house, and its state
doors = {
    "front door":      "locked",
    "back door":       "locked",
    "kitchen window":  "locked",
    "balcony":         "locked",
    "bathroom window": "open",
    "terrace":         "locked",
}

# the defender must lock ALL of them
locked = [d for d, s in doors.items() if s == "locked"]
print(f"defender locked {len(locked)} of {len(doors)}")

# the attacker needs just ONE
for door, state in doors.items():
    if state == "open":
        print("attacker gets in through:", door)

Output:

defender locked 5 of 6
attacker gets in through: bathroom window

5 of 6 is 83%, a great exam score, and in security it's a fail. This is the defender's dilemma: the defender must protect every point, every day; the attacker needs to find one gap, once.

Demo 2b: shrink the attack surface

# brick up what nobody uses: a smaller attack surface
doors = {
    "front door":      "locked",
    "back door":       "locked",
    "kitchen window":  "locked",
}

print("entry points:", len(doors))
locked = [d for d, s in doors.items() if s == "locked"]
print(f"defender locked {len(locked)} of {len(doors)}")

for door, state in doors.items():
    if state == "open":
        print("attacker gets in through:", door)

Output:

entry points: 3
defender locked 3 of 3

No attacker line at all. A smaller attack surface is easier to defend completely. On your phone: delete apps you don't use, turn off Bluetooth when you don't need it, remove old accounts.

Problem 4: a bug in a chai shop (security controls)

A chai shop bills with a tiny program: ₹50 a cup, bill = 50 × qty. A customer types -4 into the quantity box, and the shop ends up paying him ₹200. This is our own toy program, run only on our own machine.

Demo 3: the vulnerable version

# a toy chai-shop bill (runs only on our machine)
PRICE = 50      # rupees per cup
till = 0        # money in the shop's cash box

def buy(qty):
    global till
    bill = PRICE * qty
    till = till + bill
    print(f"bought {qty}, bill {bill}, till {till}")

buy(2)      # a normal customer
buy(-4)     # an input nobody planned for

Output:

bought 2, bill 100, till 100
bought -4, bill -200, till -100

Why it failed: the program trusted its input. Nobody said a quantity must be positive. That missing check is the vulnerability; typing -4 is the exploit in its simplest form. (global till lets the function change the till variable defined outside it.)

Demo 3b: the fixed version (a security control)

# the same shop, with a security control
PRICE = 50
till = 0

def buy(qty):
    global till
    if not 1 <= qty <= 20:    # control: only 1 to 20
        print(f"rejected: qty {qty}")
        return
    bill = PRICE * qty
    till = till + bill
    print(f"bought {qty}, bill {bill}, till {till}")

buy(2)
buy(-4)
buy(500)

Output:

bought 2, bill 100, till 100
rejected: qty -4
rejected: qty 500

Checking that input is allowed before using it is called input validation. Notice we listed what is allowed (1 to 20) instead of trying to list every bad value: that's called an allowlist, and it's much safer.

Demo 3c: input that isn't even a number

# a customer types the quantity as a word
PRICE = 50

typed = "four"          # what came from the keyboard
qty = int(typed)        # text -> number
print("bill:", PRICE * qty)

Output (the program crashes):

Traceback (most recent call last):
  File "main.py", line 5, in <module>
    qty = int(typed)        # text -> number
ValueError: invalid literal for int() with base 10: 'four'

A crashed till can't bill anyone, so handling bad input safely is a security job too. Episode 2 fixes this with try / except.

Controls and countermeasures

  • A security control is any safeguard that lowers risk: a lock, a password, a check in code, a rule, a training session.
  • A countermeasure is a control aimed at one specific threat or weakness. Our 1 <= qty <= 20 check is a countermeasure against the -4 trick. In practice people often use the two words for the same thing.

Controls come in kinds:

Kind What it does House Computer
Preventive Stops the attack A lock Input validation, a password
Detective Notices the attack A CCTV camera A log and an alert
Corrective Repairs the damage Insurance, a spare key A backup you can restore

Every control cuts the likelihood, the impact, or both, so it lowers the risk score.

Problem 5: do the defences work? (red, blue, purple)

Cricket nets explain it:

Cricket nets In security Meaning
Your own bowlers bowl the hardest balls they can Red team A group of people authorised and organised to act like a real attacker, to test the defences
The batter defends every ball Blue team The defenders who run, watch and protect the systems every day
The coach watches both: "you keep missing the short ball" Purple team Red and blue working together, sharing what they found, to improve (red + blue = purple)

The NIST glossary (from NISTIR 7622) defines a red team as "a group of people authorized and organized to emulate a potential adversary's attack or exploitation capabilities", and a blue team as "the group responsible for defending an enterprise's use of information systems by maintaining its security posture". Note the word authorized.

Problem 6: where's the line? (ethics and the law)

A locksmith knows exactly how locks open, and opens a door only for its owner, with proof. Opening a stranger's door is a crime, with the same skill. Security is the same:

  • Authorisation: written permission from the owner of the system before you test anything.
  • Scope: the exact list of what you may test, how, and when. Anything outside the scope is off-limits, even with permission for the rest.
  • The law (India): the Information Technology Act, 2000. Under section 43, accessing a computer without the permission of its owner or the person in charge makes you liable to pay compensation to the person affected. Under section 66, doing it dishonestly or fraudulently is punishable with imprisonment of up to three years, a fine of up to ₹5 lakh, or both. Other countries have similar laws.

The rules of this course:

  1. We only attack our own toy programs, written in the video, run on our own machine.
  2. In real life, test only systems you own or have written permission (and a scope) to test.
  3. We learn each attack as an idea, then build the defence for real.
  4. Found a weak spot in someone's app? Report it to them privately (episode 8 covers how: coordinated disclosure).

Good intentions are not permission.

Common mistakes (and what really happens)

Mistake What happens (real output) Why Fix
buy(-4) with no input check bought -4, bill -200, till -100 The program trusted the input Validate with an allowlist: 1 <= qty <= 20
qty = int("four") ValueError: invalid literal for int() with base 10: 'four' Unexpected input crashes the program Check or handle bad input (try/except, episode 2)
"5 of 6 doors locked is fine" attacker gets in through: bathroom window The defender's dilemma: one gap is enough Shrink the attack surface, then lock every remaining point
Spreading the budget equally Every risk half-protected Risks differ in likelihood and impact Score risks and fix the top of the register first
"I'll just test my college's website" Unauthorised access under IT Act 2000, s.43 / s.66 Good intentions are not permission Get written permission and a scope first
"Nobody would target me" Scams are automated and sent to millions Attackers target weakness, not fame Treat your own accounts as assets worth protecting

Mini project: your personal risk register

Build a risk register for your own digital life with at least six risks. Give each a likelihood and impact from 1 to 5, add the control you'll use, and print the risks sorted by score. Then print the score after the control (a control lowers likelihood, impact, or both).

# personal risk register: before and after a control
risks = [
    # name, likelihood, impact, control, new_likelihood, new_impact
    ("OTP shared on a scam call", 3, 5, "never share OTPs", 1, 5),
    ("phone stolen", 4, 3, "screen lock + find-my-phone", 4, 1),
    ("laptop disk dies", 2, 5, "weekly backup", 2, 1),
    ("reused password leaks", 4, 4, "password manager", 1, 4),
]

for name, l, i, control, nl, ni in sorted(risks, key=lambda r: r[1] * r[2], reverse=True):
    print(f"{l * i:>2} -> {nl * ni:>2}  {name}  [{control}]")

Output:

16 ->  4  reused password leaks  [password manager]
15 ->  5  OTP shared on a scam call  [never share OTPs]
12 ->  4  phone stolen  [screen lock + find-my-phone]
10 ->  2  laptop disk dies  [weekly backup]

Notice how each control attacks a different part: the backup doesn't make the disk less likely to die (likelihood stays 2), it makes the loss small (impact 5 → 1). A screen lock doesn't stop theft, it makes theft less harmful.

Practice

  1. Classify each as asset, threat, threat actor, vulnerability or exploit: (a) your college ID card; (b) a scammer posing as a bank officer; (c) a phone that hasn't had an update in two years; (d) a heavy monsoon flood; (e) tricking someone into reading out an OTP.
  2. A risk has likelihood 2 and impact 5. Another has likelihood 5 and impact 2. Which do you fix first?
  3. Add a tie-breaker to Demo 1b: when two risks have the same score, put the higher impact first.
  4. Name the kind of control (preventive, detective, corrective): (a) a backup; (b) an alert when someone logs in from a new country; (c) a strong password.
  5. Is a flood a threat? Does it have a threat actor?
Solutions
  1. (a) asset; (b) threat actor; (c) vulnerability; (d) threat (with no actor); (e) exploit, of a human weakness (we'll call it social engineering in episode 6).
  2. Both score 10. Look at what the score hides: the impact-5 risk can be catastrophic even if rare. Many teams break ties on impact, so fix the first one first (or both, if cheap).
  3. Sort by a pair: Python compares tuples one item at a time.
risks = [
    ("A: rare but terrible", 2, 5),
    ("B: often but small",   5, 2),
    ("C: middle",            3, 3),
]

def score(r):
    return (r[1] * r[2], r[2])     # risk first, then impact

for name, like, imp in sorted(risks, key=score, reverse=True):
    print(f"{like * imp:>2} (impact {imp})  {name}")

Output:

10 (impact 5)  A: rare but terrible
10 (impact 2)  B: often but small
 9 (impact 3)  C: middle
  1. (a) corrective; (b) detective; (c) preventive.
  2. Yes, a flood can harm assets (servers, paper files), so it's a threat. It has no threat actor: not every threat is a person.

Quick quiz

A scammer sends a fake KYC link. Your old banking app was never updated and has a known bug. Your savings sit in that app. Which one is the vulnerability?

A. the scammer · B. the unpatched old app · C. your savings · D. the fake link

Answer

B, the unpatched old app. It's the weakness. The scammer is the threat actor, your savings are the asset, and the fake link is the attack vector.

Interview questions

  1. What's the difference between a threat, a vulnerability and a risk? A threat is something that could cause harm; a vulnerability is a weakness it could use; risk is how much you should worry, combining the likelihood of the threat using the weakness and the impact if it does.
  2. What is an attack surface and how do you reduce it? All the points where an attacker could get in or pull data out. Reduce it by removing unused features, services, ports, accounts and apps, and by limiting who can reach what.
  3. Explain the defender's dilemma. Defenders must protect every entry point all the time; an attacker needs one gap once. That's why we shrink the attack surface, use layers, and also invest in detection.
  4. Control vs countermeasure? A control is any safeguard that lowers risk; a countermeasure is a control aimed at a specific threat or vulnerability. Controls can be preventive, detective or corrective.
  5. Red team vs blue team vs purple team? Red: authorised people emulating attackers to test defences. Blue: the defenders. Purple: the two working together and sharing findings to improve.
  6. Is it OK to test a website for weaknesses if you mean well? No. Only with written authorisation and a defined scope. Unauthorised access is illegal (in India, IT Act 2000 sections 43 and 66).
  7. Cybersecurity vs information security? Information security protects information in any form, including paper and speech; cybersecurity focuses on digital systems, networks and the data in them.

Glossary

Term Meaning in plain words Example
Cybersecurity Protecting computers, phones, networks, apps and their data from harm Keeping your UPI app and bank account safe
Information security Protecting information in any form: digital, paper or spoken A locked cupboard of paper files; not reading a salary slip aloud
Asset Anything of value that needs protecting Your savings, photos, a company's customer list, its reputation
Threat Anything that could cause harm to an asset Theft, a scam call, a flood, a disk failure
Threat actor The person or group behind an attack A scammer, a burglar, a criminal gang
Vulnerability A weakness that a threat can use An app with a known bug, a weak password, the missing quantity check
Exploit (concept) A method or piece of code that uses a vulnerability to do something the owner never allowed Typing -4 into the toy chai shop; lifting a broken latch
Likelihood How probable a bad event is Phone theft on a crowded train: high
Impact How much harm a bad event causes if it happens Losing all your savings: very high
Risk How much to worry about something, combining likelihood and impact risk = likelihood × impact = 3 × 5 = 15
Risk register A table of risks with their scores, ranked Demo 1b's sorted list
Attack surface All the points where an attacker could try to get in or pull data out All six doors and windows; all the apps on your phone
Attack vector The path or method one particular attack uses The bathroom window; a scam link in a message
Reducing the attack surface Removing what you don't need so there's less to defend Deleting unused apps; bricking up a window
Defender's dilemma Defenders must protect everything, attackers need one gap 5 of 6 doors locked, burgled through the 6th
Security control Any safeguard that lowers risk A lock, a password, if not 1 <= qty <= 20
Countermeasure A control aimed at one specific threat or weakness The quantity check against the -4 trick
Preventive / detective / corrective control Stops an attack / notices it / repairs the damage A lock / CCTV / a backup
Input validation Checking input is allowed before using it Rejecting a quantity outside 1 to 20
Allowlist A list of what is allowed; everything else is rejected "1 to 20 cups only"
Red team Authorised people who act like attackers to test defences Your own bowlers in the nets
Blue team The defenders who run and protect the systems The batter
Purple team Red and blue working together to improve The coach sharing what both learned
Authorisation (for testing) Written permission from a system's owner to test it A signed letter from the company
Scope The exact list of what you may test, how and when "Only test.example.com, only this weekend"
IT Act 2000 (India) India's main law on computer crime; sections 43 and 66 cover unauthorised access Accessing someone's account without permission
OTP One-time password: a short code that works once The 6-digit code your bank texts you
UPI Unified Payments Interface, India's instant payment system Paying a shop by scanning a QR code
KYC "Know your customer": the identity check banks do A bank asking for your PAN and Aadhaar

Summary

  • An asset is what we protect; a threat is what could harm it; a threat actor is who's behind it; a vulnerability is the weak spot; an exploit is how a weak spot gets used (we study exploits only as ideas).
  • Information security protects information in any form; cybersecurity is its digital part.
  • Risk = likelihood × impact. Rank risks in a risk register and fix the top first. No threat or no vulnerability means no risk.
  • The attack surface is every way in; an attack vector is one route. Because of the defender's dilemma, shrink the surface, then protect everything left.
  • Never trust input. A security control (like input validation with an allowlist) lowers risk; a countermeasure targets one specific threat. Controls are preventive, detective or corrective.
  • Red teams attack (with permission), blue teams defend, purple teaming joins them.
  • Only with permission and a scope. Unauthorised access is a crime (India: IT Act 2000, sections 43 and 66).

Next episode: the CIA triad and beyond: confidentiality, integrity, availability, authenticity, non-repudiation, AAA, and the trade-offs between them.

Sources: NIST CSRC glossary entries "risk" (NIST SP 800-30 Rev. 1) and "Red Team/Blue Team Approach" (NISTIR 7622); Conventus Law, "Cybersecurity Laws and Regulations India 2025" (IT Act 2000, sections 43 and 66). Fetched 27 Oct 2026.