liveBook · Manning

Threat model

As explained in Secure APIs

A threat model is a structured representation of a system's potential threats, attack paths, vulnerabilities, and impacts.

A threat model is an analysis of a system’s security characteristics. It identifies vulnerabilities, shows how threat actors could exploit them, and connects attacks to affected components and consequences. section 2.2

Figure 1.3 To analyze attack vectors, we look at the three axes of API security: design, implementation, and infrastructure. We ask what vulnerabilities we expose in each axis, what they look like, and what their consequences are.
figure

Analyze the API across design, implementation, and infrastructure; identify exposed vulnerabilities, their appearance, and their consequences. section 1.1

Build a useful threat model by asking four practical questions:

  • What are we working on? Decompose the application and map its data flows, endpoints, services, databases, queues, and other relevant components. section 2.2
  • What can go wrong? Brainstorm threats, consider how malicious users achieve their goals, and rank the resulting risks. section 2.2.2
  • What are we going to do about it? Convert each threat into design, implementation, infrastructure, testing, or operational mitigations. section 1.1 section 2.7
  • Did we do a good enough job? Validate the model, involve relevant stakeholders, verify responses, and improve the process through retrospectives. section 2.2.4

Threat modeling works best as a team activity involving engineering, product, QA, business stakeholders, and owners of different system components. Revisit it continuously, especially during major changes and at regular intervals. section 2.2 section 2.2.4

SQL injection on a collection endpoint

Suppose unconstrained query parameters reach non-parameterized database queries on GET /products. A malicious user may bypass access controls and affect the API and database. The model turns this path into actions: constrain user input, parameterize queries, and test the resulting controls. section 2.2

STRIDE supplies threat categories: spoofing, tampering, repudiation, information disclosure, denial of service, and elevation of privilege. Tools can generate models from data-flow diagrams, but teams must review and adapt the results. section 2.7 section 2.2.2

Use the model to design focused security tests. Start with high-value, low-setup checks, then cover complex business flows and authorization scenarios revealed by the analysis. section 12.1 section 12.6

How Secure APIs covers it

How deep it goes
Explains decomposition, threat ranking, mitigation, review, and recurring reassessment, while deferring detailed treatment of individual vulnerabilities.
Examples
Uses SQL injection on GET /products, SSRF input, service communication, privilege escalation, stolen tokens, and business-flow abuse.
What it assumes
Assumes familiarity with the system being analyzed and teaches threat modeling from basic questions, components, vulnerabilities, and attacker goals.
What you can do after
Diagnose attack paths, prioritize mitigations, collaborate on risks, and derive targeted security tests from the model.
How it connects
Connects API security with attack surfaces, data-flow diagrams, STRIDE, access control, vulnerability mitigation, and security testing.

Also explained in

Compare how 7 books explain threat model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Secure APIs. The section links point to the parts of the book it draws on.