DEV Community

Cover image for Threat Modeling for AI Applications - From Architecture to Testable Attack Path
Michael Sommer
Michael Sommer

Posted on Originally published at sommercode.gitbook.io

Threat Modeling for AI Applications - From Architecture to Testable Attack Path

Why an AI Threat Model Is Far More Than a List of Known Risks

With classical applications, the security analysis can often be built along familiar structures: users send input, business logic processes it, databases supply or store information, and an answer results at the end. AI applications look similar at first glance. They too have frontends, backends, databases, identities, and APIs. The decisive difference, however, lies in how information changes its role within the system.

A document starts out as mere content. After retrieval, an excerpt of that document becomes part of the model context. There, it can not only supply knowledge but influence the model's behavior. Model output starts out as merely probabilistically generated text or structured output. If it turns into a tool call, a SQL query, a ticket, or an email, it produces a real effect. It is exactly at these transitions that it's decided whether an AI system merely produces the occasional nonsense, or whether an attacker actually violates protected assets.

A good threat model for an AI application therefore doesn't simply describe "prompt injection," "hallucination," "data leakage," and "tool abuse." That would be little more than risk bingo. A useful threat model is a working model that establishes a traceable chain:

System → Assets → Data Flows → Trust Boundaries → Attacker Goals → Abuse Scenarios → Attack Paths → Controls and Tests

This chain is the actual goal. It turns an abstract discussion about "AI risks" into a concrete security analysis that connects to engineering, architecture, testing, and operations.

The AI threat modeling process moves from understanding the overall system through assets, security objectives, data flows, and trust boundaries to concrete attacker goals, abuse scenarios, and attack paths. Controls and reproducible security tests are then derived from these attack paths. Threat modeling therefore connects architectural understanding directly with testable security assumptions.

Figure 1: The AI threat modeling process moves from understanding the overall system through assets, security objectives, data flows, and trust boundaries to concrete attacker goals, abuse scenarios, and attack paths. Controls and reproducible security tests are then derived from these attack paths. Threat modeling therefore connects architectural understanding directly with testable security assumptions.

1. What a Threat Model Must Deliver

A threat model is neither a decorative diagram nor a collection of general security rules. It should help you understand a system well enough that plausible security problems become visible and verifiable.

To do that, it has to answer at least six questions:

  1. What is the system? What function does the application serve, who uses it, and which AI components are involved?
  2. What is worth protecting? Which data, permissions, control mechanisms, identities, and outputs must not be disclosed, manipulated, or abused?
  3. How do information and decisions move through the system? Which inputs, context blocks, tool results, and model outputs flow between the components?
  4. Where does trust, control, or effect change? At which points does untrusted content gain more trust, get pulled into a privileged context, or get translated into a real action?
  5. Who could pursue which goal? What realistic attackers exist, what capabilities do they have, and what effect do they want to achieve?
  6. What concrete attack paths result from this? Under what preconditions can an actor violate an asset via which components and boundaries?

A threat model has succeeded when concrete reviews, controls, and test cases can be derived from it. If it stops at sentences like "prompt injection could happen," the model is still too shallow.

What Explicitly Isn't Enough

A pure list of components like "frontend, backend, vector store, LLM, tool" doesn't describe a security model yet. Without data flows, it stays unclear which component processes which content, and where trust changes.

A pure list of controls isn't a threat model either. Statements like "we use RBAC, input validation, and guardrails" describe defenses, but not yet what they protect against or what assumptions sit behind them.

Especially dangerous is fixating on the model itself. Many real problems don't sit "in the LLM," but in the retrieval logic, the prompt composition, tenant isolation, tool authorization, output handling, or the ingestion pipeline. The model is often the most visible node, but not necessarily the actual scene of the accident.

2. The AI-Specific Core: Context Is Not Just Information

The central difference between a classical application and an AI application is that text and other data within the system are not merely processed — they frequently become the control surface itself.

A classical processing chain can look, simplified, like this:

Input → Business Logic → Database → Output

A RAG system tends to work more like this:

Input → Retrieval → Context Selection → Prompt Composition → Model → Output

An agent system extends this chain further:

Input → Model Decision → Tool Call → Tool Result → New Model Decision → Action or Response

In these architectures, several sources of information have influence over behavior:

  • system and developer instructions
  • user requests
  • chat histories
  • retrieved document chunks
  • external websites or emails
  • tool results
  • memory or session content
  • previous model outputs

These sources are not equally trustworthy. They are also not equally privileged. And yet they frequently end up together in one model context, where their technical separation is far less clear-cut than in classical program logic.

Two especially important principles follow from this.

Principle 1: Context Can Be Indirect Control

Document text can contain facts, but just as easily action instructions. If the text is selected by the retriever and pulled into the model context by the prompt builder, its content can gain influence over priorities, answers, and tool decisions.

The relevant question is therefore not just:

What data does the model see?

But rather:

What data can influence what the model believes, prioritizes, or does?

Principle 2: Model Output Is Not a Trustworthy Control Mechanism

Model output is probabilistic. If it's used directly as a tool decision, action parameter, HTML, SQL, code, or shell command, the system crosses a critical line. An unsafe suggestion can turn into a real action.

The model is allowed to produce suggestions. Authorization of real actions, however, should happen through deterministic, verifiable logic outside the model.

3. The Running Example System

For the further analysis, we'll use an internal AI support assistant.

Employees ask questions through a chat frontend. The backend uses RAG to determine matching content from an internal knowledge base. A prompt builder combines system instructions, the user request, chat history, and retrieved document chunks. The LLM produces a response or proposes using a tool. Through a tool broker, the application can create support tickets.

Main Components

  • User
  • Chat Frontend
  • Backend / Orchestration
  • Authentication and Session Layer
  • Document Ingestion Pipeline
  • Vector Store / Knowledge Base
  • Retriever
  • Prompt Builder
  • LLM
  • Tool Broker
  • Ticket System
  • Logging and Monitoring

This description is deliberately more concrete than "a chatbot with AI." It names the functions, the components, and the places where context gets assembled or effect gets created. Only this makes it possible to determine assets and attack paths.

4. Assets in AI Systems

An asset is anything whose disclosure, manipulation, loss, or abuse produces a relevant security impact. In AI systems, this includes not just classical data, but also control mechanisms, capabilities, and context.

AI applications protect significantly more than traditional business data. Relevant assets include not only data, but also control mechanisms such as system prompts and policies, context such as retrieved chunks and tool results, capabilities and permissions, generated outputs, and identity, session, and tenant information. Each asset class requires its own security objectives and controls.
Figure 2: AI applications protect significantly more than traditional business data. Relevant assets include not only data, but also control mechanisms such as system prompts and policies, context such as retrieved chunks and tool results, capabilities and permissions, generated outputs, and identity, session, and tenant information. Each asset class requires its own security objectives and controls.

4.1 Data Assets

Data assets include, among others:

  • internal knowledge documents
  • employee requests and chat histories
  • support tickets
  • personal or confidential company data
  • API keys and secrets
  • logs with sensitive content
  • uploaded files
  • tool returns

Typical protection goals are confidentiality, integrity, availability, and tenant separation.

4.2 Control Assets

Control assets determine how the system is supposed to behave:

  • system prompt
  • developer instructions
  • prompt templates
  • guardrails and policies
  • tool rules
  • retrieval selection rules
  • context composition logic
  • prioritization between instruction sources

These assets need, above all, integrity, confidentiality, and control fidelity. Manipulation can cause the system to pursue different goals, bypass boundaries, or process disallowed content.

4.3 Permission and Capability Assets

An agent can not only see information but execute actions. The capability itself is therefore an asset:

  • ticket creation
  • CRM and database access
  • sending mail
  • file access
  • calendar changes
  • plugin and API permissions
  • delegation rights
  • an agent's scope

The most important goals are authorization, least privilege, integrity, and traceability.

An unreliable model is annoying. An unreliable model with far-reaching permissions is dangerous.

4.4 Context Assets

Context assets are especially critical in AI systems:

  • retrieved chunks
  • chat history
  • session memory
  • user context
  • tool outputs that flow back into the model
  • the final assembled model context

Context is the basis for decisions, and indirect control. Its integrity, provenance, confidentiality, and correct separation between users or tenants are therefore independent security goals.

4.5 Output Assets

The output can be an asset too:

  • generated answers
  • generated ticket content
  • SQL, code, or shell output
  • HTML and Markdown content
  • recommendations or decisions
  • structured data that gets automatically processed further

Output needs integrity and safe downstream processing. It must not trigger disallowed actions, and it must be validated or sanitized before rendering or execution.

4.6 Identity and Session Assets

Multi-user and multi-tenant systems need a correct binding between user, session, tenant, retrieval scope, and tool execution:

  • user identity
  • roles and claims
  • session assignment
  • tenant or scope context
  • access tokens
  • delegation context
  • the identity in whose name a tool is called

An error in this binding can cause a model to work technically correctly, but with the wrong context or under the wrong name.

Asset and Protection Goal Have to Match

The category "data" is too coarse. An internal manual, a system prompt, a permission to send mail, and a retrieved chunk are all text- or data-related, but security-wise completely different.

Asset Category Primary Security Goals Typical Abuse
Internal knowledge documents Data Confidentiality, integrity Disclosure or manipulation
System prompt Control Integrity, confidentiality, control fidelity Override, leakage, policy bypass
Ticket tool permission Capability Authorization, least privilege, auditability Confused deputy, disallowed action
Retrieved context Context Integrity, provenance security, separation Poisoning, cross-tenant mixing
Generated ticket content Output Integrity, safe downstream processing Data takeover, injection, wrong action
Session-to-user binding Identity Authenticity, authorization, separation Session mix-up, foreign context

A practical heuristic:

  • What happens if this element gets disclosed?
  • What happens if it gets manipulated?
  • What happens if it's used under the wrong name or scope?
  • Does it influence what the model sees, prioritizes, or is allowed to do?

As soon as one of these questions shows a real security impact, you're very likely looking at an asset.

5. Data Flows and Trust Boundaries

A data flow describes which information moves from where to where, in what role, and under what control through the system. Security problems frequently don't arise inside a single component, but at the transitions between components.

A trust boundary is a point where at least one of the following conditions changes:

  • Data crosses into a different trust zone.
  • Control assumptions change.
  • Content gets processed with higher privilege.
  • Information turns into decision-relevant context.
  • Model output gets translated into a real action.
  • Shared infrastructure is used across different users or tenants.

The core question is:

Why do we trust this content more, starting from this point, than we did before?

The data flow of a RAG-based support assistant illustrates the major trust boundaries between user input, retrieval, model context, tool use, and output. Particularly critical transitions occur when untrusted content enters decision-relevant model context, model output becomes a real-world action, or tool results are fed back into the LLM context. Trust boundaries therefore exist not only at the external system perimeter, but at multiple points inside the AI application.
Figure 3: The data flow of a RAG-based support assistant illustrates the major trust boundaries between user input, retrieval, model context, tool use, and output. Particularly critical transitions occur when untrusted content enters decision-relevant model context, model output becomes a real-world action, or tool results are fed back into the LLM context. Trust boundaries therefore exist not only at the external system perimeter, but at multiple points inside the AI application.

5.1 Typical Data Flow of the Support Assistant

  1. User → Frontend: user request
  2. Frontend → Backend: request plus session and identity context
  3. Backend → Retriever: retrieval query
  4. Retriever → Vector Store: similarity search and filtered document lookup
  5. Vector Store → Retriever: relevant chunks
  6. Retriever → Prompt Builder: retrieved context
  7. Prompt Builder → LLM: system prompt, user request, history, and chunks
  8. LLM → Backend: response or tool intent
  9. Backend / Tool Broker → Ticket Tool: validated ticket call
  10. Ticket Tool → Backend / LLM: tool result
  11. Backend → Frontend: final response
  12. Components → Logging: audit, error, and operational data

5.2 Critical Trust Boundaries

Boundary 1: User Input → Internal System

Untrusted user input enters internal processing. Risks are direct prompt injection, resource abuse, context manipulation, and policy bypass attempts.

Boundary 2: External or Weakly Controlled Content → Knowledge Base

Documents, websites, emails, or files get ingested and later used as a context source. Risks are poisoned content, manipulated chunks, and indirect prompt injection.

Boundary 3: Retrieved Context → Model Context

Document text gains direct influence over model responses and possibly tool decisions. This boundary is one of the most important AI-specific transitions.

Boundary 4: Model Output → Tool Call

Probabilistic output turns into a real action. Risks are unauthorized tool use, parameter injection, confused-deputy problems, and multi-stage abuse.

Boundary 5: Tool Output → Model Context

Tool results get fed back into the model. This creates a second input vector that can contain sensitive, manipulated, or instructive content.

Boundary 6: Model Output → Rendering or Downstream Processing

Model output gets displayed, copied, executed, or handed to other systems. Risks are unsafe HTML or Markdown, harmful queries, code execution, and blind trust in generated content.

Boundary 7: Tenant or Session → Shared Components

A shared vector store, memory layer, or tool service must not lead to shared visibility. Scope and identity checks have to apply before retrieval, context inclusion, and tool execution.

What Should Be Documented for Every Edge

A useful data flow model doesn't just note "backend talks to LLM." For every edge, three things should be captured:

  • What flows?
  • How trusted is it?
  • What may happen next?

Example:

Flow Content Trust Level Downstream Effect
Retriever → Prompt Builder Document chunks mixed / potentially untrusted influences the answer and tool decision
LLM → Tool Broker Tool intent and parameters untrusted proposal can trigger a real action after authorization
Tool → LLM API or ticket result external / sensitive becomes new model context
Backend → Renderer generated response untrusted output gets displayed or processed further

6. Attackers, Goals, and Abuse Scenarios

A threat model only becomes truly useful once architecture and assets are connected to realistic adversaries.

6.1 Attacker Goals Describe the Effect

"Prompt injection," "jailbreak," or "RAG attack" are not attacker goals. They describe techniques or risk classes.

A goal describes the intended effect:

  • disclose confidential data
  • see another tenant's data
  • trigger a tool without authorization
  • bypass guardrails or policies
  • manipulate retrieval or context
  • destroy answer integrity
  • redirect the agent
  • abuse resources or costs
  • deceive users or influence processes

The rule of thumb is:

A goal describes what is meant to be achieved, not how.

6.2 Typical Attackers

External User

They have regular access to the application and can send requests, upload files, or observe behavior iteratively.

Malicious Content Supplier

They control documents, websites, emails, or files that the system reads or ingests. This actor is especially relevant for indirect prompt injection and context poisoning.

Insider or Legitimate Internal User

They have legitimate access but try to expand their visibility, repurpose internal tools, or bypass policies.

Tenant Attacker

They use the system within their own tenant and try to make foreign chunks, sessions, memories, or tool results visible.

Indirect Tool or Data Source Attacker

They don't attack the chat itself, but influence API responses, tool returns, or external data sources that later reach the model context.

6.3 From Goal to Abuse Scenario

An abuse scenario is a plausible description of how an actor uses an intended function against the system.

A good format is:

  • Actor
  • Goal
  • Precondition
  • Abused Function or Boundary
  • Expected Impact

Example:
Actor: External user
Goal: Disclosure of internal support content
Precondition: Retrieval is scoped too broadly
Abused Boundary: Retrieval → Model Context
Expected Impact: Confidential information appears in the response

A sentence like "prompt injection could happen," on the other hand, is worthless: actor, goal, precondition, system reference, and impact are all missing.

6.4 Security, Reliability, and Mixed Cases

Not every incorrect model behavior is a security finding.

Not every failure of an AI system is automatically a security issue. A reliability problem becomes security-relevant when it affects a protected asset, a permission, or a trust boundary. Mixed cases are especially important: an ordinary model or retrieval failure may gain real security impact when combined with automation, privileged tools, or broken access control.
Figure 4: Not every failure of an AI system is automatically a security issue. A reliability problem becomes security-relevant when it affects a protected asset, a permission, or a trust boundary. Mixed cases are especially important: an ordinary model or retrieval failure may gain real security impact when combined with automation, privileged tools, or broken access control.

Reliability

The system works poorly or unreliably, without any protected asset being violated.

Examples:

  • an incorrect summary
  • hallucination with no connection to real confidential data
  • irrelevant retrieval results
  • wrong tool selection with no security-relevant effect

Security

An asset, a permission, or a trust boundary is affected.

Examples:

  • another tenant's data appears in the response
  • a tool executes an unauthorized action
  • sensitive information gets disclosed from context or logs
  • manipulated content influences a real action

Mixed Case

A quality error becomes security-relevant because it's coupled to rights, assets, or automated downstream processing.

Examples:

  • faulty retrieval leads to cross-tenant leakage
  • a faulty tool selection triggers a real action
  • a faulty output structure gets automatically processed and produces an effect

The decisive sentence:

Not every act of stupidity is a security incident. It becomes dangerous the moment assets, rights, or trust boundaries are affected.

7. Attack Paths: Turning Risks into Testable Chains

An attack path is a concrete, plausible sequence of steps through which an attacker reaches their goal. It connects:

  • actor
  • entry point
  • preconditions
  • components
  • trust boundaries
  • sequence of steps
  • impact
  • possible controls

An abuse scenario says which function gets abused. The attack path shows how that happens technically.

7.1 Attack Path for Faulty RAG Retrieval

Goal: Disclose confidential content
Actor: External user
Entry Point: Chat request
Precondition: Retrieval is scoped too broadly, or not bound to user rights
Components: Frontend, Backend, Retriever, Vector Store, Prompt Builder, LLM
Critical Boundaries: User → System; Retrieval → Model Context

Sequence of Steps:

  1. The user sends deliberately crafted requests.
  2. The backend generates a retrieval query.
  3. The retriever insufficiently enforces the scope or tenant filter.
  4. Disallowed document chunks get selected.
  5. The prompt builder pulls them into the model context.
  6. The model uses the content in its answer.
  7. Confidential information gets disclosed.

Impact: Violation of confidentiality and tenant separation

Controls: ACL-bound retrieval filters, scope enforcement before search, post-retrieval authorization, context minimization, disclosure tests

7.2 Attack Path for Indirect Prompt Injection

Goal: Manipulate model behavior or tool use
Actor: Malicious content supplier
Entry Point: An ingested document
Precondition: The attacker can place content into a source the retriever considers
Components: Ingestion, Chunking, Vector Store, Retriever, Prompt Builder, LLM
Critical Boundaries: Content Source → Knowledge Base; Retrieved Context → Model Context

Sequence of Steps:

  1. The attacker plants a semantically relevant document.
  2. The document contains manipulative instructions.
  3. The ingestion pipeline chunks and indexes the content.
  4. A matching user query leads to retrieval of the manipulated chunk.
  5. The prompt builder pulls the chunk into the model context.
  6. The model inappropriately treats the contained instruction as actionable.
  7. The response, a tool intent, or a downstream process gets influenced.

Impact: Policy bypass, data disclosure, goal redirection, or tool abuse

Controls: source classification, ingestion governance, context isolation, untrusted-content labeling, tool gating, human approval for sensitive actions

7.3 Attack Path for Tool Abuse

Goal: Trigger a disallowed ticket action
Actor: External or internal user
Entry Point: A manipulatively phrased request
Precondition: Tool calls are not authorized independently of the model
Components: Frontend, Backend, LLM, Tool Broker, Ticket System
Critical Boundaries: User → Model Context; Model Output → Tool Call; Tool Output → Model Context

Sequence of Steps:

  1. The user phrases a seemingly legitimate task.
  2. The model produces a ticket intent and parameters.
  3. The tool broker accepts the model's decision without sufficient policy checking.
  4. The ticket system executes the action within the scope of the service identity.
  5. The tool result flows back into the model.
  6. The model produces further content or follow-on actions.
  7. A ticket gets created with disallowed content, recipient, or scope.

Impact: Process abuse, data handoff, unauthorized action

Controls: external policy engine, least privilege, parameter allowlisting, per-call authorization, confirmation step, audit logging

![The attack chain shows how a malicious document can progress through ingestion, retrieval, and model context until it influences a security-relevant tool call. The impact is not caused by a single “malicious prompt,” but by multiple control failures across the system. Source governance, retrieval and scope controls, context isolation, external tool authorization, least privilege, and audit logging interrupt the attack path at different stages.(https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/3qnp28lvhd9t80h03dbj.png)
Figure 5: The attack chain shows how a malicious document can progress through ingestion, retrieval, and model context until it influences a security-relevant tool call. The impact is not caused by a single “malicious prompt,” but by multiple control failures across the system. Source governance, retrieval and scope controls, context isolation, external tool authorization, least privilege, and audit logging interrupt the attack path at different stages.

Why Attack Paths Matter So Much

AI security problems often arise from several small weaknesses:

  • external or manipulated content enters the system
  • retrieval selects it
  • prompt composition makes it decision-relevant
  • the model produces a tool intent
  • an external layer doesn't authorize it sufficiently
  • the tool output gets processed again without scrutiny

Any single stage may look harmless. The chain is what creates the impact. An attack path shows these dependencies and is thereby the direct precursor to a test case.

8. A Compact, Complete Threat Model

The following mini threat model summarizes the analysis for the support assistant.

8.1 System Description

Internal AI support assistant for employees. The system answers questions via RAG and can create support tickets.

8.2 Assets

Data: internal documents, chat histories, tickets, logs, secrets
Control: system prompt, prompt templates, tool policies
Context: retrieved chunks, history, tool returns, final model context
Capabilities: document access, ticket creation, backend rights
Output: responses and ticket content
Identity: session, role, user, and tenant binding

8.3 Security Goals

  • confidentiality of internal content
  • integrity of the knowledge base, prompt composition, and tool parameters
  • authorization of every document access and tool call
  • robust tenant and context separation
  • control fidelity toward policies and guardrails
  • availability of retrieval, inference, and tool functions
  • safe downstream processing of generated output
  • auditability of security-relevant actions

8.4 Relevant Attackers

  • external users
  • insiders
  • malicious content suppliers
  • tenant attackers
  • actors with influence over tools or data sources

8.5 Key Abuse Scenarios

  1. Data disclosure through faulty retrieval
  2. Indirect prompt injection via knowledge documents
  3. Ticket tool as confused deputy
  4. Cross-session or cross-tenant leakage
  5. Manipulated tool output as a new attack vector
  6. Unsafe downstream processing of generated content
  7. Resource and cost abuse through loops or excessive tool chains

8.6 Highest-Risk Zones

Retrieval and Context Ingestion

Here, untrusted, manipulated, or incorrectly scoped content can reach the decision-relevant model context.

Tool Calls

Here, probabilistic model behavior gets translated into real actions.

Identity, Session, and Tenant Binding

Errors here directly affect data access, context, and tool scope.

Tool Feedback

Tool results are frequently treated like trustworthy facts, even though they can be manipulated, sensitive, or instructive.

Output Handling

Generated output is frequently displayed or automatically processed further. Without clear validation, text becomes a vehicle for follow-on attacks.

9. Deriving Controls from the Threat Model

A threat model is not a catalog of controls. But it does show where controls are needed and which assumptions they need to secure.

Retrieval and RAG

  • ACL- and tenant-bound filters before retrieval
  • server-side scope checking instead of prompt-based access control
  • post-retrieval authorization before context inclusion
  • classify document sources and establish ingestion governance
  • label chunks by origin, tenant, classification, and owner
  • minimize context volume
  • tests for unauthorized retrieval and unauthorized context inclusion

Prompt and Context

  • structure system, user, document, and tool content separately
  • explicitly label untrusted context
  • version prompt templates and protect them against manipulation
  • never enforce a permission decision through the prompt alone
  • bind chat history and memory to identity and scope
  • remove unnecessary secrets and internal metadata from context

Tools

  • authorization outside the model
  • least-privilege credentials per tool
  • tool, parameter, and target allowlisting
  • schema validation
  • confirmation steps for sensitive actions
  • rate and budget limits
  • audit logs tied to user, session, and policy
  • no automatic chained execution without renewed checking

Output

  • context-dependent output validation
  • sanitization for HTML and Markdown
  • no direct execution of generated SQL, code, or shell content
  • check structured outputs against fixed schemas
  • secure sensitive responses and actions with human review where appropriate

Identity, Session, and Tenant

  • centralized, server-side identity and scope decisions
  • never adopt user or tenant assignment from model output
  • bind retrieval, tool calls, and logging to the same security context
  • isolate chat histories, memories, and caches
  • tests for session mix-up and cross-tenant leakage

10. From Threat Model to Security Test

The most important quality proof of a threat model is its testability.

From the "RAG data disclosure" attack path, for example, the following test questions arise:

  • Can a user influence retrieval results outside their scope?
  • Does the candidate list already contain unauthorized chunks?
  • Are unauthorized chunks removed before reaching the model context?
  • Can the model reproduce content from disallowed chunks?
  • Does the separation hold up even under paraphrased, multi-step, and adversarially phrased requests?

The tool attack path produces different tests:

  • Can the model trigger a tool without valid server-side authorization?
  • Are tool parameters checked against user rights and permitted values?
  • Can a tool result provoke new, disallowed follow-on actions?
  • Are sensitive actions confirmed?
  • Does the audit log show which user, which session, and which policy decision led to the action?

This means the threat model forms the bridge between architecture and evaluation:

Threat Model → Hypothesis → Test Case → Evidence → Finding or No Finding

This chain prevents AI security tests from turning into a collection of clever prompts with no connection to the system.

11. Common Mistakes in AI Threat Modeling

Mistake 1: Treating the LLM as the Only Risk Carrier

This overlooks retrieval, tool authorization, tenant isolation, ingestion, and output handling.

Mistake 2: Treating Context as Passive Data Storage

Context can influence priorities, decisions, and actions. Its integrity and provenance are security-relevant.

Mistake 3: Treating Model Output as Trustworthy Business Logic

Tool decisions, parameters, and generated content have to be checked outside the model.

Mistake 4: Not Explicitly Naming Trust Boundaries

Without boundaries, it stays invisible where data gains more trust or gets translated into real effect.

Mistake 5: Formulating Risk Terms Instead of Scenarios

"Prompt injection" or "tool abuse" are not complete scenarios. Actor, goal, precondition, boundary, and impact are missing.

Mistake 6: Withholding Preconditions

An attack path is only credible when it's clear which misconfiguration or system assumption enables it.

Mistake 7: Mixing Up Reliability and Security

A bad output is not automatically a security problem. The connection to assets, rights, and impact has to be demonstrated.

Mistake 8: Treating Model Output as an Endpoint

In agent systems, it's often the beginning of a tool action or the input for the next model step.

Mistake 9: Forgetting Tool Returns

They form a second attack vector and can once again influence context, behavior, and actions.

Mistake 10: Modeling Shared Components Without a User and Tenant View

Shared infrastructure needs consistent scope enforcement. A shared vector store must not mean shared visibility.

12. Reusable Template

The following structure can be used for a compact AI threat model:

System

  • purpose and users
  • main functions
  • AI components
  • external systems and data sources
  • degree of autonomy

Components

  • frontend
  • backend / orchestrator
  • authentication
  • ingestion
  • retriever and stores
  • prompt builder
  • model
  • agent runtime
  • tool broker and tools
  • rendering
  • logging and monitoring

Assets

  • data
  • control
  • context
  • capabilities and permissions
  • output
  • identity, session, and tenant
  • availability and budgets
  • audit evidence

Security Goals

  • confidentiality
  • integrity
  • availability
  • authenticity
  • authorization
  • tenant separation
  • control fidelity
  • safe downstream processing
  • traceability

Data Flows and Trust Boundaries

For every edge:

  • source and destination
  • content
  • identity and scope context
  • trust level
  • transformation
  • downstream effect
  • existing controls

Attackers

  • access
  • capabilities
  • controlled inputs or sources
  • observable outputs
  • possible goals

Abuse Scenarios

  • actor
  • goal
  • precondition
  • abused function or boundary
  • affected assets
  • impact

Attack Paths

  • goal
  • entry point
  • preconditions
  • components
  • boundaries
  • technical sequence of steps
  • impact
  • controls
  • derived tests

Open Risks

  • unconfirmed assumptions
  • missing controls
  • unknown data sources
  • unreviewed scope decisions
  • critical tool rights
  • unclear ownership
  • missing telemetry or evidence

Conclusion

AI threat modeling doesn't start with a collection of prompts, and it doesn't end at the model. It looks at the entire application as a system of data, control, context, identities, permissions, and actions.

The most important insight is:

The most dangerous points are frequently not in the model itself, but at the transitions around the model.

That's where document content turns into control-relevant context. That's where model output turns into a tool call. That's where tool results become the basis for a decision all over again. That's where it's decided whether user, session, and tenant boundaries are really enforced.

A good threat model makes these transitions visible. It names assets and protection goals, connects them to realistic attackers, formulates plausible abuse scenarios, and translates them into testable attack paths. That turns "AI can behave strangely" into a resilient security question:

Which actor can, under which preconditions, via which boundary, violate which asset — and how do we prove that our control prevents it?

That's exactly where professional AI security begins.

Top comments (0)