Ravindra BagaleCourses & study guides मराठी Track your progress

29. OWASP Top 10 Web Vulnerabilities

29.9 Threat Modelling (STRIDE)

Example first. Microsoft built STRIDE in the late 1990s and now uses threat modelling in its Security Development Lifecycle. The idea is simple: before you build a feature, sit down and ask "how could someone attack this?" It is far cheaper to fix a design flaw on paper than after launch.

Why it matters

Most security work finds bugs after the code is written. Threat modelling finds weak points in the design, earlier and cheaper. It also makes sure you have not forgotten a whole class of attack.

What it is

Threat modelling means looking at a design and listing how it could be attacked, then planning defences. STRIDE is a checklist of six threat types, one per letter, so you do not miss one.

LetterThreatPlain meaning
SSpoofingPretending to be someone else
TTamperingChanging data that should not change
RRepudiationDoing something, then denying it, with no proof
IInformation disclosureLeaking data to the wrong people
DDenial of serviceMaking the system unavailable
EElevation of privilegeGetting more power than allowed
STRIDE threatCommon defence
SpoofingStrong login, MFA
TamperingInput checks, hashes, signatures
RepudiationGood logs you cannot edit
Information disclosureEncryption, access control
Denial of serviceRate limits, extra capacity
Elevation of privilegeLeast privilege, server-side checks

How to do it

  1. Draw the design: users, servers, databases and the data flow between them.
  2. Go through STRIDE for each part and each flow.
  3. Write down each threat you find.
  4. Pick a defence for each one.
  5. Rank by risk (Chapter 50.2) and fix the highest first.
  6. Repeat when the design changes.

Worked examples

Worked example 1: A login page (simplest)

  1. Spoofing: someone guesses a password. Defence: MFA and lockout.
  2. Information disclosure: password sent in plain text. Defence: HTTPS and hashing.
  3. Denial of service: many login tries flood the server. Defence: rate limits.

Worked example 2: A file upload

  1. Tampering: a user uploads a script, not an image. Defence: check file type on the server.
  2. Elevation of privilege: the script runs as the web user. Defence: store uploads outside the web folder, no execute.

Worked example 3: An online order view

  1. Elevation / disclosure: a user changes the order ID and sees another order (IDOR, Chapter 29.5). Defence: check ownership on the server.
  2. Repudiation: a user denies placing an order. Defence: keep clear, tamper-proof logs.

Real incident: Log4Shell and the value of thinking about inputs (2021)

1. What happened

In December 2021, a bug in the common Log4j logging library (Log4Shell) let attackers run code just by sending a crafted text string that got logged.

2. The STRIDE view

  1. This is Tampering and Elevation of privilege: untrusted input turned into commands.
  2. A threat model asks "what if this input is hostile?" for every input, including logs.

3. Lesson

  1. Treat all input as untrusted, even log messages.
  2. Think about threats at design time, not only after a bug is public.

In short

  • Threat modelling finds design weaknesses before coding.
  • STRIDE is a six-point checklist so you miss no threat type.
  • For each part of the design, go through all six letters.
  • Pick a defence for each threat and fix the highest risk first.