TExcelTAD
Home › Cybersecurity › Threat Modeling (STRIDE)

Threat Modeling (STRIDE)

Threat modeling is a structured way to ask "what could go wrong?" before you build or change a system. It is cheaper to fix a design on a whiteboard than in production. A popular framing uses four questions:

  1. What are we working on?
  2. What can go wrong?
  3. What are we going to do about it?
  4. Did we do a good enough job?

Step 1: draw the system

Start with a data-flow diagram: the processes, data stores, external entities (users, other services) and the flows between them. Draw a trust boundary wherever data crosses from a less trusted zone to a more trusted one, such as from the internet into your web server, or from the web server into the database.

text
 [Browser] ──HTTPS──▶ ║ (Web app) ──SQL──▶ ║ [(Orders DB)]
   untrusted          ║   trusted zone     ║   data zone
                trust boundary       trust boundary

Threats cluster at trust boundaries, because that is where untrusted input arrives.

Step 2: find threats with STRIDE

STRIDE, developed at Microsoft, is a checklist of six threat categories. Each one is the opposite of a security property:

Letter Threat Violates Example Typical mitigation
S Spoofing Authenticity Logging in as someone else with a stolen password Strong authentication, MFA
T Tampering Integrity Changing the price field in a request Server-side validation, MACs, signatures
R Repudiation Non-repudiation "I never made that transfer" Audit logs, signatures
I Information disclosure Confidentiality Error page showing a stack trace and DB password Encryption, least privilege, generic errors
D Denial of service Availability Flooding the login endpoint Rate limiting, autoscaling, quotas
E Elevation of privilege Authorization A normal user reaching the admin API Access checks on every request

Not every category applies to every element. A useful rule of thumb (the "STRIDE-per-element" approach) says which letters to consider for which kind of element:

python · try it yourself
APPLIES = {
    "external entity": "SR",
    "process": "STRIDE",
    "data store": "TRID",
    "data flow": "TID",
}
NAMES = {"S": "Spoofing", "T": "Tampering", "R": "Repudiation",
         "I": "Information disclosure", "D": "Denial of service",
         "E": "Elevation of privilege"}

elements = [
    ("Customer browser", "external entity"),
    ("Web app", "process"),
    ("Orders DB", "data store"),
    ("Browser -> Web app", "data flow"),
]

total = 0
for name, kind in elements:
    letters = APPLIES[kind]
    total += len(letters)
    print(f"{name:<20} {kind:<16} {letters}")
print("threats to consider:", total)
print("for the DB:", ", ".join(NAMES[c] for c in APPLIES["data store"]))
Customer browser     external entity  SR
Web app              process          STRIDE
Orders DB            data store       TRID
Browser -> Web app   data flow        TID
threats to consider: 15
for the DB: Tampering, Repudiation, Information disclosure, Denial of service

Fifteen questions for a four-element system is very manageable, and each one forces a concrete discussion ("can someone tamper with the browser-to-app flow?" leads straight to "we need HTTPS").

Step 3: decide what to do

Each threat you find gets a response (mitigate, transfer, avoid, accept, as in the risk lesson) and an owner. Keeping them in a structured list lets you track progress and spot gaps:

python · try it yourself
threats = [
    {"id": 1, "element": "Web app", "stride": "S", "desc": "credential stuffing on login",
     "mitigation": "MFA + rate limiting", "done": True},
    {"id": 2, "element": "Browser -> Web app", "stride": "T", "desc": "traffic modified in transit",
     "mitigation": "HTTPS with HSTS", "done": True},
    {"id": 3, "element": "Orders DB", "stride": "I", "desc": "backup copied by an insider",
     "mitigation": "encrypt backups, restrict access", "done": False},
    {"id": 4, "element": "Web app", "stride": "E", "desc": "user edits another user's order",
     "mitigation": "", "done": False},
]

for t in threats:
    if not t["mitigation"]:
        status = "NEEDS DECISION"
    elif t["done"]:
        status = "mitigated"
    else:
        status = "planned"
    print(f"#{t['id']} [{t['stride']}] {t['desc']:<32} {status}")

open_items = [t["id"] for t in threats if not t["done"]]
print("open:", open_items)
#1 [S] credential stuffing on login     mitigated
#2 [T] traffic modified in transit      mitigated
#3 [I] backup copied by an insider      planned
#4 [E] user edits another user's order  NEEDS DECISION
open: [3, 4]

Step 4: check your work

A threat model is a living document. Revisit it when the design changes (new API, new third-party service, new data type). Ask whether each mitigation was really implemented and tested, for example with a test case that tries the attack and expects it to fail.

Other techniques

  • Attack trees break one goal ("read another customer's orders") into the alternative ways to achieve it.
  • PASTA and LINDDUN are heavier methods; LINDDUN focuses on privacy threats.
  • Abuse cases are user stories written from an attacker's point of view: "As a fraudster, I want to reuse a coupon code many times".

Tip: You don't need a perfect diagram or a special tool. Ten minutes with a whiteboard and the STRIDE table at the start of a feature catches many design flaws.

Go further: Attack Vectors and the Attack Surface measures a system's surface from an inventory, and Risk Assessment turns the threats you found into a ranked register.

Test yourself

Which STRIDE category describes a user denying they performed an action?

  1. Spoofing
  2. Tampering
  3. Repudiation
  4. Elevation of privilege

Where do threats tend to cluster in a data-flow diagram?

  1. Inside the database
  2. At trust boundaries
  3. In the legend
  4. Only at external entities

A normal user can call an admin-only API. Which STRIDE threat is this?

  1. Information disclosure
  2. Denial of service
  3. Elevation of privilege
  4. Spoofing