Think in Threats, Paths, and Controls
Model attackers, assets, and trust boundaries so you can find the failures that matter before they become incidents.
By the end, you’ll be able to…
- Identify assets, threat actors, attack surfaces, and trust boundaries.
- Use the STRIDE model to generate concrete threats for a system.
- Prioritise controls using likelihood, impact, and least privilege.
- Explain defence in depth and assume-breach thinking.
01Start With What You Are Protecting
Threat modelling begins with an inventory, not a tool. List the assets that matter: customer records, payment credentials, source code, administrative access, the ability to send email, and the reputation of the organisation. For each asset, ask who should be able to use it, from where, and for what purpose.
Next, draw the system. Include users, browsers, APIs, databases, third-party services, administrators, build pipelines, and backups. Mark every place where data or authority crosses a boundary: browser to web server, web server to database, employee laptop to production, application to payment provider. These trust boundaries are where assumptions change, and most serious vulnerabilities live at the seams.
Finally, name the adversaries. A bored opportunist scanning the internet behaves differently from a organised criminal group, a malicious insider, or a nation-state actor. You do not need to defend every asset against every adversary equally. You need a defensible decision about which threats are realistic and which controls are proportionate.
02Map the Attack Surface
The attack surface is the sum of ways an adversary can interact with your system. It includes public web endpoints, APIs, email inboxes, remote-access services, cloud identities, third-party integrations, physical access, and the humans who operate the system. Every new feature, integration, or admin console adds surface area.
Attackers rarely begin with a clever exploit. They begin with information: a login page that reveals valid usernames, a staging server with no authentication, a public code repository containing internal hostnames, or an employee who posts about their tools on social media. Reconnaissance turns small disclosures into a map. Defenders reduce the surface by removing what is not needed, authenticating what remains, and monitoring the paths that cannot be removed.
A useful exercise is to ask, for each entry point, 'What is the worst thing a user could do here with a valid account?' Then ask, 'What could someone do without an account?' The answers reveal missing authorisation, weak rate limits, unsafe defaults, and business-logic flaws that scanning tools often miss.
03STRIDE: A Practical Threat Model
STRIDE is a checklist of six threat categories. Spoofing is pretending to be another user or service. Tampering is changing data or code without permission. Repudiation is denying an action because there is no trustworthy record. Information disclosure is exposing data to the wrong person. Denial of service is making a system unavailable. Elevation of privilege is gaining authority you should not have.
Use STRIDE as a set of prompts, not a score. For each trust boundary, ask which categories apply. A login form is exposed to spoofing and denial of service. A payment callback is exposed to tampering and repudiation. A file upload feature is exposed to tampering, information disclosure, and denial of service. Then write a specific threat, not a category label.
The output of threat modelling should be a short list of decisions. 'We will require MFA for administrators.' 'We will verify webhook signatures and reject replayed events.' 'We will move backups to an immutable account.' A model that produces a hundred vague risks and no owners is theatre. A model that produces five prioritised changes is engineering.
SYSTEM: Customer account portalASSETS: credentials, profile data, payment methods, admin consoleENTRY POINTS: login, registration, password reset, support impersonation, APITRUST BOUNDARIES: browser -> web app web app -> identity provider web app -> payment provider support agent -> customer accountSTRIDE PROMPTS Spoofing: Can an attacker reuse a session or forge an identity token? Tampering: Can a user change a price, role, or tenant identifier? Repudiation: Do we log who approved a refund or impersonation? Information leak: Can an error message or API response reveal another tenant's data? Denial of service: Can one account exhaust password-reset or export limits? Elevation: Can a normal user reach an admin route by changing an ID?PRIORITISED DECISIONS 1. Re-authenticate support staff before impersonation; log the reason. 2. Enforce tenant scoping in every database query, not only in the UI. 3. Rate-limit password reset by account and by source network. 4. Require MFA for all administrator accounts.04Defence in Depth and Least Privilege
Defence in depth means layering controls so that a single failure does not lead directly to compromise. Authentication, authorisation, input validation, output encoding, network segmentation, logging, and backups all address different failure modes. If an attacker steals a session cookie, MFA on sensitive actions can still stop account takeover. If ransomware encrypts a server, immutable backups can still restore service.
Least privilege means every user, service, and process gets only the access it needs, for only as long as it needs it. A reporting service should read the reporting view, not the entire production database. A support agent should reset a password, not read every support ticket. A build pipeline should deploy one application, not administer the whole cloud account. Least privilege reduces both the chance of an incident and the blast radius when one occurs.
The practical habit is to ask 'what can this identity do if it is compromised?' before granting access. Then remove permissions that are not used, shorten credential lifetimes, and log privileged actions. Prevention is strongest when it is boring, specific, and enforced by the system rather than by a warning in a document.
The ideas worth keeping.
- Threat modelling starts with assets and trust boundaries, not with a list of tools.
- STRIDE gives you prompts; the useful output is specific, owned decisions.
- Reduce the attack surface by removing unnecessary entry points and enforcing authentication.
- Least privilege and defence in depth limit the blast radius of inevitable failures.
Make it yours.
Type and test your code right here in the interactive workspace. Run your solution, check the output, and compare with the worked guide when ready.
Exercise 1: Threat model a password reset
A web application sends a six-digit reset code by email. The code is valid for 24 hours and there is no limit on attempts. List three concrete threats using STRIDE categories, then propose one control for each.
Explore a worked solution
1. Spoofing / elevation of privilege: an attacker guesses the six-digit code. Control: rate-limit attempts per account and per source, expire the code after 10-15 minutes, and lock the reset flow after repeated failures.
2. Information disclosure: an attacker learns whether an email address is registered from different responses. Control: return the same neutral message for known and unknown addresses.
3. Tampering / repudiation: an attacker with access to an old inbox reuses a still-valid code. Control: make the code single-use, invalidate all existing sessions after a reset, and notify the account owner by email.Each threat should name a specific path and a control that changes the path. 'Use security' is not a threat model entry.
Exercise 2: Apply least privilege
A scheduled job exports invoices to a storage bucket. It currently uses a database administrator account and a cloud key with full account access. Describe the least-privilege design you would use instead.
Explore a worked solution
Create a dedicated database role that can only read the invoice view and only from the job's network. Create a dedicated cloud identity that can only write to the specific export prefix in the bucket, with no delete or administrative permissions. Store credentials in the platform's secret manager, rotate them automatically, and log every export. Give the job a short-lived identity token rather than a long-lived key where the platform supports it.Least privilege is specific to the task. The job needs read access to one view and write access to one prefix; it does not need to administer the database or the cloud account.
What stayed with you?
Check the ideas while they’re fresh. Your answers stay in this page and feedback appears as you go.
Keep exploring.
The official references behind this lesson, when you want a second angle or the full details.
Pause. Put the pieces together.
You’ve reached the end of Security Foundations: Risk, Threats, and Defenses. Before moving on, use this task to check what you can do independently.
You can write a specific risk statement and a STRIDE-informed threat model with named assets, trust boundaries, threats, and owned controls.
Try it in your own environment and write down the result. This is a self-check; reading completion does not evaluate your code.
Review this moduleOne lesson closer.
Reading is a start. Trying it yourself makes the connection.