No history yet

Threat Modeling Methodology

What Are We Defending Against?

Effective cybersecurity isn't just about reacting to attacks. It's about building systems that are resilient from the start. Threat modeling is the process of thinking like an attacker to find and fix security flaws before they become a problem. It moves us from a general awareness of threats to a structured, repeatable analysis of a specific system.

Threat modeling involves systematically identifying potential threats to your web application, such as unauthorized data access, data tampering, and service disruption.

Instead of waiting for a vulnerability to be exploited, we proactively hunt for weaknesses during the design phase. This approach, often called being "secure-by-design," saves time, money, and headaches down the road. The goal is to build a detailed understanding of what we're defending and what we're defending it from.

Deconstructing the System

Before we can find threats, we need a map of the system. In threat modeling, this map is called a Data Flow Diagram (DFD). A DFD shows how information moves through an application, where it's stored, and who interacts with it. It’s a bird's-eye view of the entire system, making it easier to spot potential weak points.

Key components of a DFD include:

  • Processes: Actions that transform data (e.g., 'Process Payment').
  • Data Stores: Where data is kept (e.g., a customer database).
  • External Entities: Users or other systems that interact with your system.
  • Data Flows: The paths data takes between the other components.

Crucially, DFDs help us identify Trust Boundaries—the lines where data moves from a less-trusted to a more-trusted environment, like from the public internet into your internal network. These boundaries are hotspots for security risks.

The STRIDE Methodology

Once we have our DFD, we can start identifying threats. One of the most common and effective models for this is STRIDE. It's a mnemonic that helps categorize threats based on the type of harm they cause.

CategoryViolated PropertyExample
SpoofingAuthenticationAn attacker pretends to be a legitimate user.
TamperingIntegrityModifying the price of an item in a shopping cart.
RepudiationNon-repudiationA user falsely denies having made a purchase.
Information DisclosureConfidentialityA flaw reveals another user's personal data.
Denial of ServiceAvailabilityFlooding a server with traffic so it crashes.
Elevation of PrivilegeAuthorizationA standard user gains access to admin functions.

By walking through our DFD and applying the STRIDE model to each component and data flow, we can systematically brainstorm what could go wrong. Does this process handle untrusted user input? Could this data flow be intercepted? STRIDE gives us a checklist to ensure we cover all the major categories of threats.

A Risk-Centric Approach with PASTA

While STRIDE is excellent for identifying potential threats, the takes it a step further by connecting those threats to business impact. PASTA, or the Process for Attack Simulation and Threat Analysis, is a seven-step methodology focused on aligning security countermeasures with business objectives.

This approach ensures that we're not just finding any threat, but prioritizing the ones that pose the greatest risk to the organization.

Lesson image

The seven stages of PASTA are:

  1. Define Business and Security Objectives
  2. Define the Technical Scope
  3. Decompose the Application
  4. Threat Analysis
  5. Vulnerability and Weakness Analysis
  6. Attack Modeling & Simulation
  7. Risk Analysis and Management

Notice how PASTA starts with business objectives (Stage 1) and ends with risk management (Stage 7). Stages 3 and 4 are where techniques like DFD and STRIDE come into play. PASTA provides the overarching structure, while STRIDE offers a detailed method for threat enumeration within that structure. This ensures that the countermeasures we select are proportional to the risks they mitigate.

Prioritizing and Responding

A threat modeling exercise can generate a long list of potential issues. Not all threats are created equal, so we need a way to prioritize them. This is often done using a risk scoring system, such as DREAD. While now considered somewhat outdated in favor of more nuanced systems, its components are still instructive for thinking about risk.

FactorQuestion
DamageHow bad would an exploit be?
ReproducibilityHow easy is it to reproduce the attack?
ExploitabilityHow much work is it to launch the attack?
Affected UsersHow many people will be impacted?
DiscoverabilityHow easy is it to find the vulnerability?

By assigning a score (e.g., 1-10) to each factor, we can calculate an overall risk rating for each threat. This helps us focus our limited time and resources on the most severe problems first.

Once a threat is identified and prioritized, the final step is to determine a countermeasure. The options are:

  • Mitigate: Implement a control to reduce the risk (e.g., adding input validation).
  • Eliminate: Remove the feature that's causing the risk.
  • Transfer: Shift the risk to another party (e.g., by using a third-party payment processor).
  • Accept: Acknowledge the risk and do nothing, usually for low-impact threats where the fix is too costly.

In fast-paced Agile environments, threat modeling isn't a one-time event. It's an ongoing conversation. Lightweight modeling can be integrated into each development sprint, ensuring security keeps pace with new features.

Quiz Questions 1/6

What is the primary goal of threat modeling?

Quiz Questions 2/6

In a Data Flow Diagram (DFD), which component represents a location where data is stored, such as a database?

By using structured methodologies like STRIDE and PASTA, we transform security from a reactive chore into a proactive design principle.