Skip to content
Tutorials Center
My learning

Topics

Lesson 4 of 80 ยท Security Foundations

Threats, Vulnerabilities and Risk

Understand assets, threat actors, vulnerabilities, exploits and risk (likelihood times impact), and build a simple risk-score calculator in Python.

"Is this system secure?" is a bad question, because the honest answer is always "against whom, and for what?" Security work becomes practical when you replace it with better questions: what do we have, who might want it, what weaknesses could they use, and how bad would it be? The words for those ideas are asset, threat, vulnerability, exploit and risk. People mix them up constantly, so it is worth getting them straight.

In this lesson you will learn the vocabulary, meet the usual types of threat actors, see how likelihood and impact combine into a risk score, and build a small risk register in Python that ranks problems so you can decide what to fix first. It builds on The CIA Triad and Core Principles.

The vocabulary

Term Meaning Example
Asset Anything of value to protect Customer database
Threat A potential cause of harm A criminal group that sells stolen data
Threat actor The person or group behind a threat Ransomware gang, insider
Vulnerability A weakness that could be used to cause harm Unpatched web server, weak password
Exploit A method or tool that takes advantage of a vulnerability Code that abuses the unpatched server
Attack An attempt to cause harm, usually using an exploit The actual break-in attempt
Control (countermeasure) Something that reduces risk Patching, MFA, backups
Risk Chance of a bad outcome combined with how bad it would be "Customer data stolen via the unpatched server"

A useful sentence ties them together: a threat actor uses an exploit against a vulnerability to harm an asset, and controls reduce the chance or the damage.

flowchart LR
    TA["Threat actor"] -->|"uses"| EX["Exploit"]
    EX -->|"targets"| VU["Vulnerability"]
    VU -->|"is a weakness in"| AS["Asset"]
    CO["Controls"] -.->|"close or reduce"| VU
    CO -.->|"limit damage to"| AS

Remove any link in this chain, by fixing the weakness, blocking the exploit or protecting the asset, and the risk drops.

A vulnerability with no threat actor interested in it is a low risk. A powerful threat actor with nothing to exploit is also low risk. Risk lives where all of the pieces meet.

Who are the threat actors?

Defenses depend on who you expect. A small online shop does not face the same attackers as a defense contractor.

  • Opportunistic criminals and scripters: scan the whole internet for known bugs and default passwords. Low skill, huge volume. Most breaches of small organizations come from these.
  • Organized cybercrime: ransomware gangs, fraud rings, credential sellers. Money is the motive, and they behave like businesses with support desks and affiliates.
  • Insiders: employees, contractors or former staff. They may be malicious, but more often they make honest mistakes: sending a file to the wrong person, misconfiguring a storage bucket, falling for phishing.
  • Nation-state actors: well-funded, patient, interested in espionage or disruption. They use advanced techniques, but also plain phishing when it works.
  • Hacktivists: motivated by a cause; defacements, leaks and denial-of-service are typical.
  • Competitors and researchers: industrial espionage at one end, well-meaning security researchers at the other.

Not all threats are human. Natural disasters, power failures, hardware faults and software bugs threaten availability just as surely, and a good risk assessment includes them.

Vulnerabilities come in kinds

Vulnerabilities are not only software bugs.

  • Software flaws: injection bugs, memory errors, logic mistakes (see The OWASP Top 10).
  • Configuration weaknesses: default passwords, open ports, public storage, debug mode left on.
  • Design weaknesses: a system that trusts the client, or has no rate limit on login.
  • Process weaknesses: nobody revokes leavers' accounts, backups are never tested.
  • Human factors: people reuse passwords or trust convincing emails.

Public catalogs help everyone talk about known software flaws. A CVE (Common Vulnerabilities and Exposures) identifier names a specific publicly known flaw, and the CVSS score rates its severity. You will use both in Vulnerability Management and Patching. A zero-day is a flaw the vendor does not yet know about (or has had no time to fix), which is why layered defenses matter even when you patch promptly.

Risk: likelihood times impact

The simplest and most widely used way to compare risks is:

TEXT
risk = likelihood x impact
  • Likelihood: how probable is it that the threat succeeds within a period? It depends on threat actor interest, how easy the vulnerability is to use, and existing controls.
  • Impact: how bad is it if it happens? Think money, downtime, legal penalties, safety, and reputation.

Organizations often use 1-5 scales for both and multiply them, giving a score from 1 to 25 that maps to bands such as Low, Medium, High and Critical. Quantitative methods use probabilities and money (for example, "a 10% yearly chance of a 200,000 dollar loss is an expected 20,000 dollars a year"), which helps compare a control's cost with the loss it prevents. Either way, the scores are estimates: their value is in forcing a conversation and a consistent ranking, not in false precision.

Python A risk register that ranks problems

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice that "Staff fall for phishing email" (likelihood 5) ranks below the unpatched server even though it is the most likely event, because the impact is judged smaller. If you disagree with a rating, that is the point: adjust it, rerun the code, and argue about the number instead of about gut feelings.

Responding to risk

Once you have ranked risks, there are four standard responses:

  1. Mitigate: add controls to reduce likelihood or impact (patch, enable MFA, encrypt disks).
  2. Transfer: shift the financial loss, for example with cyber insurance or by using a provider that takes on part of the responsibility.
  3. Avoid: stop doing the risky thing, such as retiring an old service.
  4. Accept: consciously live with it because the cost of reducing it is higher than the loss. The decision should be recorded and owned by someone with authority.

After controls are applied, some residual risk always remains. A good register records the risk before and after controls so you can see what each investment bought.

Python Residual risk and annual loss: is the control worth it?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The flood control costs more than it saves, so a rational owner might accept that risk or choose a cheaper control. These numbers are invented, and real estimates are rough, but the structure (before, after, cost) is exactly how security budgets are justified.

Emerging attack vectors

The threat picture changes as technology does. None of the vectors below is entirely new: each is an old goal (steal credentials, run code, stay hidden, get paid) delivered through a new technology. Knowing how they work lets you check whether your existing controls cover them.

AI-assisted attacks

Language and image models lower the cost of crafting attacks, in three main ways:

  • More convincing social engineering. Phishing emails with perfect grammar in any language, tailored to the target's job and recent activity, replace the clumsy mass mailings that used to be easy to spot (Phishing and Social Engineering).
  • Faster reconnaissance and tooling. Models can summarize public information about a company, help write or adapt scripts, and explain vulnerabilities, so less-skilled attackers can do more. Defenders get the same help in triage and code review.
  • Attacks on AI systems themselves. Prompt injection hides instructions in data that a model reads (a web page, document or email), trying to make an assistant leak information or take actions it was not asked to take. Related risks are data poisoning of training or retrieval data, exposure of confidential prompts and documents, and over-trusting model output. Defences: treat all external content as untrusted input, give assistants least privilege (no standing access to secrets or irreversible actions), require human confirmation for sensitive actions, filter and log tool calls, and validate output before using it (Input Validation and Sanitization).

Deepfakes and voice cloning

Synthetic audio, video and images can imitate a manager, a family member or a public figure. A real-world pattern is the fake urgent request: a voice call or video meeting "from the chief executive" asking an employee to transfer money or share credentials. Because you cannot rely on how a person looks or sounds, rely on process: verify through a second, known channel (call back on a number from the company directory), require two approvals for payments and changes of bank details, agree on code words for family and executives, and train staff that urgency plus secrecy is the red flag. Technical aids (provenance and watermark checks, detection tools) help but are not reliable on their own. See also Personal Cybersecurity Hygiene.

Fileless malware and living off the land

Traditional antivirus looks for malicious files. Fileless attacks avoid leaving new files on disk: they run code in memory, or abuse tools already on the machine (PowerShell, WMI, scheduled tasks, scripting hosts and administrative utilities), which is called living off the land. Because these programs are legitimate, blocking them is not an option, and detection has to focus on behaviour: unusual parent and child processes (a document opening a command shell), long or encoded command lines, and rare use of administrative tools (Detecting Malicious Behavior). Defences are endpoint detection and response (EDR), script logging, application allow-listing, restricting macros and scripting for ordinary users, and least privilege.

Python Score process events for living-off-the-land behaviour

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Encoding is not encryption: analysts decode it in seconds, and the combination (an Office program spawning a hidden, encoded shell) is far more suspicious than any single feature.

IoT and connected devices

Cameras, routers, printers, smart-home hubs, medical devices and industrial sensors are small computers with weak defaults: shared or default passwords, no automatic updates, exposed management interfaces, and vendors that stop supporting them. Compromised devices become botnet members (Botnets and Command-and-Control), proxies for attackers, or a foothold inside a network (Critical Infrastructure and ICS Security). Defend by keeping an inventory, changing default credentials, isolating devices on their own network segment, disabling unused services, applying firmware updates, and buying from vendors with a published update policy.

Python Audit an IoT inventory for risky defaults

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Cloud and identity-centred attacks

As workloads moved to the cloud, attackers followed. The common causes are not exotic exploits but misconfiguration (public storage buckets, overly permissive roles, exposed management ports), stolen credentials and access tokens (including long-lived keys committed to code repositories), abuse of over-privileged service identities, and exploitation of internet-facing applications and APIs. Attackers also target session tokens and use MFA fatigue (repeated approval prompts) or adversary-in-the-middle phishing pages to bypass weaker MFA, which is one reason phishing-resistant passkeys are recommended (Multi-Factor Authentication and Passkeys). Defences are covered in Cloud and Container Security: least-privilege roles, configuration scanning, short-lived credentials, centralized logging, and alerts on unusual identity activity.

  • Supply-chain attacks on build systems, packages and software updates (Dependency and Supply Chain Security).
  • QR-code phishing ("quishing") that moves the malicious link away from email scanners to a phone camera.
  • Ransomware with data theft and extortion, and attacks on backups.
  • Attacks on identity providers and help desks, where a convincing call can reset an administrator's MFA.
  • Quantum computing: a future threat to today's public-key algorithms; data recorded now may be decrypted later, which is why the move to post-quantum cryptography has begun (Public-Key Cryptography).

Common mistakes

  • Treating every risk as equally urgent. Rank and fix in order.
  • Confusing vulnerability with risk. A critical bug on a system that holds nothing and is not reachable can be a lower priority than a medium bug on your payment system.
  • Ignoring likelihood of simple attacks. Credential stuffing and phishing are boring and effective.
  • Doing the assessment once. Systems, threats and staff change; risk registers need regular review.

The next lesson, Threat Modeling with STRIDE, shows a structured way to discover the threats and vulnerabilities before you score them.

Insider threats: three kinds

An insider is anyone with legitimate access: an employee, a contractor, a partner's engineer. Because they already hold valid credentials, perimeter defenses do not stop them. Security teams usually separate three types.

  • Intentional (malicious) insiders act on purpose, for money, revenge or ideology. They copy customer lists before resigning, sabotage systems after a dispute, or sell access.
  • Unintentional (negligent) insiders cause harm by accident: they email a spreadsheet to the wrong person, fall for a phishing message, lose a laptop or leave a cloud bucket public. This is by far the most common kind.
  • Moles are outsiders who obtain insider access under false pretenses, for example by being hired as a contractor, posing as a vendor, or befriending an employee. They look like insiders but work for someone else.

In 2023 a European newspaper reported that two former employees of a large car maker had leaked internal data about tens of thousands of staff to the press; the company said the data was misused and took legal action. Whatever the details, the lesson is stable: departing and disgruntled staff are a data-loss risk.

Warning signs include unusual download volume, access outside working hours or outside the person's role, use of personal cloud storage or removable media, repeated attempts to open files they have no need for, and resignation followed by sudden bulk copying.

Defenses combine least privilege, access reviews, prompt de-provisioning at exit, data-loss-prevention rules, logging of sensitive reads, separation of duties, and a culture where people can report mistakes without fear. Monitoring must be proportionate and legal: tell staff what is logged.

Zero-day exploits, APTs and threat intelligence

A zero-day is a flaw unknown to the vendor, so no patch exists ("zero days" to fix). Famous cases show the range: mobile spyware chains that compromised phones with no user action, the Dirty COW Linux kernel bug (CVE-2016-5195), a race condition that let local users gain write access to read-only memory and was present for years, and the Meltdown and Spectre CPU flaws disclosed in 2018, where speculative execution leaked data across security boundaries. Defenses are layered: least privilege, segmentation, exploit mitigations, fast patching once a fix appears, and behavior-based detection.

An advanced persistent threat (APT) is a well-resourced, usually state-linked group that targets one organization for a long time. Typical stages are initial access (often spear-phishing), establishing a foothold, broadening access with stolen credentials, quiet data collection and slow exfiltration. Signs include system slowdowns, odd outbound traffic at night and accounts used at unusual hours. Well-known publicly reported campaigns, such as the 2006-2013 activity researchers labeled APT1, Operation Aurora (2009), Operation Shady RAT (2006-2011), DarkHotel, APT28 (known as Fancy Bear) and APT33, are studied because their techniques repeat. Attribution in public reports is usually a judgment by vendors or governments, not courtroom proof.

Cyber threat intelligence (CTI) turns raw data into decisions. Its lifecycle is direction (what do we need to know?), collection, processing, analysis, dissemination to the right audience, and feedback. The common types are strategic (long-term trends for executives), operational (campaigns and attacker intent), tactical (techniques, mapped to MITRE ATT&CK) and technical (indicators of compromise: hashes, IPs, domains). Use sources you trust, share with ISACs, and always turn intelligence into a concrete action such as a detection rule.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which statement correctly separates a vulnerability from a threat?

    A vulnerability is a weakness in an asset or process. A threat is something (often a threat actor) that could cause harm, including by exploiting that weakness.
  2. 2. In the 1-5 model, a risk has likelihood 4 and impact 3. What is its score?

    Risk = likelihood x impact, so 4 x 3 = 12, which falls in the HIGH band used in this lesson.
  3. 3. A team chooses to stop running an unused, outdated service. Which risk response is this?

    Removing the activity that creates the risk is avoidance. Mitigation would keep the service and add controls.
  4. 4. What is residual risk?

    Controls rarely remove risk completely. The leftover, residual risk is what the owner must accept or reduce further.

Summary

  • Asset, threat, vulnerability, exploit, control and risk are different things; risk is where they meet.
  • Threat actors range from opportunistic scanners and criminal groups to insiders and nation-states; non-human hazards count too.
  • Vulnerabilities include code flaws, misconfigurations, design flaws, weak processes and human factors.
  • Risk = likelihood x impact; rank risks, then mitigate, transfer, avoid or accept, and track residual risk.
  • Numbers are estimates: use them to compare and decide, not to pretend certainty.

Next: Threat Modeling with STRIDE