AI Agent Threat Modelling: A Practical Security Methodology

AI Agent Threat Modelling: A Practical Security Methodology
✨ AI Summary

⏱️ 50 min · Intermediate · 2 hands-on labs

Imagine your team has just wired an agent to your issue tracker, your private repositories and your pull request workflow, and someone asks whether it is safe to ship. AI agent threat modelling is how you answer that with evidence instead of a shrug. You sit down with a pen, draw what the agent can read and do, and find the weak paths before an attacker does.

Here is a gap I want you to watch for in how people approach this. They reach for a classic checklist, tick the boxes for the API and the database, and miss the loop where a tool result flows back into context and steers the next action. That loop is where agents behave differently from ordinary software.

So we will do this together, step by step. You will draw an execution graph, mark trust boundaries and identities, inventory tools and MCP servers, and run a lethal trifecta audit. Then you will write threat scenarios mapped to OWASP agentic IDs and MAESTRO layers, turn them into controls, and set a review cadence. Everything runs on paper, on your own diagrams, or in the SecurityElites practice lab.

🎯 What You Will Be Able to Do

Draw an execution graph that shows every path data and control take through an agent
List the assets, trust boundaries, identities and tools of an agent system
Run a lethal trifecta audit on any agent and decide how to break it
Write threat scenarios and map them to OWASP agentic threat IDs and MAESTRO layers
Turn findings into controls such as scoped identities and parameter-bound approvals
Follow a repeatable checklist and set a review cadence for the model

✅ Before You Start

  • Basic understanding of how LLMs call tools
  • Familiarity with prompt injection concepts
  • Awareness of general threat modelling ideas such as STRIDE

The Direct Answer: What AI Agent Threat Modelling Is

I'll give you the short version first. AI agent threat modelling is a structured way to find out how an autonomous agent could be abused before it ships. You map what the agent can read, what it can do and who it acts for, then you write down how an attacker could bend each of those. The output is a ranked list of threats and the controls that answer them.

If you already know classic threat modelling, you have a head start. The difference is that an agent plans, remembers, calls tools and acts with delegated authority. It does not just answer a question and stop. That changes the work in three ways.

📖 Words I just used

AutonomyThe agent chooses its own next step, so a bad input can start a chain of actions nobody reviewed.
Non-determinismThe same input can produce different behaviour on different runs, so you cannot test one path and call it safe.
Delegated authorityThe agent holds your permissions and credentials and uses them on your behalf, so a hijacked agent acts as you.

This page is the practical method. For the wider picture of attacks and defences, read our complete guide to agentic AI security. Everything below you can practise on your own diagrams, with no live system needed.

💡 Tip: Start on paper or a whiteboard. A threat model is a thinking exercise, and the best ones are made before any code exists.

Why Classic Methods Struggle With Agents

Let me explain where the old tools wobble. A Springer chapter on MAESTRO argues that STRIDE, DREAD, PASTA, OCTAVE and LINDDUN handle agent-specific properties poorly. The properties it names are non-determinism, autonomy, agent identity and agent-to-agent communication. STRIDE still has value, but it was built for systems whose behaviour you can enumerate.

Three newer resources fill the gap. I suggest you know all of them.

📖 Words I just used

MAESTROThe Cloud Security Alliance framework for agentic AI, introduced in February 2025. It has seven layers: Foundation Models, Data Operations, Agent Frameworks, Deployment Infrastructure, Evaluation and Observability, Security and Compliance, and Agent Ecosystem. You find threats per layer, then look a
ASTRIDEA research extension of STRIDE that adds an A category for agent-specific attacks such as prompt injection, unsafe tool invocation and reasoning subversion.
OWASP agentic guidanceThe Threats and Mitigations guide lists 15 threats, T1 to T15. The Top 10 for Agentic Applications 2026, published on December 9, 2025, lists ten risks from ASI01 Agent Goal Hijack onwards.

Here is how I combine them. Keep STRIDE as a familiar checklist for ordinary parts such as APIs and databases. Use MAESTRO layers to make sure you cover the whole stack. Use the OWASP IDs as a shared vocabulary for each finding. One survey reaches a similar conclusion: defences must be coordinated across layers, because one weakness often spans several.

🧠 Quick check

Why do classic methods like STRIDE fit agents poorly?

If you want the fundamentals first, Day 6 on trust boundaries and threat modelling for AI apps is a good companion.


Step 1: Draw the Execution Graph and Name the Assets

We start the method here. A practical agent threat model begins with an execution graph, which maps every path that data and control can take. I want you to draw one for an agent you know, or for the example I use here: a support agent that reads tickets and can query a customer database. Everything runs on paper or in a text file on your own machine.

🗺️ The five paths to draw
  1. User input to model
  2. Model to tool
  3. Tool result to context
  4. Context to next model call
  5. Agent to downstream agent

Pay most attention to the third and fourth arrows. A tool result flows back into context, and context drives the next call. That loop is how one poisoned web page can steer many later actions.

🧭 Draw the graph and list assets

Step 1 — Create a fileMake a plain text file called graph.md in a scratch folder. You should have an empty file ready to fill.
Step 2 — Write one line per pathFor each of the five paths, write the source, the destination and what travels along it. For example: tool result (ticket text) to context. You should end with a numbered list of edges.
Step 3 — Mark who controls each sourceBeside every edge write user, developer or outsider. Anything an outsider can write to is a flag for Step 2.
Step 4 — List assets in six groupsData, credentials, tools, memory, models and downstream systems. Under each, name the real items, such as the customer table or the API key for the ticket system.
Step 5 — Check for gapsAsk what happens if an edge carries hostile text. If you cannot answer, add a note and carry it forward.
GRAPH.MD (EXAMPLE)
# Edges
1. user message -> model (owner: user)
2. model -> db_query tool (owner: developer)
3. ticket text -> context (owner: outsider)
4. context -> next model call (owner: mixed)
# Assets
data: customers table | credential: ticket API key | memory: case notes

A tiny example of the graph written as text. Yours will be longer.

🚫 Common mistake: Drawing only the user-to-model arrow. Most real agent incidents travel along the tool result and memory edges, which people forget to draw.

🧠 Quick check

Which edge most often carries attacker-controlled text back into the agent?

Step 2: Mark Trust Boundaries and Identities

I want you to take the execution graph from Step 1 and draw a line wherever the trust level changes. That line is a trust boundary. In AI agent threat modelling, the boundaries matter more than the boxes, because most agent attacks start with untrusted content crossing a boundary and being treated as an instruction. If you want the wider picture first, the Agentic AI Security guide covers it.

Use a pen on your own graph. Mark each arrow where text written by someone other than you flows into the model's context: a public issue, a fetched web page, an email, a retrieved document, a tool result. The model cannot reliably tell data from instructions, so all of these arrows are untrusted by default.

🧭 Mark the boundaries on your graph

Step 1 — Circle every untrusted sourceHighlight arrows carrying content from users, the web, email, files and retrieval. You should end up with several circles, not one.
Step 2 — Label tool output as untrustedA tool result is only as trustworthy as whoever wrote the data behind it. Mark it untrusted even when the tool itself is yours.
Step 3 — Label retrieved documents as untrustedAnything pulled from a knowledge base can carry planted text. RAG Security Explained shows how.
⚠️ Watch out: Never let an authorisation decision rest on model output alone. OWASP advises exactly this, and wants high-impact actions to carry a valid, unexpired, parameter-bound approval.

Next, identities. Give each agent its own unique identity and scoped credentials, and treat it as a privileged user, as NIST's draft Cybersecurity Framework Profile for AI recommends. A shared service account makes it impossible to say which agent did what, and it widens every compromise.

Last, keep secrets out of context. GitGuardian found 24,008 secrets in public MCP configuration files in 2025, and 2,117 were still valid. If a key sits in the prompt, injected text can ask the model to repeat it. Inject credentials at the tool layer instead, and give every credential an owner.

🧠 Quick check

A tool returns text from a web page your agent fetched. How should your threat model label it?

Step 3: Inventory Tools, MCP Servers and Data Flows

I want a list from you here. Good AI agent threat modelling needs a plain inventory of everything the agent can do, because the attack surface is the set of actions available once a boundary has been crossed. Do this on your own project or a lab, never by probing a system you do not own.

For each tool and each MCP server (Model Context Protocol, the standard that lets agents plug into tools), record the permissions it holds, its side effects, who owns it and where it runs. Side effects are what change in the world: files written, emails sent, tickets opened, code executed.

TOOL INVENTORY (EXAMPLE FILE)
tool | permission | side effect | owner
read_file | read repo | none | platform team
open_pr | write repo | public change | platform team
fetch_url | outbound HTTP | data can leave | unowned
mcp: tracker | read/write tickets | edits records | vendor

Keep this as a simple table in your repo. Any row with no owner is a finding already.

MCP adds attack surface of its own: third-party servers you did not write, tool descriptions the model reads as text, and credentials stored in configuration files. Treat each server like a dependency and a privileged account at once. The real MCP attacks case studies show how this goes wrong.

Next, trace data flows: where private data enters, where it travels, and where it can exit. Then run the lethal trifecta audit, a term Simon Willison coined in June 2025. Ask whether one agent combines three things.

☑️ Trifecta audit

External communication is wider than it sounds. It includes sending email, opening a pull request, fetching a URL, writing a file an attacker can see, or returning a markdown image the client loads. A CSA note found the trifecta in 98 percent of assessed agents, so expect to find it.

💡 Tip: If all three are present, you have a high-priority finding. Note which leg is cheapest to remove; that is usually your first control.

🧠 Quick check

Which counts as external communication in the trifecta?
🧪 HANDS-ON LAB · INTERMEDIATE · 20 MIN · SECURITYELITES LAB
Whose Instruction Was That? — Set Tool Rules That Stop a Hijack

This lab gives you an agent with several tools and a recorded hijack, which is a ready-made inventory exercise.

What to try
▸ List each tool the agent has and what side effect it carries
▸ Find which tools supply untrusted content and which can send data out
▸ Decide which combinations should never be allowed together
▸ Set your rules, then replay the traces

What to notice: Which tool was the outbound channel Whether blocking one leg was enough to stop the hijack


Step 4: Write Threat Scenarios and Map Them

I want you to turn your graph, assets, boundaries and tool inventory into stories now. A threat scenario is a short sentence that says who or what attacks, through which path, and what they gain. Good AI agent threat modelling lives or dies on these sentences, because a list of vague worries cannot be tested or ranked.

Start with six families. Each one maps onto the OWASP Top 10 for Agentic Applications 2026, which was published on December 9, 2025 and covers agents that plan, hold memory, call tools and act with delegated authority.

📖 Words I just used

Goal hijack (ASI01)Hidden text in content the agent reads changes its objective or task selection.
Tool misuse (ASI02)A legitimate tool is used unsafely, such as passing unvalidated output into a powerful command.
Identity abuse (ASI03)The agent's credentials are used for things its task never needed.
Memory poisoning (ASI06)Bad data is stored in memory or context and shapes later decisions.
Inter-agent trust (ASI07)One agent believes another agent's message without checking it.
Cascading failure (ASI08)One bad decision spreads through connected agents and systems.

For each scenario, tag the OWASP ID and the MAESTRO layer it touches, such as Agent Frameworks or Data Operations. This scenario-driven mapping keeps findings comparable across teams. Then rank by likelihood and impact, following the NIST AI RMF shape: Govern sets accountability, Map names threats and assets, Measure scores them, Manage picks controls.

SCENARIO TABLE
id | scenario | OWASP | MAESTRO layer | L | I
S1 | Issue text hijacks agent goal | ASI01 | Agent Frameworks | H | H
S2 | Shell tool runs unvalidated model output | ASI02 | Agent Frameworks | M | H
S3 | Poisoned note reused in later sessions | ASI06 | Data Operations | M | M

A starter table. L is likelihood, I is impact, each scored High, Medium or Low.

💡 Tip: Write scenarios as attacker, path, outcome. If you cannot name the path on your graph, the scenario is not ready.

For depth on each family, see our pillar guide on agentic AI security and the MCP attack case studies.

🧠 Quick check

Which item makes a scenario testable?

Worked Demo: Threat Modelling a Coding Agent

Let me show you the whole method on one system: a coding agent that reads public issues and opens fixes. Everything here runs in the SecurityElites lab, which is intentionally vulnerable. Never point this at a real repository you do not own.

🧭 Model the coding agent

Step 1 — Draw the graphWrite: public issue to model, model to repo tool, tool result to context, context to next call, agent to pull request. You should have five arrows on paper.
Step 2 — Name assets and boundariesAssets are private repos, a repo token and the code. The boundary sits where raw issue text enters context. Mark it in red, because anyone on the internet can write there.
Step 3 — Run the trifecta auditPrivate data: private repos. Untrusted content: public issues. External communication: pull requests, which can carry data out. All three are present, so the agent is exposed.
Step 4 — Write the scenarioS1: an outsider files an issue with hidden instructions, the agent obeys, and it copies private content into a pull request. Tag it ASI01 and Agent Frameworks, likelihood high, impact high.
Step 5 — Predict the pathWrite down, before testing, which step you expect to fail first. I would expect the point where issue text becomes context.

This pattern matches a known GitHub MCP exploit: public issues as untrusted content, private repos as data, pull requests as the exfiltration channel.

🧪 HANDS-ON LAB · INTERMEDIATE · 25 MIN · SECURITYELITES LAB
Poisoned GitHub Issue — Hijack the Coding Agent

Now confirm your predicted attack path against the lab agent, which fixes issues labelled ai-fix.

What to try
▸ Read what the agent actually receives, not only what a maintainer sees on screen.
▸ Look for any place where the agent could receive text that a human reviewer would not see.
▸ Think about how an issue could look harmless to a maintainer yet still change the agent's task, and test your idea.
▸ Compare the result with the path you predicted.

What to notice: Which boundary your prediction named, and whether it was right Which trifecta leg carried the outcome out

⚠️ Watch out: Only test the lab agent. Hidden-instruction issues filed against real projects are abuse, not practice.

Turning Findings Into Controls and Detection

A threat model that ends at a table changes nothing. I want each scenario to produce a control and a signal that proves the control works. Work down your ranked list and pair them.

🧭 Pair each threat with a control

Step 1 — Break the trifectaRemove one leg. Strip private data access, filter untrusted content, or cut the outbound channel. Removing one leg is usually cheaper than defending all three.
Step 2 — Scope capabilitiesBlock permission combinations that complete the trifecta, for example database read together with external email or HTTP requests.
Step 3 — Never authorise on model output aloneOWASP advises against it. Check permissions in code, using the user's or agent's real identity.
Step 4 — Bind approvals to parametersHigh-impact actions need a valid, unexpired approval tied to the exact parameters, plus a human checkpoint before irreversible or external actions.
Step 5 — Restrict egressSend agents that process untrusted content through output channels that cannot reach the open internet.

On to detection. Log every tool call with the agent identity, parameters, and which content sat in context. Alert on odd signals: a read-only task that suddenly writes, a new outbound destination, or a pull request touching repos outside the task.

☑️ Control verification

🧪 HANDS-ON LAB · INTERMEDIATE · 20 MIN · SECURITYELITES LAB
Whose Instruction Was That? — Set Tool Rules That Stop a Hijack

Practise writing tool rules, then replay recorded traces of a hijack to see whether they hold.

What to try
▸ List which tools complete the trifecta for this research agent.
▸ Write rules that separate untrusted-content tools from outbound ones.
▸ Replay the traces and note which calls your rules block.

What to notice: Which rule stopped the hijack, and which was never used Whether a legitimate task broke

💡 Tip: Controls you never test are guesses. Replay the scenario after every change and keep the result with the model.

Practice in the Lab and Keeping the Model Current

I want you to test your AI agent threat modelling against something that fights back, because a model on paper only tells you what you believe. A lab tells you what is true. Everything below runs in a SecurityElites practice lab, never against a real system. If you want the wider picture first, my complete guide to agentic AI security covers the attack families we have been mapping.

🧪 HANDS-ON LAB · INTERMEDIATE · 30 MIN · SECURITYELITES LAB
Poisoned GitHub Issue — Hijack the Coding Agent

Use this lab to check the model you built for the coding agent. Before you touch anything, write down which boundary, which asset and which outbound channel you expect the attack to use. Then see whether you were right.

What to try
▸ Draw the execution graph for the repository and agent before you open the lab, and mark where untrusted text enters context.
▸ Ask what the agent can read that a human maintainer never sees, and treat that as a boundary your model must name.
▸ Run the trifecta audit: list the private data, the untrusted source and the outbound action available to the agent.
▸ Write your scenario in one sentence, then attempt it and compare the result with your prediction.

What to notice: Which part of your model was wrong or missing, and which boundary you had drawn too loosely. Whether the agent's authority came from the model's output alone, with no check in between.

🧪 HANDS-ON LAB · INTERMEDIATE · 25 MIN · SECURITYELITES LAB
Whose Instruction Was That? — Set Tool Rules That Stop a Hijack

Once you have found a path, practise the defensive half. This lab asks you to set tool rules and replay recorded hijack traces against them.

What to try
▸ Read the traces and mark each tool call where the instruction came from fetched content rather than the user.
▸ Decide which tool combinations should never be available together, and why.
▸ Set your rules, replay, then tighten any rule that still lets a hijacked step through.

What to notice: Which rules blocked the attack and which only looked tidy. Whether any legitimate task broke, since over-blocking is also a finding.

Let me cover who should be in the room. Threat modelling done by security alone misses how the agent really works. Bring the engineer who built the agent loop, the owner of each connected system, someone who owns the data it touches, and a product person who knows what the agent is meant to do. Add whoever handles incident response, so detection is designed in, not bolted on.

☑️ Update the threat model when any of these happen

💡 Tip: Keep the model in the same repository as the agent code and review it in the same pull request as any change from the list above. A model that lives in a forgotten slide deck goes stale within weeks.

🧠 Quick check

Your team connects a public web search tool to an agent that already reads private customer records and can send email. What should you do first?

For next steps, work through Day 6 on trust boundaries and threat modelling for AI apps, and read real MCP attacks dissected end to end to test your tool inventory against actual cases.


Your Checklist

☑️ Agent threat model checklist

🚫 Mistakes I See Most Often

Treating the agent like a normal API and running only a STRIDE pass over the boxes.Keep STRIDE for the ordinary parts, but also draw the full execution graph including the loop from tool result back to context. Add MAESTRO layers for coverage and OWASP IDs for agent-specific threats.
Sharing one service account across several agents, or leaving keys in the prompt or in MCP configuration files.Give each agent a unique identity with scoped credentials and an owner, and inject credentials at the tool layer so the model never sees them. Search your config files for stored secrets and rotate any you find.
Finishing the table of threats and stopping, so nothing changes and the model goes stale in a slide deck.Pair every scenario with a control and a detection signal, replay the scenario after each change, and keep the model in the agent's repository so it is reviewed in the same pull request as the code.

What I Want You to Remember

An execution graph that shows every path data and control take is the foundation of an agent threat model.
Trust boundaries matter more than the boxes: mark every arrow where text written by someone else enters the model's context.
Give each agent its own scoped identity, keep secrets out of context, and never base an authorisation decision on model output alone.
The lethal trifecta is private data, untrusted content and external communication in one agent, and removing one leg breaks it.
Write each threat as attacker, path, outcome, then tag it with an OWASP ID and a MAESTRO layer so findings stay comparable.
Every scenario needs a control and a detection signal, and the model must live beside the code and be reviewed with each change.

🧠 Check Your Understanding

Which combination makes up the lethal trifecta?
What should an authorisation decision for a high-impact agent action rely on?
Where should you start an agent threat model?

❓ Questions People Ask

What is AI agent threat modelling and how is it different from traditional threat modelling?
It is a structured way to find how an autonomous agent could be abused before it ships. Traditional methods assume software that answers and stops, while an agent plans, remembers, calls tools and acts with delegated authority. So you must model the loops, the identities and the content that flows back into context.
Is STRIDE still useful for AI agents or do I need MAESTRO?
STRIDE is still a handy checklist for ordinary parts such as APIs and databases. It handles non-determinism, autonomy, agent identity and agent-to-agent communication poorly, though. Use MAESTRO layers to cover the whole stack and OWASP IDs as shared vocabulary alongside it.
What are the assets and trust boundaries in an AI agent system?
Assets include the data the agent can read, the tools and systems it can act on, its credentials and its memory. Trust boundaries sit wherever the trust level changes, especially where text from someone else, such as an issue, web page, email or tool result, enters the model's context.
How should AI agents be given identities and credentials?
Give each agent a unique identity with scoped credentials, and treat it as a privileged user, as NIST's draft Cybersecurity Framework Profile for AI recommends. Assign an owner to every credential and inject secrets at the tool layer so they never appear in the prompt.
What is the lethal trifecta for AI agents and how do you break it?
It is an agent that combines access to private data, exposure to untrusted content and a way to communicate externally. Simon Willison coined the term in June 2025. You break it by removing one leg, for example blocking outbound channels, cutting data access, or adding a human approval before external actions.
What threats does MCP add to an agent's attack surface?
MCP adds third-party servers you did not write, tool descriptions the model reads as text, and credentials stored in configuration files. GitGuardian found 24,008 secrets in public MCP configuration files in 2025. Treat each server as both a dependency and a privileged account.
How often should an agent threat model be updated and who should be involved?
Review it in the same pull request as any change to tools, data sources, identities or agent behaviour, and keep it in the agent's repository. Include the engineer who built the agent loop, owners of connected systems, the data owner and security.
🚀 Where to go next: Work through Day 6 on trust boundaries and threat modelling for AI apps, then read the real MCP attacks write-up to test your tool inventory against actual cases.

🧩 More in the Agentic AI Security series

📚 Keep Learning on SecurityElites

Written by Mr Elite. Reviewed by Mr Elite, last reviewed on .

ME
Mr Elite
Owner, SecurityElites
I teach AI red teaming and ethical hacking through hands-on labs at SecurityElites.
⚡
Join free to earn XP for reading this article Track your progress, build streaks and compete on the leaderboard.
Join Free
Lokesh N. Singh aka Mr Elite
Lokesh N. Singh aka Mr Elite
Founder, Securityelites · AI Red Team Educator
Founder of Securityelites and creator of the SE-ARTCP credential. Working penetration tester focused on AI red team, prompt injection research, and LLM security education.
About Lokesh ->

Leave a Comment