Kaopiz Logo

Threat Modeling in SDLC: 2027 Guide With Practical Examples

Most teams run a threat model once, at the design review, and by the second sprint it no longer matches the system. Threat modeling in SDLC fixes that by asking “what can go wrong?” at every phase, from the first user story to changes made after launch.

This guide shows what to do in each phase, how to run a threat model in five steps and which method fits your project. It also walks through a full example for an AI support agent, with every threat and the phase where it was fixed.

Key Takeaways

  • Threat modeling in SDLC finds design-level security risks early, while fixing them is still cheap.
  • Start with abuse cases at requirements, build the full model at design, and revisit it in every later phase.
  • STRIDE suits most teams. Add LINDDUN for personal data, PASTA for business risk, and MAESTRO for AI agents.
  • AI features bring threats like prompt injection and tool misuse that classic checklists miss.
  • Keep SDLC threat modeling current with a short delta review whenever a story changes a trust boundary.

What Is Threat Modeling in SDLC?

Threat modeling in SDLC is a structured way to find and fix design-level security risks by asking “what can go wrong?” at every phase, from requirements to maintenance. It moves security decisions to the point where changes are still cheap.

threat modeling in sdlc four questions framework
Four questions that guide threat modeling in SDLC

According to the Threat Modeling Manifesto, building a threat model comes down to 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?

A finished threat model gives the team four outputs: a data flow diagram with trust boundaries, a list of threats, agreed mitigations with owners, and backlog tickets and tests that carry each decision into the code.

Threat modeling finds design flaws before code exists, while penetration testing finds exploitable bugs after the system is built. That is why threat modeling should start before the first line of code is written.

Why Does Threat Modeling Belong Early in the SDLC?

Threat modeling belongs early in the SDLC because design flaws are cheap to fix on a whiteboard and expensive to fix in production. A missing authorization check found in a design review takes one line in a diagram. Found after release, the same flaw means rework across the code, tests and infrastructure, and sometimes an incident report.

Many of the costliest security gaps are design decisions, not coding mistakes. AI systems show this clearly: 97% of organizations that had an AI-related security incident reported lacking proper AI access controls. Who the system can act for, and what it can reach, has to be decided before anyone writes code.

AI-assisted coding makes early modeling even more important. Teams now ship more code faster than reviewers can read line by line. A threat model tells reviewers which components need a human security check every time, so review effort goes where the risk is.

Where Does Threat Modeling Fit in Each SDLC Phase?

Threat modeling starts at requirements, does its heaviest work at design, and comes back in every later phase of the software development life cycle with a narrower question. The table below shows what each phase adds, who joins, and what the team should walk away with.

Phase What Threat Modeling Adds Who Joins Output
Planning and Requirements An abuse case for every user story Product owner, tech lead Security requirements and key assets to protect
Design The first full threat model, built on the data flow diagram Architect, tech lead, product owner Diagram, prioritized threat list, mitigations with owners
Development Threat-linked tickets and focused code reviews Developers, reviewers Tickets tagged with threat IDs, reviewed pull requests
Testing A test case for each high-priority threat QA engineers, security tester Tests that prove each mitigation works
Deployment A check of the live infrastructure against the model DevOps engineer, tech lead Fixed gaps or accepted risks, model matched to production
Maintenance A delta update whenever a change touches a trust boundary Tech lead, team for that change Updated diagram and new mitigation tickets

Planning and Requirements: Turn Use Cases Into Abuse Cases

At the requirements stage, write an abuse case next to every user story. For “As a user, I can reset my password,” the abuse case is “As an attacker, I reset someone else’s password by guessing which emails are registered.” Each abuse case becomes a security requirement with its own acceptance criteria. For this one, the reset page returns the same message whether or not the email exists.

The product owner and a tech lead can write abuse cases in the same refinement session as the user stories. The output is a short list of security requirements and the assets that need protection most. That list sets the scope for the design-phase threat model.

Design: Build the First Full Threat Model

Design is where the first full threat model gets built, because the architecture is finally clear enough to analyze. The team draws a data flow diagram and marks every trust boundary, such as browser to API or service to a third-party API. Then it runs STRIDE on each flow that crosses one. A login flow, for example, raises spoofing (stolen credentials), tampering (modified tokens) and information disclosure (verbose error messages).

Plan one to two hours for this session with the architect, a tech lead and the product owner. The output is the diagram, a prioritized threat list and agreed mitigations, each with an owner. This session catches the most issues for the least effort, so it should not be skipped even under deadline pressure.

Development: Link Threats to Tickets and Code Reviews

During development, every mitigation from the threat model becomes a backlog ticket tagged with its threat ID. For example, threat T-04, “user reads another user’s order,” becomes a ticket to add an ownership check on the order endpoint. The reviewer then checks that pull request against T-04 specifically, not just general code quality.

sdlc threat modeling development phase
Linking threats to tickets and code reviews in development

This link matters even more when the team uses AI coding assistants. The threat model marks the components where generated code always needs a human security review, such as authentication, input handling and secrets management. Everything else can follow the normal review flow, so security attention goes where the risk is.

Testing: Turn Each Threat Into a Test Case

In the testing phase, every high-priority threat gets at least one test that proves its mitigation works. For “tampering with the order total,” QA sends a checkout request with a modified price and confirms the server rejects it. For “user reads another user’s order,” the test calls the endpoint with a different account’s order ID and expects an access error.

Depending on the threat, these become unit tests, integration tests, DAST scans or manual checks during a pen test. Tests tied to threat IDs show exactly which risks are covered and which are still open before release. They also stay in the regression suite, so a later change cannot quietly undo a mitigation.

Deployment: Recheck Trust Boundaries Before Go-Live

Before go-live, compare the threat model with the infrastructure that is actually deployed. Diagrams often show a private database or a tightly scoped service account, while the real cloud setup has a public endpoint or admin-level permissions left over from testing. Check cloud IAM roles, network rules, secrets storage and every third-party integration against the trust boundaries in the model.

The DevOps engineer and the tech lead can run this check as part of the release checklist. Any gap found here either gets fixed before launch or is recorded as an accepted risk with an owner. The threat model is then updated to match production, so later changes are measured against reality rather than the original design.

Maintenance: Update the Model When the System Changes

After launch, update the threat model whenever a change touches a trust boundary, not on a fixed yearly schedule. Common triggers include a new third-party integration, a new type of personal data, a change to roles or permissions, and a new AI model or tool. A newly disclosed vulnerability in a dependency the system relies on is also a trigger.

sdlc threat modeling maintenance update triggers after launch
Keeping the SDLC threat model current after each system change

Each update covers only what changed, so it often takes less than an hour. The team adds the new flows to the diagram, checks them for threats and creates tickets for any new mitigations. Kept this way, the model stays an accurate map of the live system rather than a record of its first design. The section on keeping threat models current in Agile delivery explains how to fit these updates into a normal sprint.

How to Run a Threat Model in 5 Steps

The same five steps work at any SDLC phase; only the scope changes, from a whole system at design to a single feature in a sprint. The example below uses an online ordering feature.

  1. Define the scope and draw the data flow. List the components, data stores, external actors and trust boundaries, then connect them in a data flow diagram. For the ordering feature, that means the web app, order API, payment provider and order database.
  2. Identify threats. Walk through each element and each flow that crosses a trust boundary using a checklist such as STRIDE, then add anything the team brainstorms. One result might be “a user changes the order ID in the request and views someone else’s order.”
  3. Rate and prioritize. Score each threat by likelihood and impact so the team fixes the most serious ones first. Exposing other customers’ orders is easy to attempt and damaging, so it ranks high.
  4. Decide on a response. For each threat, choose to mitigate, transfer, accept or avoid it, and assign an owner. Here the team mitigates by checking order ownership on the server for every request.
  5. Validate and record. Confirm that each mitigation is built and tested, then record any residual risk and who accepted it. The threat model, tickets and tests now give a clear record for audits and future updates.

Which Threat Modeling Method Should You Use?

Most product teams should start with STRIDE and only add another method when the system or its stakeholders call for it. Each method answers the same question, “what can go wrong?”, but from a different angle: technical threats, business risk, privacy or AI autonomy.

Method Best For Effort Where It Fits in the SDLC
STRIDE Finding technical threats in most web, mobile and API systems Low to medium Design, then sprint-level updates
PASTA Risk-heavy systems where threats must be tied to business impact, such as banking or payments High Requirements and design
LINDDUN Systems built around personal data, such as health or HR platforms Medium Requirements and design, next to STRIDE
Attack Trees Analyzing one high-value target in depth, such as account takeover Medium Design and testing
VAST Large organizations running threat modeling across many teams with tooling Medium to high Across the SDLC, tied to Agile delivery
MAESTRO AI agents that use tools and take actions on their own Medium Design and every change to models, prompts or tools

Threat Modeling Example: An AI Support Agent Through the SDLC

Take a fictional but common project: an AI support agent for a Singapore insurer. Customers ask it policy questions, and it answers from the insurer’s documents. Once they log in, it can also check claim status and book a callback.

The tricky part is that the agent now reaches the internal claims system, which used to be open only to staff. So the team marks three trust boundaries on the data flow diagram: the customer’s browser to the API gateway, the agent to the external LLM provider, and the agent to the claims API.

Running STRIDE on those boundaries, plus a check against the OWASP agentic risks, produced these threats:

Threat Fix Phase
Agent reads another customer’s claim Tie every tool call to the logged-in session Requirements
Hidden instructions in an uploaded file take over the agent Treat document text as data, never as instructions Design
Agent’s account can read every claim Scoped token limited to one customer Development
Customer data ends up in the LLM provider’s logs Redact personal data before sending prompts Development
Vector store left on a public endpoint Caught in the pre-launch infrastructure check Deployment
A new document source lets unreviewed files in Add an approval step before ingestion Maintenance

Half of these are ordinary access-control problems. The other half only exist because the model can act on its own. Most were fixed at requirements and design, where each fix was a small change. The last two showed up after launch, which is the case for keeping the model up to date.

Threat Modeling in Software Development Examples by Industry

The steps stay the same in every industry, but the assets worth protecting and the attackers going after them change. Here are three short examples showing where the biggest risk sits in fintech, healthcare and e-commerce.

  • Fintech (payments API): In a payments API, the asset that matters most is the transaction. Attackers try to change the amount in transit or replay a valid request to charge twice. Request signing stops tampering, and idempotency keys make a repeated request run only once.
  • Healthcare (patient portal): In a patient portal, the asset is the health record. The classic threat is a patient changing the record ID in a request and seeing someone else’s data. A server-side ownership check on every record request closes that gap.
  • E-commerce (marketplace with third-party plugins): In a marketplace, the risk often comes from code the team didn’t write. A compromised plugin or dependency can steal customer data from inside the platform. An SBOM, pinned dependency versions and sandboxed plugins limit the damage.

How to Keep Threat Models Current in Agile and AI-Assisted Delivery

Most threat models go stale because they are built once at design and never touched again. In Agile delivery, the fix is to make small, frequent updates instead of big yearly workshops.

Start by adding one question to your Definition of Ready: “Does this story change a trust boundary?” Most stories won’t, and they move on as usual. For the ones that do, such as a new integration, new personal data or a permission change, the team holds a short delta review of 15 to 30 minutes. It covers only what the story changes and ends with tickets for any new mitigations.

Next, keep the threat model in the same repository as the code, as a diagram file or as threat-model-as-code. That way it is versioned, reviewed in pull requests and easy to find when someone asks why a control exists.

AI coding assistants add one more step. Reviewers can’t read every generated line with the same care, so the threat model should decide where they focus. Mark the high-risk components, such as authentication, payments, data access and anything an AI agent can trigger, and require a human security review for every change there.

How Kaopiz Builds Threat Modeling Into AI Development

At Kaopiz, we treat the threat model as part of the project, not a document written after the code. It starts with the abuse cases at requirements, takes shape in design and follows the system through every release.

How Kaopiz Builds Threat Modeling Into AI Development
Kaopiz builds threat modeling into every AI development project

This matters most in AI projects. When a system can call tools, read company data or act for users, access decisions have to be made before anyone writes a prompt. Our teams build those checks into the Kaopiz AI-SDLC. Threats link to tickets and tests, and AI-generated code in high-risk components always gets a human security review. At handover, clients receive the threat model along with the code, so their team can keep it current.

Kaopiz holds ISO 27001 and ISO 9001 certifications and has delivered more than 1,000 projects for over 500 clients worldwide. If you are planning an AI feature or agent, our AI development services team can help you design it securely from day one.

Conclusion

Threat modeling in SDLC works best as a habit, not a one-time document. Start with abuse cases at requirements, build the full model at design, and update it whenever a change touches a trust boundary. That keeps the model an accurate map of the system you actually run.

This matters even more now that AI writes more of the code and AI agents take more of the actions. A short design session costs far less than fixing the same flaw in production.

FAQs

Which SDLC Phase Should Threat Modeling Start In?
Threat modeling should start in the requirements phase, with abuse cases written next to user stories. The first full threat model is built at design, once the architecture is clear enough to draw a data flow diagram.

How Long Does a Threat Model Take?
A first full threat model for one system usually takes a one-to-two-hour session with the architect, tech lead and product owner. Later updates cover only what changed, so a sprint-level delta review often takes 15 to 30 minutes.

Is STRIDE Still Relevant for AI Systems?
Yes, STRIDE still catches most access-control and data issues in AI systems. However, it misses risks specific to AI agents, such as prompt injection and tool misuse. Combine STRIDE with MAESTRO or the OWASP Top 10 for Agentic Applications when the system can take actions.

Who Should Own the Threat Model?
The tech lead or solution architect should own the threat model, because they understand the design and can turn threats into tickets. Security specialists review and guide it, and the product owner joins to judge business impact and accept residual risks.

How Often Should a Threat Model Be Updated?
Update the threat model whenever a change touches a trust boundary. Examples include a new integration, new personal data, a permission change, or a new AI model or tool. This event-based approach keeps the model more accurate than a fixed yearly review.

Author

Ethan Cao

Chief Technology Officer of Kaopiz Global

CTO of Kaopiz Global, with over 10 years of experience building, scaling, and leading high-performing engineering teams for global clients. He oversees Kaopiz’s technology strategy and the delivery of complex systems across AI, cloud-native platforms, and enterprise applications, ensuring every solution is secure, scalable, and production-ready.
No Comments yet!

Leave a Comment

Your email address will not be published. Required fields are marked *

Share:

Table of Contents

Don’t miss what’s next!