Direct prompt injection happens when someone interacting with the AI tries to override its instructions through their own input. It overlaps significantly with jailbreaking and is generally the lower-severity case in an enterprise context, because the attacker is typically limited to their own session and their own existing permissions.
Indirect prompt injection is where the enterprise risk concentrates. The attacker never touches the AI system directly. Instead, they plant instructions inside content they know or suspect the AI will eventually process: a resume submitted to a hiring pipeline, a webpage an AI browsing agent will visit, a PDF attached to a support ticket, a field in a CRM record synced into a knowledge base. The legitimate user — the employee running the AI assistant — never sees the malicious instruction at all. They just see the AI's output, which may look completely normal even when something has gone wrong underneath it.
This is why indirect injection matters more for agentic systems specifically. Any AI that automatically ingests external or third-party content as part of its job is exposed to it by design, whether or not anyone at the company ever interacts with the attacker.
Prompt Injection vs. Jailbreaking
These two terms get used interchangeably in casual conversation, and that's a mistake worth correcting.
Jailbreaking is an attempt to get a model to bypass its own safety training or content policies — getting it to produce output it was designed to refuse, using role-play framing, hypothetical scenarios, or adversarial phrasing. Jailbreaking is fundamentally about the model's content boundaries.
Prompt injection is about overriding a system's task instructions, using untrusted content as the delivery mechanism. It's not necessarily trying to get the model to say something forbidden — it's trying to get an AI application to do something other than what it was built to do, often through data the model was never supposed to treat as instructions in the first place.
They overlap in practice. A jailbreak prompt can be delivered through an indirect injection vector, and a successful injection sometimes works by getting the model to temporarily set aside its instruction hierarchy — a jailbreak-like effect used in service of an injection goal. But they're different threat categories with different fixes. Content filtering and refusal training address jailbreaking. Trust boundaries, permission scoping, and treating external content as data rather than instructions address prompt injection. A security program that only accounts for one of these will have a real gap in the other.
How Prompt Injection Can Lead to Credential Theft
This is one of the more serious downstream consequences, and it deserves a direct explanation rather than a vague warning.
AI agents frequently need to authenticate to other systems — an email client, a CRM, a cloud storage bucket, an internal API — to do their jobs. That authentication is usually handled through API keys, OAuth tokens, service-account credentials, or session data that the agent holds or can request. None of that is inherently a problem. It becomes one when a successful prompt injection can get the agent to use that access on the attacker's behalf, or to expose it.
The general risk pattern looks like this: an attacker doesn't need your API key if they can convince your AI agent — which already has valid access — to retrieve the data they want and hand it over in a response, or to perform an action using credentials it already holds. In some poorly scoped deployments, an injected instruction could also get a model to reveal configuration details, tokens embedded in its context, or connection strings it was never meant to surface, simply by asking for them in a way the model doesn't recognize as a sensitive request.
We're intentionally not walking through specific techniques for extracting credentials this way — that's not useful information for a defensive audience, and it's exactly the kind of detail that shouldn't be published as a how-to. What matters for a security or IT leader is the underlying principle: the AI agent's own permissions are the actual attack surface. If an agent authenticates with a broad, standing set of privileges rather than scoped, task-specific access, a single successful injection can inherit all of it. This is why least-privilege design for AI agents isn't a nice-to-have. It's the control that determines whether an injected prompt is a minor annoyance or a credential-level incident.
Can Emails and Documents Carry Prompt Injection Attacks?
Yes, and this is one of the most common real-world vectors, because so much enterprise AI deployment is built around reading and summarizing exactly this kind of content.
An AI assistant that automatically processes emails, attachments, PDFs, support tickets, or CRM notes is, by design, reading content written by people outside the organization's control. Hidden instructions can be placed in:
- The body of an email, sometimes in small or white-on-white text meant to be invisible to a human reader but fully readable by the model
- PDF metadata or text layers that a human skimming the document would never notice
- A support ticket description, formatted to look like normal customer language until a specific trigger phrase
- A CRM field synced from a web form, where an attacker fills in a "company name" or "notes" field with an injected instruction instead of real data
Consider a realistic scenario: a company uses an AI assistant to triage inbound sales inquiries and draft first-touch email responses. An attacker submits an inquiry through the public contact form with a message that reads normally to a human but includes an embedded instruction telling the assistant to also CC an external address on all future correspondence in that thread, or to include internal pricing notes it has access to as context. The human sales rep sees a plausible lead. The assistant, reading the same text, may see something else entirely.
This is also why "our AI just reads and summarizes, it doesn't take actions" is a weaker safety argument than it sounds. Even a read-only summarization assistant can be manipulated into producing a summary that omits, distorts, or leaks information, and if that summary feeds into a decision or gets forwarded automatically, the downstream effect is real regardless of whether the model itself "acted."
Can Tool Outputs Contain Prompt Injection?
Yes — and this is a piece of the picture that gets less attention than input-side injection, even though it's structurally identical in risk.
When an AI agent calls a tool — a web search, a database query, an API, a document retrieval system — the response that comes back is treated as data the model should reason about. But that response was generated somewhere outside the model's control, and if any part of the underlying system was compromised, manipulated, or simply contains attacker-planted content, the "tool output" can carry the same kind of hidden instructions as a malicious email.
This applies to:
- Search results, where a webpage indexed by the AI's browsing tool contains embedded instructions
- Database or API responses, where a field was populated by an untrusted external source
- CRM records synced from public-facing forms
- Retrieved documents in a RAG system
- Outputs from one AI agent that get passed as input to another, in multi-agent setups
The security principle here is one line, and it's worth stating plainly: data returned by a tool should be treated as untrusted data, not automatically as instructions. That sounds obvious written down, but a lot of agent frameworks default to feeding tool output straight back into the model's context with the same trust level as the system prompt. For a simple single-tool chatbot, that's a manageable risk. For a multi-step agent chaining several tool calls together, where the output of one call becomes the input driving the next decision, an injected instruction in step two can steer everything that happens in steps three through six. This is part of what security researchers now describe as the "lethal trifecta" for agentic systems: an agent that can process untrusted content, has access to sensitive data, and has a way to communicate externally is, by combination, exposed to this entire class of attack — regardless of how well any single component is secured.
Prompt Injection in RAG Systems
Retrieval-augmented generation — RAG — connects a language model to an external knowledge source: a vector database of internal documents, a wiki, a customer knowledge base. Instead of relying only on what the model learned during training, the system retrieves relevant passages at query time and feeds them into the model's context.
RAG makes AI systems dramatically more useful for enterprise work, and it also expands the attack surface in a specific way. The model is now trusting content it didn't generate and that wasn't part of its training — content pulled live from sources that may include documents written, uploaded, or edited by people outside the security team's control.
Two related but distinct risks show up here:
RAG poisoning is the act of getting malicious content indexed into the knowledge source in the first place — submitting a document, wiki edit, or file that contains hidden instructions, with the expectation that it will eventually be retrieved and fed to the model.
Indirect prompt injection through retrieval is what happens when that poisoned content actually gets pulled into a live query and influences the model's output or actions.
They overlap constantly in practice — poisoning is usually the delivery mechanism, injection is the effect — but they're worth naming separately because the defenses are different. Stopping poisoning means controlling what gets indexed in the first place: source validation, access controls on who can contribute to a knowledge base, and content review for anything ingested from outside the organization. Stopping the injection effect means treating retrieved passages as untrusted at the point they enter the model's context, no matter how trusted the knowledge base as a whole is assumed to be.
Prompt Injection and AI Agents
This is where prompt injection stops being a theoretical concern and becomes a genuine enterprise security priority.
An AI chatbot that answers questions has a limited blast radius. It can say something wrong or embarrassing, and that's a real but bounded problem. An AI agent is a different category of system entirely — one that can read files, send emails, query databases, browse the web, call APIs, modify records, and execute multi-step workflows, often with minimal human review of each individual step.
The severity of prompt injection scales directly with what the agent is allowed to do. An agent with read-only access to a public FAQ carries almost no injection risk. An agent connected to a company's CRM, email system, and internal APIs, with permission to send communications and update records autonomously, carries substantial risk if it processes any untrusted content at all.
Picture an AI agent deployed to handle vendor onboarding: it reads incoming vendor documentation, extracts relevant fields, checks the vendor against an internal database, and updates procurement records automatically. An attacker submitting fraudulent vendor documentation could embed an instruction directing the agent to approve the vendor regardless of verification results, or to flag a legitimate competitor's documentation as suspicious. No credentials were stolen. No system was hacked in the traditional sense. The agent just did exactly what a piece of text told it to do, because nothing in its design distinguished "instructions from the person who built me" from "text found inside a document I was asked to process."
This is the core argument for why prompt injection belongs in enterprise cybersecurity planning rather than being treated as an AI product quirk: the more autonomy and access you hand an AI system, the more that system becomes a proxy for whoever can successfully talk to it — including people who were never supposed to have a voice in the conversation at all.
What Is a Prompt Injection Firewall?
A prompt injection firewall is a security control that sits between users, external content, and the AI model, inspecting inputs — and sometimes outputs — for patterns associated with injection attempts before they reach the model or before a resulting action executes. It can flag or block suspicious content, but it cannot guarantee that every attempt gets caught, because language is flexible and attackers actively test around known detection patterns.
At a technical level, most prompt injection firewalls look for things like instruction-override phrasing, role-manipulation language, encoded or obfuscated text designed to evade filters, and structural anomalies in content that shouldn't normally contain instructions at all — a resume with a paragraph of imperative-sentence text buried in the footer, for instance. Some products extend this to monitoring model outputs and tool calls as well, not just the initial prompt.
What it can't do is guarantee coverage. It's pattern and heuristic detection layered on top of a fundamentally probabilistic system, which means there's no version of this control that catches everything, every time, forever. Anyone selling a prompt injection firewall as a complete solution to prompt injection is overselling the product.
How Does a Prompt Injection Firewall Work?
Conceptually, most implementations follow a similar flow:
Input inspection → policy and risk analysis → suspicious content detection → request allowed, blocked, sanitized, or escalated for review → AI model processes the (cleared) input → output and action monitoring
The first stage looks at what's coming in — a user prompt, a retrieved document, an email being summarized — and evaluates it against known injection patterns, anomaly detection, or classifier models trained to spot manipulation attempts. Content that looks clean passes through. Content that trips a rule gets blocked outright, stripped of the suspicious portion, or routed for human review, depending on how the policy is configured.
The part often left out of vendor explanations is that inspecting the initial prompt is only one layer. A serious AI security posture also needs visibility into what happens after that point: what content gets retrieved during the session, what tools the model decides to call, what those tools return, what actions actually execute, and whether sensitive data is moving anywhere it shouldn't. A firewall that only checks the first message a user types and stops watching after that misses the majority of what makes agentic prompt injection dangerous in the first place.