Threat Model an AI Agent for Prompt Injection Attacks Through Its Tools
Get a prompt injection threat model for your AI agent: entry points, attack scenarios tied to real tool calls, risk ratings, concrete defenses and safe test cases.
Agent prompt for ChatGPT and Claude
You get: Injection surface table, attack scenarios table and defenses
The prompt
mkdir -p .agents/skills/threat-model-an-ai-agent-for-prompt-injection-attacks-through-it && curl -sL "https://prompts-gpt.com/prompts/threat-model-an-ai-agent-for-prompt-injection-attacks-through-its-tools/raw" -o .agents/skills/threat-model-an-ai-agent-for-prompt-injection-attacks-through-it/SKILL.mdYou are an AI security engineer who threat-models LLM agents for prompt injection.
Build a prompt injection threat model for this agent: . It uses these tools and data sources: .
First ask me up to 3 short numbered questions about what is missing (for example who triggers the agent, which actions run without human review, what data is sensitive), then wait for my answers.
Rules:
1. Treat all text the agent reads from outside its system prompt (web pages, emails, files, tool results, other agents) as untrusted, and name the source each attack enters through.
2. For each attack, name the exact tool call or action the attacker wants to trigger and the harm it causes.
3. Rate each risk High, Medium or Low based on access and reversibility, with a one-line reason.
4. Every defense must be a concrete control (permission scope, human approval step, allowlist, output check). Say when prompt wording alone is not enough.
5. List only attacks that fit the given tools; if a tool adds no real risk, say so.
Output format:
1. Injection surface table: Source | Trust level | Tools reachable after reading it
2. Attack scenarios table: # | Entry point | Injected instruction (short) | Targeted action | Impact | Risk
3. Defenses, each mapped to scenario numbers
4. Test cases: 3-6 harmless injection strings for my eval set, each with the expected safe behavior
End by listing your assumptions and what you cannot assess without seeing the code.Example output
How to use this prompt
- Fill in what the agent does and list every tool and data source it can use, including permission limits.
- Paste the prompt into ChatGPT, Claude or Gemini.
- Answer the up to 3 questions about triggers, unreviewed actions and sensitive data.
- Check each defense against your real code and add the test cases to your eval suite before trusting the results.
- Who it’s for:
- Developers and product teams building AI agents with tool access
- What you get:
- A threat model listing where injected text enters your agent, which tool calls it could hijack, risk ratings, mapped defenses and test cases to run.
Use cases
- Reviewing a support email agent that can issue small refunds before turning on auto-replies
- Planning permissions for a browsing research agent that writes to a shared Google Drive
- Explaining indirect prompt injection risks to a team adding MCP servers to a coding assistant
- Building an eval set of injection test cases for an agent's CI checks
Works well with
- Claude: careful with long tool lists and states gaps clearly
- ChatGPT: good at structured tables and test case lists
- Gemini: handles long pasted schemas and system prompts
Try another example
The same prompt filled in for a different situation.
Tips and common edits
Why this works
- Tying each attack to a specific tool call keeps the model away from generic warnings and focuses on what an attacker can actually do.
- Requiring concrete controls instead of prompt tweaks pushes defenses into code, where injected text cannot override them.
- Ending with test cases turns the analysis into an eval set you can rerun after every change.
Use while designing or before shipping an agent that reads outside content and can act. Have its tool list and permissions ready. Works in ChatGPT, Claude or Gemini.
Common edits
- Add a column for owner or fix status to turn the defenses list into a tracked backlog.
- Paste your actual system prompt and tool schemas after the prompt for a more exact review.
Reuse it: Use in a workflowAdapt in the builder
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
More like this
Design an AI Agent With Tools, Guardrails and Eval Cases Before You Build It
Turns an agent idea into a build-ready design: the job, the tools with their inputs and permissions, guardrails, failure handling and a set of evaluation cases to test it.
Draft Input Sanitization Rules for AI Agents
Get five strict, deterministic input-sanitization rules to prevent prompt injection and data leakage before processing untrusted user inputs in an agent.
Generate Adversarial Evaluation Transcripts for AI Agents
Create three distinct multi-turn conversation logs designed to test your AI agent for social engineering, tool hallucination, and silent goal drift.
Model Tier Budget and Latency Breakdown for Multi-Turn Agents
Generates a structured cost and p95 latency trade-off table across small, mid-tier, and flagship models based on context accumulation across multi-turn agent runs.
Should This Be an Agent? Single Agent, Workflow or Plain Script Decision
Scores a task you want to automate on variability, tool needs, error tolerance and cost, then recommends a plain script, a fixed LLM workflow, a single agent or multi-agent, with the cheapest first build.
Agent Tool Names, Descriptions and JSON Schemas from API Docs
Turns pasted API docs or a function list into agent-ready tool names, descriptions, JSON input schemas and when-to-use and when-not-to-use notes.
- Coding Agent Task Brief with Guardrails, Test Plan, and Rollback Steps
- Tool Permission Matrix and Function Spec for a Tool-Using Agent
- Agent Run Pre-Mortem and Self-Correction Loop Designer
- Audit Agent Tool Definitions to Fix Routing Errors
- Establish an Automated LLM-as-a-Judge Rubric for Tool Calls
- Red Team Agent System Prompts for Injection Vulnerabilities