All lessons Leer en español

Security in depth · Unit 28

Threat modeling: ask before building

Map a system, identify trust boundaries, and choose controls for realistic failure stories.

11 minready

Helpful before thisComputers and networks

After this lesson you can

  • Identify a trust boundary and a specific security requirement in a supplied design.
  • Compare cached-access evidence with a revocation deadline without overclaiming what removal can undo.
  • Write a testable mitigation and revise the model when sharing assumptions change.

Lessons in this unit

Browse 11 lessons in this topic
  1. Secure development: requirements to evidenceCarry security requirements through design, implementation, testing, and maintenance.11 min
  2. Software supply chains: know what you are shippingDistinguish component inventory, build provenance, signatures, and trust.11 min
  3. Turn security wishes into requirementsTurn a privacy goal into an observable actor, action, and data rule.4 min
  4. A trust boundary is not a network lineDistinguish an authenticated relay from authority to approve a business decision.4 min
  5. Design what happens when checks failDefine a safe pending state when a document permission check is unavailable.4 min
  6. Make the initial choice a safe oneCheck the initial audience across ordinary creation and template-based creation.4 min
  7. Collect less, protect a smaller footprintChoose fields and retention from the job they serve, including copies outside the main form.4 min
  8. Name the rules that must always holdAttach a security rule to the protected state, including revisions and background work.4 min
  9. Ask how a useful feature could cause harmTurn a feature’s plausible unwanted outcome into a requirement that preserves its useful purpose.4 min
  10. A signature answers a limited questionKeep signature validity separate from release suitability, support, and software behavior.4 min
  11. Case study: decide whether a change is readyReview a fictional release packet for logging, session handling, dependency changes, and recovery before making an evidence-based decision.9 min

Imagine a community photo-sharing service. Before choosing security tools, ask what it must protect: private photos, account access, and the ability to remove an unwanted share. Threat modeling turns those goals into design questions.

Trust boundary: A boundary where data or authority crosses between contexts with different security assumptions.

System and valued assets → What could go wrong? → Controls and verification1System and valued assets2What could go wrong?3Controls and verification
A threat model links a specific system to decisions you can revisit and test.

Draw the system you actually have

Show people, services, data stores, external providers, and the flows between them. Mark trust boundaries where data or authority moves between contexts with different assumptions. Include administration and recovery, not just the happy path.

An asset is something of value. A threat is a potential cause of harm. A vulnerability is a weakness that could contribute to that harm. Keeping these ideas separate prevents a list of tools from masquerading as a model.

Write a failure story with consequences

Use a concrete sentence: a former album member retains access because a cached permission decision outlives membership removal, exposing later photos. This identifies an actor, a condition, an action, and an impact. It also raises a precise design question about invalidation.

Structured prompts such as spoofing, tampering, information disclosure, and service disruption help generate questions. They do not automatically rank risk or prove every important scenario has been found. Include mistakes and dependency failures as well as deliberate misuse.

Choose a response and make it testable

A control should interrupt a part of the scenario. For the photo service, define when membership changes affect cached permissions and existing sessions. A test with synthetic albums can verify that a removed member loses the intended access.

Record remaining uncertainty, the owner, and any accepted limitation. Revisit the model when a new sharing feature, provider, or data type changes the assumptions. A small maintained model is more useful than a large diagram nobody updates.

Worked model: removal is a deadline, not a button

The community photo service’s owner supplies a concrete promise: removing an album member must stop new online reads within two minutes. The promise includes images added after removal. It does not claim to erase images already downloaded by that member. Assume the clocks in the following fictional records are aligned closely enough to compare these minute boundaries.

  • T1: Mira’s album membership is removed at 10:00. The owner’s deadline for denying new reads is therefore 10:02.
  • T2: An application authorization cache contains an allow decision created at 09:59, valid until 10:09. The design record says removal does not currently invalidate that entry.
  • T3: At 10:03, the service records a new online read by Mira using that cache entry. The supplied delivery record confirms that the image added at 10:02 was returned.
  • T4: Mira also has an image downloaded at 09:50. No mechanism for controlling previously downloaded client copies is part of the service.
PredictThe membership database is correct and the cache behaves exactly as configured. Has the security requirement nevertheless failed?

Yes. T3 records a new online read after 10:02, when the owner requires denial. Correct execution of a ten-minute cache policy does not make that policy meet a two-minute revocation promise. The observed failure is specific; it does not prove every album or access route behaves identically.

Follow authority across the cache boundary

The asset is the private image. The actor is a removed member. The important boundary is where a saved permission decision is accepted as authority for a new read. The weakness is not simply “caching is insecure”; it is the mismatch between membership changes, cache validity and the required access deadline.

Possible design responses include invalidating relevant decisions when membership changes or rechecking membership before the protected read. Their suitability depends on availability, consistency and performance needs. The requirement should specify safe behavior when current membership information is unavailable, rather than assuming the dependency never fails.

Keep the response testable: record removal time, the latest allowed decision boundary, a denied read after that boundary and a continuing member’s successful read. These are acceptance-evidence requirements, not a request to test a real service. Account sign-out alone is insufficient if a later session can still reuse a stale membership decision.

Model note: the service violated its online revocation deadline in T3. Fix and verify that decision path; treat T4 as a separate limitation of sharing copies. Revisit the model before introducing public links, offline access or a new image-delivery provider, because each can change who controls the next read.

EXPLORE THE CONCEPT

From vague worry to design decision

Choose a statement about the fictional photo service.

“Hackers could attack it”

This is too broad to guide a control or a test. Specify a resource, a boundary, and a consequence.

“Removed members may retain cached access”

This describes a condition and a consequence. Define invalidation behavior and test it.

“We installed a security product”

A product is not the threat model. Explain which scenario it changes and which assumptions remain.

A simplified learning model. It connects to no systems and uses no real data.

Turn the idea into a decision

The output is a set of reasoned decisions, not a prediction of every future incident.

Terms you met

Trust boundary

Check yourself

No timer. No penalties. Read the explanation and try again whenever you like.

  1. What does the online access recorded at 10:03 establish?

    Show the answer

    Correct answer: The removal requirement failed for this supplied read, because it occurred after the 10:02 deadline. T1 requires removal to affect new online reads within two minutes. T3 records delivery of a newly added image after that deadline.

  2. Which acceptance plan best addresses T1-T3?

    Show the answer

    Correct answer: Verify that removed members lose new online reads by the deadline while current members retain the intended access. This checks the security outcome and the service’s useful behavior. The implementation may choose an appropriate invalidation or revalidation mechanism.

  3. How should the model treat T4’s previously downloaded image?

    Show the answer

    Correct answer: Document that ordinary online revocation cannot recall a copy already held by the member. T1 explicitly governs new online reads. A previously downloaded copy has crossed into a different control context.

  4. A new public-link feature is proposed. What is the useful next modeling step?

    Show the answer

    Correct answer: Map its audience and revocation behavior, then review whether the member-only assumptions still apply. A public link introduces a different access relationship. Reuse prior decisions only after checking the assumptions the new flow changes.

Try it

  • WriteWrite a one-page threat-model note for T1-T4: asset, actor, boundary, observed failure, requirement, owner and verification. Include both removed-member denial and continuing-member access. State that previously downloaded copies are outside the online revocation guarantee.
References