Frequently Asked Questions

Understanding Prompt Injection Credential Theft

What is prompt injection and how does it lead to credential theft?

Prompt injection is an attack where malicious instructions are embedded in text that a language model or AI agent processes. If the agent has access to credentials (like API keys or tokens), a successful injection can cause the agent to exfiltrate these credentials to an attacker. This can happen directly (typed by the attacker) or indirectly (hidden in content like emails, invites, or support tickets). The risk is highest when the agent can access sensitive data in its runtime environment.

What are some real-world cases of prompt injection credential theft?

Four documented cases include:

All were discovered by researchers and, except for AWS Bedrock, have been fixed or mitigated. None involved confirmed attacks on real users.

Why can't prompt injection be fully prevented at the model layer?

Prompt injection exploits the fact that instructions and data reach language models through the same channel. The model cannot reliably distinguish between text it should process and instructions it should ignore. As a result, any defense relying solely on the model's judgment is inherently limited. This is why OWASP lists agent goal hijack as a top risk for agentic applications. (Source: OWASP Top 10 for Agentic Applications 2026)

What is indirect prompt injection?

Indirect prompt injection occurs when malicious instructions are delivered through content the agent processes, such as emails, calendar invites, support tickets, or shared documents. The attacker never interacts directly with the agent, and the victim may not see the malicious text. All four documented cases on this page involved indirect prompt injection.

Can prompt injection steal API keys or tokens?

Yes, if the agent can access them. API keys or tokens stored in environment variables, configuration files, context, or process memory are vulnerable if the agent is instructed to retrieve them. The safest approach is to ensure the agent never holds sensitive credentials in its runtime environment.

Do short-lived tokens prevent prompt injection credential theft?

No. Short-lived tokens reduce the window during which a stolen credential can be used, but prompt injection credential theft occurs while the token is valid. The most effective mitigation is to keep credentials out of the agent's reach entirely, for example by using brokered or just-in-time access methods.

What are the main ways stolen data leaves an AI agent during a prompt injection attack?

Stolen data can be exfiltrated through channels the agent already has access to, including:

What are the most effective controls to contain prompt injection credential theft?

The most effective controls include:

  1. Never allowing credentials to reach the agent's runtime (e.g., using a broker that injects them only in transit, as in Akeyless SecretlessAI).
  2. Issuing per-task access, so a successful injection only grants access briefly and to a limited scope.
  3. Allowlisting egress destinations to prevent unauthorized data exfiltration.
  4. Requiring human approval for irreversible actions.
  5. Logging all prompts, intents, decisions, and actions for forensic analysis.

What should you do in the first hour after discovering a prompt injection credential theft incident?

Immediate steps include:

  1. List every credential the agent could have accessed during the session.
  2. Revoke each credential at its source—scheduled rotation is too slow for already-compromised credentials.
  3. Pull audit logs and look for unusual usage patterns (new source addresses, odd hours, unfamiliar endpoints).
  4. Preserve the context window, tool-call logs, and memory writes before retention policies delete them.

How can you detect if an AI agent has been hijacked by prompt injection?

Detection relies on monitoring for behavior that deviates from the agent's normal tasks, such as use of rarely accessed tools, connections to new domains, unusual data volumes, or activity at odd hours. Effective detection requires per-agent attribution, so anomalies can be linked to specific agents.

Skip to content

How Prompt Injection Turns into Credential Theft

How Prompt Injection Turns Into Credential Theft

An injected instruction is only as dangerous as what the agent can reach. A manipulated agent with no credentials can embarrass you; one holding a bearer token can hand it to a stranger. Prompt injection credential theft follows a consistent chain: untrusted content reaches the agent, the agent obeys it, and something valuable leaves.

Four documented cases come first, followed by where stolen data goes, which controls limit the harm, and the first hour.

Why Can’t Prompt Injection Be Fixed at the Model Layer?

Instructions and data reach a language model through the same channel, and the model has no reliable way to tell a paragraph it should summarize from one telling it what to do. Any defense that depends on the model’s judgment inherits that weakness. OWASP’s Top 10 for Agentic Applications lists agent goal hijack first, and Akeyless maps each of the OWASP agentic AI risks to identity controls.

A direct prompt injection attack comes from the person typing. Indirect prompt injection arrives inside content the agent processes: a calendar invite, a support ticket, a README, a form field. All four cases below are indirect.

Four Documented Cases

CaseDisclosedHow the injection arrivedWhat leftFound by
EchoLeak (CVE-2025-32711), Microsoft 365 CopilotJune 2025An email Copilot retrieved while answering a related questionContext data, via an auto-loading image linkAim Labs
Comet agentic browserMarch 2026A calendar invite, triggered when the user handed the meeting to CometLocal files; in a demo, a 1Password vault loginZenity Labs
AWS Bedrock AgentCore harnessSeptember 2026A hidden HTML comment in a support ticketA service account’s bearer tokenUnit 42
ShareLeak (CVE-2026-21520), Copilot StudioApril 2026A SharePoint form comment posing as a system messageCustomer records, sent by emailCapsule Security

None involved confirmed attacks on real users. Researchers found and disclosed each, and three have been fixed or mitigated.

EchoLeak (CVE-2025-32711)

Aim Labs phrased the email for its human reader, which slipped it past Copilot’s injection classifier. The data rode out on an image link that loaded automatically through an allowed Microsoft domain. Microsoft rated it 9.3 and fixed it server-side.

Comet Agentic Browser

In research by Zenity Labs, the agent read local files and, in a separate demo, used 1Password’s unlocked extension to open the vault. OECD.AI logged it as an AI incident, and both vendors shipped mitigations in early 2026.

AWS Bedrock AgentCore Harness

In a Unit 42 lab setup, the ticket told the agent to download and run a script. The default-on shell tool shared the harness’s privileges, so the script read the harness’s memory and extracted a Cognito bearer token, later replayed from an outside machine holding no AWS credentials. The researchers needed a more permissive model after the default refused; AWS closed the report as informative.

ShareLeak (CVE-2026-21520)

In a test by Capsule Security, Copilot Studio treated the form comment as trusted instructions, queried connected SharePoint lists, and emailed customer records outside. Being flagged by the platform’s safety layer did not stop the email. Microsoft fixed it in January 2026.

What AgentCore Shows About Vaulted Credentials

The AgentCore token sat in AgentCore Identity, AWS’s managed vault for agent credentials, which is what most guidance recommends. Storage was never the weak point: the exposure began when the harness put the token, in plaintext, into memory the agent’s own shell tool could read.

Unit 42 does not give the token’s lifetime, and for this attack it was not the deciding factor. Expiry limits how long a stolen token can be replayed. It cannot prevent the theft, because the attacker reads the credential during its useful life. Against prompt injection credential theft, short lifetimes shrink the aftermath; keeping the credential out of anything the agent can execute or inspect removes the target.

THE QUESTION TO ASK
A vault protects a credential until something retrieves it. Where does the retrieved value live next, and can the agent reach that place?

Where Does the Stolen Data Go?

AI data exfiltration uses channels the agent already has. Watch these four:

  • Outbound HTTP from any tool the agent may call, the way Comet’s file leak left.
  • Rendered images or links whose URLs carry encoded data, the route EchoLeak used.
  • Email, chat, and connector sends the agent is permitted to make, as in ShareLeak.
  • Writes to a shared memory store or vector database that another agent reads later.

What Contains the Damage?

Guardrails reduce how often injection succeeds; ShareLeak shows they do not govern what happens after. Containment, in order of effect:

  1. Never let credentials reach the agent’s runtime. A broker that injects them in transit leaves nothing in memory to read, the design Akeyless SecretlessAI uses to keep the credential out of the agent.
  2. Issue per-task access. Tools that scope access to the task mean a successful injection opens one thing, briefly, and zero standing privileges leave nothing open between tasks.
  3. Allowlist egress, so AI data exfiltration has no destination to reach.
  4. Put a person in front of irreversible steps, such as sending funds, sharing externally, or changing who can sign in.
  5. Log prompt, intent, decision, and action for every step, so responders can size the damage. See what the agent does next for control after sign-in, part of securing LLM applications end to end.

Your First Hour After an Incident

  1. List every credential the agent could resolve that session, not only the suspect one.
  2. Revoke each at its source. A scheduled rotation is too slow for a credential an attacker already holds.
  3. Pull the audit trail and look for use that breaks the agent’s usual pattern: new source addresses, odd hours, unfamiliar endpoints.
  4. Preserve the context window, tool-call logs, and memory writes before retention deletes them.

For one outside the lab, see our analysis of a real credential-driven breach.

FAQs About Prompt Injection Credential Theft

What Is Prompt Injection?

A prompt injection attack smuggles instructions into text a language model processes, so the model follows the attacker instead of its user, whether typed directly or hidden in content the agent reads.

Can Prompt Injection Steal API Keys?

Yes, if the agent can reach them. API keys in environment variables, config files, context, or process memory are readable by an agent told to look. An agent that never holds a key has none to give up.

Do Short-Lived Tokens Stop Prompt Injection Credential Theft?

No. They shorten the replay window, but prompt injection credential theft happens while the token is valid. Short-lived credentials work best combined with keeping the token out of the agent’s reach entirely.

What Is Indirect Prompt Injection?

Injection delivered through content instead of typed by the attacker: an email, an invite, a ticket, a shared document. The attacker never talks to the agent, and the victim may never see the malicious text.

How Do You Detect That an Agent Has Been Hijacked?

Watch for behavior that departs from its task: rarely used tools, new domains, unusual data volumes, odd hours. Detection depends on per-agent attribution, since an anomaly only shows in an agent you can tell apart from others.

Related Resources

View all
Illustration of a secretless AI agent using Akeyless runtime authority
Blog How We Put Zero-Secret AI Agents to Work

Summary: Secretless access and runtime authorization are important concepts in AI agent security, but what do they look like in practice? At Akeyless, we…

November 15, 2026
  • G2 Fall 2026 Leader — Non-Human Identity Management
  • G2 Fall 2026 Momentum Leader — Privileged Access Management
  • G2 Fall 2026 High Performer — Certificate Lifecycle Management
  • G2 Fall 2026 Easiest To Do Business With — Secrets Management
  • G2 Fall 2026 Easiest To Use — Privileged Access Management, Enterprise
  • G2 Fall 2026 Best Support — Privileged Access Management, Enterprise