Independent analysis by NHI Mgmt GroupSource article: Akeyless, “Your AI Agent Is Leaking Credentials Where You Aren’t Looking” (November 5, 2026)

TL;DR: Akeyless shows that print and console statements caused 73.5% of the credential vulnerability issues in a 2026 study of more than 17,000 AI agent skills. Repository scanning alone cannot govern credentials that appear in logs, traces, memory and agent-to-agent messages.


At a glance

What this is: NHI Mgmt Group's analysis, drawing on Akeyless's research: AI agent credential leakage is dominated by runtime print and console output, not just repository commits.

Why it matters: IAM and NHI teams have to govern where credentials appear during execution, because scanners aimed at source control miss the places agents actually expose secrets.

By the numbers:

👉 Read Akeyless's analysis of AI agent credential leakage and runtime exposure


Context

AI agent credential leakage is a runtime problem, not only a source-control problem. Credentials can surface in debug output, prompts, traces, memory stores and inter-agent messages, so a repository-first control model leaves large parts of the exposure path outside review.

The governance gap is simple: a secret is not safe just because it never landed in Git. When an agent can print, store or forward a credential during execution, the control point has to move from commit inspection to runtime containment. Treat credential vaulting for AI agents as the baseline for keeping secrets out of the places agents naturally expose them.


Key questions

Q: How do AI agents leak credentials at runtime?

A: AI agents leak credentials at runtime when they fetch, cache, log, echo, or pass secrets through prompts, tool calls, environment variables, memory, or error traces. The main failure modes are over-broad tool access, long-lived tokens, and insecure hand-offs across runtime-time paths. Reduce exposure with short-lived credentials, scoped tokens, secret redaction, and per-action authorisation.

Q: Why do secret scanners miss some AI agent credential leaks?

A: Secret scanners miss some AI agent credential leaks because the secret may never exist as a static string in code or a committed file. Leaks often appear only in a repository or pipeline artifact, runtime log, prompt transcript, cache, or generated output, so scanners that inspect source blobs alone do not see them. Runtime telemetry and artefact inspection are needed.

Q: What is the difference between brokered credentials and embedded secrets?

A: Brokered credentials are issued or passed through a control plane or broker at use time, while embedded secrets are stored directly inside code, images, prompts, configs, or memory. Brokered credentials can be short-lived, scoped, and revoked centrally, whereas embedded secrets usually persist until manually removed and rotated.

Q: How should teams govern agent memory that may contain secrets?

A: Teams should govern agent memory as a controlled data store, because it can retain secrets, personal data, and privileged context beyond the task that created them. Classify what may be stored, redact secrets before persistence, apply retention limits, encrypt stored memory, and ensure access is restricted to the accountable agent owner and approved tools.


Technical breakdown

Debug logs and stdout as the dominant leak path

Debug output is the most common place credentials escape because it is designed for visibility, not secrecy. Print statements, console traces and structured logs preserve values that the agent handled during execution, and those records usually live in systems with broader access and longer retention than a secrets manager. That makes a single troubleshooting statement enough to widen the audience for a credential far beyond its intended scope. The key point is not that logging is broken, but that logging is a high-fidelity copy channel for secrets when redaction happens too late or not at all. See the AI Agent Observability, Audit and Incident Response Guide.

Practical implication: Redact or block credential fields before logs leave the execution boundary, not after they reach central logging.

Why context windows and memory stores outlive the task

A prompt is not a transient container once an agent uses it to pass a secret to a model or memory system. The credential can be retained in provider-side logs, prompt caches, long-term agent memory or vector stores, then reappear in later sessions or adjacent workflows. That changes the failure mode from immediate disclosure to persistent rediscovery. In identity terms, the problem is retention beyond the task boundary: the secret survives because the system was built to remember, retrieve and reuse context, which is exactly what makes it dangerous for credentials. See the AI Agent Memory Security Guide.

Practical implication: Keep secrets out of prompts and agent memory, and treat memory stores as in-scope data stores for secret detection and retention limits.

Brokered credentials versus direct exposure

Directly embedding a credential gives the agent something printable, cacheable and transferable. Brokered delivery changes the exposure pattern by attaching the secret only to the outbound request, so the agent process never holds a reusable value in memory, traces or message payloads. That does not eliminate all risk, but it removes the most common leak surfaces that runtime systems create. The architectural difference matters because it shifts the question from how to detect leaks after the fact to how to prevent the secret from existing in the agent context at all.

Practical implication: Use short-lived brokered credentials for agent tasks that need access, and reserve direct secret handling for exceptional cases only.


Threat narrative

Attacker objective: The attacker or unintended reader obtains a usable credential that can be replayed before it is revoked or expires.

  1. entry via a runtime path where the agent prints, stores or forwards a credential during task execution.
  2. credential access occurs when logs, traces, prompts, memory stores or agent-to-agent messages preserve the secret beyond the intended moment.
  3. impact follows when the exposed credential remains valid long enough for reuse or lateral access before revocation.

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

Runtime output is the real credential boundary for AI agents: Repository scanning only covers what was committed, but the study shows that most credential issues arise after execution begins. Logs, traces, prompts and agent memory create exposure surfaces that conventional secret hygiene never inspected. Practitioners should treat runtime telemetry as part of the credential estate, not as a separate observability problem.

Long-term memory turns a task-scoped secret into a standing exposure: A credential written to memory or a vector store can outlive the work that needed it and resurface in another session. That is a lifecycle failure, not just a logging mistake, because the same value becomes retrievable by later agents with ordinary search or recall behaviour. The implication is that memory governance now sits inside NHI governance, not beside it.

Secret sprawl in agent systems is a brokered-access problem, not a detection problem: The article's evidence points to a broken assumption that scanning can catch every useful copy of a secret. It cannot, because runtime exposure happens in places where pattern matching arrives too late. Credential visibility debt: this is the accumulation of secret copies across logs, prompts, traces and agent memory that remain readable after the original task ends. Practitioners need to stop measuring only findings and start measuring where credentials can exist at runtime.

Agent-to-agent sharing expands the number of trust domains that can see the same secret: Once one agent passes a credential to another, the footprint doubles across contexts, logs and retention systems. That is why the right control question is who can ever observe the credential, not just which repository stores it. NHI governance has to follow the full delegation path, including intra-agent handoff.

From our research library:

What this signals

Credential visibility debt: AI agent programmes now accumulate secret copies across logs, prompts, traces and memory stores, so the security question shifts from whether a secret was committed to whether it was ever observable at runtime. That makes observability and secrets governance a single control problem, not two separate ones.

A working programme will move redaction earlier in the data path and remove reusable credentials from the agent context altogether. The next maturity step is to govern where an agent can ever see a secret, not just where the secret is stored.


For practitioners

  • Move credential controls into runtime paths Map every place an agent can emit a secret, including logs, traces, prompts, memory stores and inter-agent messages, then apply redaction and suppression before data leaves the process boundary.
  • Eliminate direct secret material from agent context Replace embedded keys with brokered, short-lived credentials so the agent can complete its task without holding a reusable secret in memory or configuration.
  • Treat memory stores as credential-bearing systems Bring agent memory and vector stores into the same review and scanning scope as repositories and pipelines, because they can resurface secrets long after the task ends.
  • Revoke before you rotate leaked credentials When a credential is exposed, disable the current value at the issuing system first, then rotate, because rotation alone can leave the leaked version usable during the changeover window.

Key takeaways

  • AI agent credential leakage is increasingly a runtime exposure problem, not just a repository hygiene problem.
  • The study found that print and console statements produced most of the credential vulnerability issues it identified, which shows where controls are currently weakest.
  • The most effective response is to keep reusable secrets out of agent context, reduce retention and revoke exposed values before they can be reused.

Related NHI Mgmt Group resources: Credential Vaulting for AI Agents Guide · AI Agent Observability, Audit and Incident Response Guide · AI Agent Memory Security Guide


Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 and MITRE ATT&CK address the attack and risk surface, while NIST SP 800-53 Rev 5 sets the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-02 — Secret LeakageRuntime logs, prompts and traces expose credentials outside source control.
NHI-07 — Long-Lived SecretsLeaked credentials remain dangerous until expiry or revocation.
NHI-10 — Human Use of NHIThe post shows people troubleshooting agents and printing secrets into shared systems.
Recommendation — Map agent runtime exposure paths to NHI-02 and redact secrets before they enter logs or traces. Replace long-lived agent secrets with short-lived credentials and revoke exposed values immediately. Prevent operators from handling reusable agent secrets directly and broker access instead.
NIST SP 800-53 Rev 5IA-5 — Authenticator ManagementCredential lifecycle control is central when secrets are printed or stored in runtime systems.
Recommendation — Apply IA-5 to rotate, revoke and limit the lifetime of agent credentials.
MITRE ATT&CKTA0006 — Credential AccessThe threat is credential exposure through runtime artefacts, which maps to credential access behaviour.
Recommendation — Hunt for exposed agent secrets in logs, traces and memory as credential-access indicators.

Key terms

  • Runtime telemetry: Observation of what a system actually does while it is executing. In agentic CI/CD, this means seeing which commands, files, tools, and credentials an agent touched so security teams can detect misuse that static workflow review will miss.
  • Secretless Access: Secretless access is a pattern where workloads authenticate and receive access without relying on long-lived embedded credentials. It typically uses runtime identity verification, federation, and short-lived authorization decisions. The goal is to reduce exposure from hardcoded or reusable secrets while keeping machine-to-machine access functional.
  • Agent Memory: Agent memory is the stored context an AI agent uses across sessions or tasks. In governance terms, it is controlled state, because the memories an agent retains can influence future actions, permissions use, and the safety of subsequent decisions.
  • Prompt Cache: Prompt cache is stored conversational context that an AI system reuses to reduce repeated processing and maintain continuity across interactions. In agentic AI and MCP-connected workflows, cached prompts can include instructions, retrieved data, and prior tool context, so governance must control freshness, scope, and leakage risk.

What's in the full article

Akeyless's full research covers the operational detail this post intentionally leaves for the source:

  • The six leak vectors table with practical examples of where credentials appear during agent execution
  • The detection and response checklist with sequence-specific guidance for revocation, rotation and audit review
  • The study's broader evidence on hardcoded secrets, AI-service secrets and live-secret validity
  • The guidance on where to extend scanning beyond repositories into logs, prompts, memory and traces

👉 Akeyless's full research covers the leak vectors, the response checklist and the evidence behind runtime credential exposure.

Deepen your knowledge

NHI governance, agentic AI identity, and machine identity lifecycle are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are responsible for identity security strategy or NHI governance in your organisation, it is worth exploring.
NHIMG Editorial Note
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