AI software adds new trust boundaries to familiar application security. User prompts, retrieved documents, model responses, external tools, memory, and third-party model services can each carry untrusted data or trigger an action.

This guide gives product, engineering, security, and governance teams a practical threat-modeling process. It complements Mimic Software's AI agent architecture guide by focusing on abuse paths and controls.

Table of Contents

  1. Map the AI system and its trust boundaries
  2. Treat prompt injection as untrusted input crossing control layers
  3. Control sensitive data in prompts, retrieval, output, and logs
  4. Give tools narrow permissions and predictable failure behaviour
  5. Review the model, data, and integration supply chain
  6. Test abuse cases, monitor decisions, and prepare incident response
  7. Frequently Asked Questions
  8. Conclusion

Map the AI system and its trust boundaries

Draw the complete request path from user interface to orchestration, model, retrieval store, tools, databases, and third-party services. Include background jobs, evaluation systems, support access, logs, and analytics. Mark where data changes format, crosses an organisation boundary, or gains new permissions.

List assets and harms, not only components. Sensitive records, proprietary prompts, credentials, model outputs, tool actions, customer decisions, and audit evidence all need protection. Define what an attacker, malicious insider, compromised document, or careless user could try to obtain or change.

Treat prompt injection as untrusted input crossing control layers

Direct injection comes from the user. Indirect injection can arrive inside a web page, email, PDF, knowledge-base article, image metadata, or tool result. The model may follow hostile instructions because it cannot reliably separate data from authority. A hidden system prompt is not a security boundary.

Keep policy decisions outside the model. Validate tool arguments, allowlist destinations, constrain file and network access, and require approval for high-impact actions. Label retrieved content as untrusted and limit how much it can influence orchestration. Test attacks that try to reveal secrets, override rules, or chain several low-risk tools into a harmful result.

AI software threat modeling workflow

Control sensitive data in prompts, retrieval, output, and logs

Minimise what reaches the model. Redact or tokenise sensitive fields where possible, separate tenants, filter retrieval by the caller's identity, and prevent broad indexes from bypassing application permissions. Check model-provider retention, regional processing, training use, and subprocessors before sending protected data.

Outputs can leak information through summaries, citations, generated files, or repeated probing. Apply output checks that match the use case and log access decisions without copying unnecessary secrets into observability systems. Establish retention and deletion rules for prompts, responses, feedback, and evaluation datasets.

Give tools narrow permissions and predictable failure behaviour

An agent should receive the minimum tools and scopes required for the current task. Use short-lived credentials, separate read and write operations, enforce tenant and resource checks in the tool, and make risky actions idempotent where possible. Never depend on the model to remember an access rule.

Require human confirmation for payments, deletion, external messages, account changes, or regulated decisions. The confirmation screen should show the exact action and data, not a vague request to continue. Rate limits, spend limits, transaction limits, and kill switches reduce damage when the model or an integration behaves unexpectedly.

Review the model, data, and integration supply chain

Track model versions, endpoints, libraries, vector databases, plug-ins, evaluation tools, and data sources. A provider change can alter behaviour without an application release. Pin versions where possible, review release notes, test upgrades, and keep a rollback route.

Protect training and evaluation data from poisoning. Record provenance, licences, transformations, reviewers, and approval state. Scan uploaded files and isolate parsing workloads. Apply normal software controls such as dependency scanning, secret management, signed builds, and environment separation to the AI components as well.

AI software security review matrix

Test abuse cases, monitor decisions, and prepare incident response

Create tests from the threat model: instruction override, cross-tenant retrieval, secret extraction, unsafe tool calls, excessive agency, malformed files, denial of service, and policy bypass in another language. Run them against each material model or workflow change. Combine automated evaluation with human review.

Monitor denied actions, unusual retrieval patterns, repeated prompt attacks, permission failures, output filters, latency, cost spikes, and model-version changes. Incident plans should explain how to disable a tool, rotate credentials, remove a compromised document, notify affected teams, preserve evidence, and fall back to a non-AI workflow. Link this work to the wider cloud security architecture.

Frequently Asked Questions

Is prompt injection the same as a jailbreak?

A jailbreak usually tries to bypass model behaviour rules. Prompt injection tries to make an AI application follow untrusted instructions, often to access data or tools. They can overlap.

Can input filtering stop prompt injection?

Filtering helps with known patterns but cannot be the only control. Strong systems restrict permissions, validate actions, isolate data, and keep policy decisions outside the model.

Should AI agents have administrator access?

No. Give each workflow the narrowest permissions it needs, for the shortest useful time, with approval for high-impact actions.

What should be logged?

Log identities, data sources, model and prompt versions, tool requests, access decisions, approvals, failures, and security events while minimising sensitive content.

Conclusion

Threat modeling turns AI security from a list of model risks into a map of concrete assets, trust boundaries, abuse paths, and controls. Start before launch, then update the model whenever tools, data sources, permissions, or providers change.

Explore Mimic Software's development services or contact the team to plan a secure AI product architecture.

Test the whole tool chain, not only the model response

Prompt injection often becomes serious when a model can search files, call APIs or send output to another system. Map every tool, the data it can reach and the actions it can take. Give each tool the smallest permission it needs, validate its arguments and require confirmation before actions that change records, disclose information or contact another person.

Include indirect attacks in testing. A malicious instruction can arrive inside a web page, support ticket, document or retrieved knowledge article. The system should treat retrieved content as data, not as authority to change its rules. Log the source that influenced an answer so reviewers can trace a failure without exposing sensitive content in ordinary analytics.

Define a response plan for AI-specific incidents

Decide how the team disables a tool, revokes a credential, removes a poisoned document and rolls back a prompt or model release. Name the people who can make those changes outside normal deployment hours. Preserve enough evidence to investigate the incident while respecting retention and access limits.

Run the plan as an exercise before launch. A tabletop test will often reveal missing ownership, slow approval paths or logs that cannot answer basic questions. Update the threat model after every major integration, model change or new data source because the attack surface changes with the product.