1. LLM vs software security
How language models blend the traditional distinction between executable instructions and data.
2. Attack surface
The flow of risk passes through interfaces, orchestration, context, models, responses, and tools.
3. Injection
The impact of jailbreaks and indirect instructions in retrieved content on behavior.
4. Data location
Sensitive data may escape the trust boundary and be retained in logs when entering prompts.
5. Excessive agency
The blast radius increases when tools, credentials, destinations, and autonomous loops are overpowered.
6. Security defenses
Permission controls, isolation, validation, human approval, monitoring, and rehearsed response.
Map the complete LLM application, not only the model
An LLM application consists of trust boundaries where risk originates at the interface, traverses orchestration and memory, accesses retrieved context, interacts with the model, and may manifest as real-world consequences through generated output or tools.
- Interface: direct prompt injection, jailbreaking, account abuse, and session abuse.
- Orchestration: system-prompt leakage, prompt-template injection, and poisoned memory.
- Context: Documents are indirectly injected, index entries are poisoned, and permission is bypassed during retrieval.
- Model: compromised weights, poisoned fine-tuning data, and unbounded resource use.
- Response and tools: improper output handling, excessive agency, and exfiltration through connected capabilities.

Turn every vertical boundary into an enforced control
The attack-surface visual reappears due to the intricate architecture, necessitating a thorough review at every transition point to validate identity, provenance, authorization, data classification, and permitted actions.
- Authorize access before retrieving the document instead of querying the model for user permissions.
- Categorize system policies, developer guidelines, user feedback, evidence sources, memory storage, and tool reactions based on their origin and level of trust.
- Validate output before rendering, executing, storing, or forwarding it.
- Assign specific credentials, schemas, destination rules, and budgets to each individual tool.

LLMs collapse the code-and-data boundary
Traditional application security typically relies on the separation of executable code from data. An LLM interprets system rules, user requests, retrieved documents, tool results, and memory as language, making prompt injection distinct from SQL injection due to the absence of a universal equivalent of a prepared statement in natural language that ensures data integrity.
The model can read any content, such as documents, webpages, emails, tool results, code comments, or image text, which may contain instructions. The main goal is to restrict what the model can access, reveal, execute, alter, or transmit.

Direct attacks are visible; indirect attacks hide in data
Direct injection When a user tries to bypass rules, extract prompts, or redirect an assistant, they are said to be "jailbreaking" the system, within the limitations of their existing access.
Indirect injection The model is embedded in different types of materials for the model to interpret later, such as documents, webpages, emails, code comments, tool responses, index entries, or visually hidden PDF text. A genuine user inadvertently activates the payload while performing a routine task, allowing the payload to operate with the assistant's permissions instead of the attacker's.

Follow the plant–wait–trigger–obey–exfiltrate chain
- Plant: Harmful commands are inserted into a collaborative file, ticket, website, or any other accessible source.
- Wait: the content sits in the index beside legitimate material.
- Trigger: A regular inquiry from a user leads to the selection of a contaminated passage during retrieval.
- Obey: The model views the hidden text as guidance and operates with the consent of the user or assistant.
- Exfiltrate: Data exits via a variety of channels, including an externally loaded resource, user-clicked link, or outbound tool call.
Break the chain by controlling access points: manage sources, grant permission for retrieval, limit context, restrict outbound destinations, verify output, and mandate approval for sensitive actions.

Know where confidential data can escape
- Answer leakage: The assistant retrieves or summarizes data that the user is unauthorized to access.
- System-prompt leakage: Users access internal instructions, business logic, integrations, routing rules, and embedded secrets.
- Provider boundary: Prompts and collected data exit the organization's system for model analysis.
- Logs and telemetry: Prompts, responses, retrieved passages, tool arguments, and errors can generate extra duplicates of sensitive information.
Reduce sensitive information exposure, avoid including credentials or secrets in prompts, assess provider retention and training options, implement log redaction, and establish suitable access and retention regulations.

Build five layers that reduce reach and consequence
Implement user-specific permission controls and utilize the principle of least privilege when managing access to data, tools, destinations, and credentials.
Avoid loading random images, URLs, scripts, or other external resources provided by the model.
Confirmation is necessary for important actions like payments, deletions, permission changes, and disclosing information externally.
Utilize injection detection, typed schemas, output validation, moderation, sandboxing, quotas, and allowlists for security measures
Retrieve logs and utilize tool chains, detect abnormal behavior, simulate red-team scenarios, and train incident response procedures.

Checklist for an LLM or AI assistant launch
Data and access
- Filter retrieval by the requesting user’s permissions.
- Apply consistent access, lifecycle, and deletion rules to vector indexes as with source documents.
- Keep secrets and confidential data out of system prompts.
- Find out where prompts are stored in the document and how the model provider stores or utilizes submitted content.
Actions and output
- Give each tool a separate least-privilege credential.
- Require confirmation before payments, deletion, external communication, or permission changes.
- Validate model output before rendering, execution, storage, or forwarding.
- Do not automatically load model-created external images or URLs.
Operations
- Logging prompts, retrieving RAG, generating model output, making policy decisions, granting approvals, and calling tools.
- Make security logs searchable and access-controlled.
- Limit tokens, steps, retries, elapsed time, spend, and external calls.
- Enhance incident response to include assistants, indexes, memory, models, prompts, and tool credentials.

Four principles to carry into every design review
The model does not offer a guaranteed security boundary separating trusted commands from untrusted language.
Expect that certain injections will be successful and limit the data, actions, destinations, and independence they can access.
The model must only display content that the authenticated user has permission to access.
Informed confirmation should be required for high-impact actions after showing the exact action and consequences.

Frequently asked questions
What is the LLM application attack surface?
The attack surface encompasses user interfaces, prompt orchestration and memory, retrieved context, model weights and inference behavior, generated responses, as well as all connected tools or downstream systems.
Why is RAG vulnerable to indirect prompt injection?
RAG brings in outside content to the model's context, where a tainted document or webpage may include commands that the model wrongly identifies as safe, even if a genuine user made the request.
How can LLM applications prevent data exfiltration?
Enforce user-level permissions prior to accessing data, prevent unauthorized outbound URLs and model-supplied resources, restrict tools and destinations, verify output, and mandate confirmation for sensitive or external operations.
What should be checked before launching an AI assistant?
Confirming access to user-specific data, controlled indexes, prompt without secrets, tools with minimal privileges, validation prior to rendering or execution, human verification for important actions, easily searchable logs, set resource limits, alerts, and protocols for responding to incidents.
Authoritative guidance
The control themes in this visual guide align with the OWASP Top 10 for LLMs and Generative AI ApplicationsGovernance and lifecycle practices are influenced by various factors such as prompt injection, sensitive information disclosure, data and model poisoning, improper output handling, excessive agency, system-prompt leakage, vector and embedding weaknesses, and unbounded consumption. NIST AI Risk Management Framework: Generative AI Profile.
