TL;DR: Akeyless argues that prompt injection becomes a credential theft problem when an agent can reach bearer tokens, API keys or other secrets, because the model cannot reliably distinguish trusted instructions from malicious ones inside the same input channel. Short token lifetimes limit replay, but only removing credentials from the agent’s runtime cuts the theft path.
At a glance
What this is: NHI Mgmt Group's analysis, drawing on Akeyless's blog post: Prompt injection becomes a credential theft problem when an agent can reach bearer tokens, API keys or other secrets, because the model cannot reliably separate instructions from hostile content.
Why it matters: Identity and security teams need to treat agent reach as the control boundary, because runtime access to secrets determines whether prompt injection becomes a breach path or a nuisance.
👉 Read Akeyless's analysis of prompt injection credential theft and agent reach
Context
Prompt injection is not only a language-model problem. It becomes an identity problem when an agent can see or reuse secrets during execution, because the same input channel carries both instructions and data. That is why secrets management matters here: the risk is less about whether the model is fooled than whether the agent can reach something valuable after it is.
The governance gap is straightforward. Traditional model-layer defences assume the system can judge intent inside the prompt, but indirect injection hides malicious instructions inside ordinary content such as email, tickets, or shared documents. Once the agent has access to credentials, the attack shifts from manipulation to exfiltration.
Key questions
Q: How do I prevent prompt injection from exposing API keys?
A: Prevent prompt injection from exposing API keys by keeping secrets out of model prompts, tools and retrieved context, and by giving the agent only scoped, short-lived credentials through a secrets manager or token broker. Separate the agent from direct secret retrieval, enforce allowlisted tool calls, and redact secrets from logs and prompt traces at the runtime entirely.
Q: Why do short-lived tokens not stop prompt injection attacks?
A: Short-lived tokens do not stop prompt injection because the attack manipulates the agent into using its own valid authority during the token lifetime. If the model can read or forward the token, the attacker can still exfiltrate it or trigger authorised actions before expiry, so scope, tool gating and secret isolation matter more than lifetime alone.
Q: How do indirect prompt injections reach agent workflows?
A: Indirect prompt injections reach agent workflows when malicious instructions are hidden inside content the model reads, such as emails, documents, web pages or tool output. The agent then treats those instructions as data and may pass them into planning or tool calls. Separating untrusted inputs from system prompts, using content filtering, and restricting tool permissions reduces the attack path.
Q: What signs show that an AI agent is being hijacked at runtime?
A: Look for persistent changes in tool order, repeated collection of raw outputs, unexpected document creation, and behaviour that survives restarts or task handoffs. Those signals indicate that the agent's stored workflow or memory has been influenced, not just the latest input.
Technical breakdown
Why model-layer filtering cannot reliably stop injection
Prompt injection works because the model processes instructions and content through the same interface. A paragraph that should be summarised and a paragraph that should be followed can arrive in identical form, so the model has no trustworthy way to infer intent from text alone. That makes any defence dependent on the model’s own judgment structurally weak. The real control boundary is outside the model, in what the agent can read, execute, and send. Once an injected instruction can influence tool use, the problem becomes one of runtime authority rather than prompt syntax. See the Agentic AI Security Guide.
Practical implication: Move control decisions out of the prompt path and constrain what the agent can access at runtime.
Why credential exposure changes prompt injection from nuisance to breach
A manipulated agent with no secrets can waste time or expose low-value data. A manipulated agent with bearer tokens, API keys, or session material can hand over something immediately reusable. That is why the issue is not simply injection success, but the scope of the agent’s reachable secret surface. If the credential sits in memory, config, or context the agent can inspect, the attacker has a theft target. In NHI terms, the risk is not secret storage alone, but whether the agent’s execution environment exposes the secret after retrieval. See the Secrets Management Guide.
Practical implication: Treat any secret reachable by the agent’s runtime as exposed, even if it is stored in a managed vault.
How injected data leaves the environment after the agent obeys it
Prompt injection often succeeds by redirecting an agent into channels it already trusts. Outbound HTTP requests, email sends, chat connectors, rendered links, and shared memory writes all become exfiltration paths if the agent is permitted to use them. The content can be disguised as a ticket, comment, invite, or document, but the egress path is what matters. Once the agent is allowed to emit data through an approved channel, the attack no longer needs a novel exploit, only a route out. The architectural weakness is permissive output, not just malicious input.
Practical implication: Inventory every tool and connector that can move data out of the agent, then narrow or broker those paths.
Threat narrative
Attacker objective: The attacker wants a reusable credential or data path that turns the agent’s own authority into exfiltration.
- Entry occurs when untrusted content reaches the agent through email, tickets, documents, or another ordinary input source.
- The agent obeys the injected instruction and uses its available tools, memory, or connectors to reach secrets or data.
- The stolen credential or data leaves through an approved channel such as outbound HTTP, email, chat, or shared memory.
- The attacker reuses the exposed value outside the original environment to extend access or extract more information.
Breaches seen in the wild
- Microsoft Azure OpenAI abuse by Storm-2139: Storm-2139 used API keys leaked by Microsoft customers to hijack Azure OpenAI, bypass safety guardrails and resell access to generate harmful content.
- Mailchimp breach 2022: Attackers socially engineered Mailchimp staff, used a support tool to export 102 customer lists and exposed customer API keys for phishing.
Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
Reachable credentials turn prompt injection into an identity failure, not a model failure. The decisive issue is whether the agent can access something with replay value after it obeys a malicious instruction. Once a bearer token, API key, or session artefact is in scope, the attack stops being about language understanding and starts being about delegated authority. Practitioners should judge the risk by what the agent can reach, not by whether the prompt looked suspicious.
Static secrets fail faster than their storage model suggests. A vault can keep credentials organised, but it cannot protect a secret once the agent’s runtime can inspect or copy it. That is the broken assumption: storage security is not the same as runtime isolation. The moment the secret is materialised into memory or another agent-readable surface, prompt injection has a theft target.
Prompt injection credential theft is a named control problem: reachable-secret exposure. The article shows that the weak point is not the injection alone but the path from untrusted content to a usable secret. static versus dynamic secrets matters here because short-lived credentials reduce replay time, yet the real dividing line is whether the secret ever enters an agent-executable context. The implication is that secret placement has become a governance decision, not just a secrets-management detail.
Agent containment must be judged by egress authority as much as by ingress filtering. If an agent can send email, make HTTP calls, write to shared memory, or hand data to another system, an injected instruction can convert read access into disclosure. That widens the identity problem from credential theft to delegation control. Practitioners need to evaluate which tools can move data out, not just which prompts can move data in.
What this signals
Reachable-secret exposure is the governance fault line this topic exposes. Organisations often secure the vault but leave the agent’s runtime with enough visibility to copy a secret after retrieval. The next control question is not whether a credential exists, but whether the agent can ever see it in a form that can be replayed.
Prompt injection becomes more consequential as agents gain broader connectors and richer outputs. The practical shift is toward issuance-time controls, egress narrowing, and task-scoped authority, because post-hoc review is too late once a reusable token has left the environment.
For practitioners
- Remove credentials from agent-readable runtime surfaces Keep bearer tokens, API keys, and other secrets out of memory, context windows, shell variables, and files the agent can inspect or execute from.
- Broker secret injection at execution time Use an intermediary to supply credentials only when a task needs them, so the agent never holds a reusable secret in plain text.
- Restrict tool and connector egress Limit outbound HTTP, email, chat, and shared-memory writes to the minimum necessary paths, and remove any destination the task does not require.
- Require approval for irreversible actions Put a human gate in front of external sends, funds movement, privilege changes, and other actions that cannot be safely rolled back.
- Preserve session evidence before retention expires Save prompt traces, tool calls, memory writes, and source addresses immediately so responders can reconstruct what the agent accessed and disclosed.
Key takeaways
- Prompt injection becomes a credential theft issue when the agent can reach reusable secrets during execution.
- Short-lived tokens reduce replay time, but they do not solve the underlying reachability problem.
- Containment depends on runtime isolation, egress limits, and task-scoped authority rather than model-side judgment.
Related NHI Mgmt Group resources: Secrets Management Guide · Ultimate Guide to NHIs: Static vs Dynamic Secrets · API Key Management Guide
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10, OWASP Non-Human Identity Top 10 and MITRE ATT&CK define the specific risk controls and attack patterns relevant to this term.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | ASI01 — Agent Goal Hijack | Prompt injection in this topic hijacks agent goals through untrusted content. |
| ASI02 — Tool Misuse | Injected instructions abuse permitted tools to move data out of the agent environment. | |
| Recommendation — Constrain agent goals so injected instructions cannot redirect tool use or disclosure paths. Restrict tool access so a hijacked agent cannot turn permitted tools into exfiltration paths. | ||
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | The article centres on secrets leaving agent runtime surfaces after injection succeeds. |
| NHI-04 — Insecure Authentication | Bearer tokens and API keys become exploitable when the agent can access them directly. | |
| Recommendation — Keep secrets out of agent-readable runtime surfaces and revoke any leaked credential immediately. Use stronger authentication patterns that do not expose reusable secrets to the agent. | ||
| MITRE ATT&CK | TA0006;TA0010 — Credential Access; Exfiltration | The attack chain moves from secret access to data leaving the environment. |
| Recommendation — Map the chain to credential access and exfiltration to prioritise detection and containment. | ||
Key terms
- Prompt Injection (Agentic): An attack on applications built on large language models, where crafted text in a prompt or in content the model reads, such as a document, web page or email, overrides the intended instructions. OWASP lists it as LLM01:2025. It becomes most dangerous when an agent can call tools, because the injected instruction can run actions using the agent's own legitimate credentials.
- Indirect Prompt Injection: Indirect prompt injection is an attack where malicious instructions are hidden inside content that an AI system reads later. The model may treat that content as context rather than as hostile input, which can influence tool use, data access, or workflow actions if controls are weak.
- Bearer Token: A bearer token is a credential that grants access to whoever possesses it, without requiring strong proof that the holder is the intended client. In NHI environments, that makes theft and replay the main risk, especially when tokens are long-lived, broadly scoped, or stored in local files.
- API Key: A unique identifier used to authenticate a software application or service when calling an API. API keys are static, long-lived credentials and a major source of secrets sprawl, so they need careful storage, narrow scoping, regular rotation, monitoring for leakage and prompt revocation when no longer needed.
What's in the full article
Akeyless's full blog post covers the operational detail this post intentionally leaves for the source:
- The four documented case studies and their exact injection paths
- The first-hour response sequence for suspected prompt injection credential theft
- The control-by-control breakdown of containment options for agent runtime secrets
- The article's discussion of where stolen data tends to go after exfiltration
👉 The full Akeyless post covers the attack chain, containment options, and first-hour response detail.
Deepen your knowledge
NHI governance, agentic AI identity, and machine identity security are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are building or maturing an identity security programme, it is worth exploring.
Published by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org