Est.
PersistentLong read

Credential and Secret Management Inside Persistent Agent VMs

Isolating agent credentials in micro-VMs prevents cross-workload compromise.

· 9 min read
Cover illustration for “Credential and Secret Management Inside Persistent Agent VMs”
Persistent · October 22, 2026 · 9 min read · 2,034 words

Persistent agent VMs need credential management built around an isolated execution environment. The micro-VM boundary provides that foundation by separating each agent’s credentials from other workloads. Encrypted persistence, session-aware leases, scoped delivery, and process controls then govern how secrets survive, reach tools, and expire within that boundary.

Why credentials inside persistent agent VMs are a fundamentally different problem than in stateless apps

A request-response API gets a known set of credentials at deployment and uses them along code paths that can be known in advance. A persistent agent chooses which APIs to call at inference time, so its credential needs emerge during execution. A single prompt can need access to more than one cloud provider in ways that no static configuration planned for. Because the same prompt can lead to different tool-call sequences, static secret injection cannot cover all the access the agent needs.

The runtime also outlives individual requests and authentication events. An OAuth token can expire while the agent still needs its working context to get a task done. Meanwhile, tool descriptions, API responses, and errors enter the same token stream, which is not secure memory. An authentication error containing an API key can therefore turn a failed call into a credential stored in working memory. Multi-agent delegation compounds this aggregation problem by bringing credentials for many services into one runtime, expanding what a compromise can reach.

How credentials actually leak from inside agent runtimes — the attack surface in concrete terms

Environment variables create a direct exposure path because crash reports can log them and other processes may read them. In long-running sessions, those values stay exposed for the whole time the agent runs. Tool outputs, stdout captures, and authentication errors create another path by carrying secrets into the reasoning chain. Once there, later prompts can cause the agent to repeat or exfiltrate them. Strip or redact tool output before it enters the LLM context window.

The “Vault Whisper Attack” research tested cross-user credential access and found cross-account data exposure in a portion of trials. That result shows why reasoning-layer enforcement cannot be the main credential boundary. Another attack uses a malicious tool call to reach a cloud metadata endpoint and get service account credentials. GCP’s default assignment of the project-level compute service account means agents on VMs with that account inherit a common scope.

MCP servers add an authentication surface between the agent and its tools. The April 3, 2026 incident involving Microsoft’s Azure MCP Server (@azure-devops/mcp npm package) exposed API keys and authentication tokens through a missing authentication layer on a server handling work items, repositories, and pipelines. Static long-lived API keys on MCP servers also extend the useful life of exposed credentials. Framework hooks do not close these paths automatically, since LangChain’s callback mechanism for intercepting tool calls requires opt-in enforcement.

Why shared runtimes and containers cannot structurally solve per-agent credential isolation

Application-level controls can limit access inside a shared runtime, but they cannot put a hardware boundary in place. Mounting only the credentials a task needs limits what other components can reach, though the shared kernel still has to enforce that separation. A kernel vulnerability or privilege escalation can undermine that separation and permit movement toward the host or other containers.

A shared VM also leaves agents exposed to its attached service account through a reachable metadata endpoint. Application credential checks do not govern that network call. If several agents share the VM, tightening their credential-fetch code does not remove the common identity underneath them. The aggregation problem remains because one runtime can contain credentials belonging to many tenants.

How Firecracker micro-VM isolation creates a hardware-enforced credential boundary

Linux KVM gives Firecracker micro-VMs a hardware virtualization boundary, with each micro-VM booting its own guest kernel. Firecracker runs in user space, but agent processes run inside that separate guest environment. Compromising a guest kernel does not by itself compromise the host kernel or another guest. Crossing that boundary requires escaping the virtualization layer.

Credentials mounted into one micro-VM consequently have no shared guest-kernel address space through which another agent can read them. Network controls complete the credential boundary by blocking the metadata endpoint and allowlisting only the required storage endpoint. These rules matter because virtualization alone does not narrow the permissions of credentials already available inside the guest. Isolation limits reach between workloads, while egress rules limit where each workload can obtain or send credentials.

Amazon Bedrock AgentCore Runtime uses Firecracker for Code Interpreter, Browser, and custom tools under a one-session-one-microVM architecture. This provides a production example of matching an agent session to an isolated execution environment. The AgentSecrets SDK illustrates a complementary application design with no get() method for retrieving raw secrets. Instead, it injects credentials into HTTP headers or connection strings at the transport layer, keeping them out of the agent-facing retrieval path.

Encrypted-at-rest persistence and session-aware token lifecycle inside a persistent VM

A persistent VM needs separate rules for the lifetime of stored secrets and the lifetime of permission to use them. Infrastructure-level AES-256-GCM encryption protects credentials on the VM’s isolated disk so that stored snapshots do not expose plaintext secrets. A session-aware lease governs whether the next task may reuse an earlier task’s access.

The agent-secrets project makes this distinction concrete through an Age encryption (X25519) secrets store and a daemon communicating over a Unix socket. Its session-scoped leases provide time-limited access and auto-expiry without writing plaintext secrets to disk. Each lease envelope carries a lease ID, expiry timestamp, and client ID, allowing precise revocation. Configurable per-secret auto-rotation hooks can refresh a token through a command and update the lease without exposing the rotation to agent code.

An append-only audit log records access with a timestamp and client ID, tying credential use to the workload’s local history. A multi-factor killswitch can revoke all leases, rotate all secrets, and wipe the store within that VM’s credential scope.

Three tiers of credential delivery and which agent workloads each tier fits

The first tier is a scoped allowlist of environment-injected values. It fits agents that have a small set of task-specific secrets that truly stay the same, as long as process isolation keeps other agents from reading those values. This is the weakest delivery tier because the agent process still holds the credential. Its suitability depends on a bounded workload.

The second tier is a credential broker or token vault deployed separately from the agent fleet. The agent works with placeholders, while a proxy substitutes authentication details on outbound requests. The broker keeps the tokens, refreshes them, and revokes them without giving raw secrets to the agent. To run in production, it needs encryption at rest, full token lifecycle management, per-identity scoping, and an audit trail for each use.

Nango is open-source, supports all auth types and multi-tenant credential scoping, and offers pre-built tool calls across a large number of APIs. It can be self-hosted or run BYOC. Arcade is an MCP-native tool-calling runtime in which users connect their own accounts, with Execution Tool Logs launched September 2026. Its engine is closed-source, while its tool-building framework is permissively licensed and open-source. Composio hosts agent tool calls and has a closed-source credential store, and a security incident in May 2026 exposed customer connections and API keys.

The third and strongest tier uses workload identity and short-lived credentials where the platform can attest what is running. SPIFFE and SPIRE address “Secret Zero” through node attestation using platform evidence and workload attestation using OS kernel introspection. HashiCorp Vault’s dynamic secrets pattern generates credentials on demand with configurable time-to-live and an auto-expiring lease ID. OAuth 2.1 with DPoP (Demonstrating Proof of Possession) adds sender constraints that mitigate theft and replay. A micro-VM supplies a distinct execution identity to which this access can be scoped.

Ephemeral handoff is a lateral option for bounded human-to-agent tasks. Password Pusher can deliver secrets through a self-destructing link, which fits staging API tests or a single support session. The delivery lifecycle must record sharing, access, source IP, and expiry. A retrieval confirmation step prevents security scanners or URL preview bots from consuming the single view before the agent does.

The snapshot-restore model and how it changes the economics of per-agent credential scoping at scale

The claim that per-agent VMs cost too much assumes that each environment has to stay warm while its agent waits. Agents often run a command and then wait for a model call, a human, or a queue. With thousands of tenants that are idle most of the time, keeping those environments can cost more than the work they do. Slow creation makes that idle capacity difficult to reclaim without delaying the next action.

Fast snapshot restore changes the scheduling choice to snapshot-and-delete. The system captures state, destroys the VM, frees the host, and recreates the environment when needed. Idle cost then approaches the cost of storage. Copy-on-write memory saves more because guests restored from a snapshot read shared template pages and get their own private physical pages only when they write.

For bounded jobs, this supports a fresh micro-VM with a short-lived tenant-scoped credential for each run. Block the metadata endpoint, allowlist only the required storage endpoint, and destroy the VM when the job ends. Teardown takes the credential out of that execution environment, while its short lifetime limits how long it can be used. Agents that need to pick up where they left off instead keep their encrypted secret store in the snapshot and restore it into an isolated guest kernel. Persistence and per-agent scoping therefore need not require permanently allocated compute.

Least-privilege IAM and kernel-level process isolation as the inner defense layer

The VM boundary does not decide what a compromised agent may do with its own valid credentials. Each agent needs a distinct service account with permissions matched to its task rather than a master API key spanning company services. An agent intended to read data should not be able to delete it. ibl.ai’s credential management documentation places this enforcement at the vault layer. In-memory injection keeps secrets out of code, prompts, logs, and tool definitions, with detected exposures triggering alerts and optional automatic revocation.

Claude Code’s Linux sandbox shows why process isolation inside a VM still needs explicit credential policy. Its bubblewrap (bwrap) architecture isolates network, user, and mount namespaces, while UTS, cgroup, IPC, and time namespaces remain shared with the host. The default filesystem read policy allows sensitive locations including AWS credentials and SSH keys. Administrators must configure those directories explicitly to deny access. Firecracker’s per-thread seccomp filters provide another layer by blocking unnecessary syscalls independently of agent application code.

The Cloud Security Alliance’s July 2026 guidance puts AI agent identities under Non-Human Identity (NHI) governance with lifecycle policies of their own. Microsoft’s expanded Zero Trust framework covers agent identity and credential management as part of its wider controls for governance, data security, and prompt security. A discrete VM identity helps connect these policies to an auditable workload. Behavioral monitoring then compares credential requests with the agent’s normal pattern and triggers an automatic lock when access moves outside that pattern.

Per-user agent fleets and the multi-tenant credential architecture that follows from VM isolation

Firecracker’s one-VMM-per-microVM design maps each agent to its own kernel, encrypted disk, and credentials. In a shared runtime, user separation instead depends on access checks across every relevant code path. The micro-VM model keeps tenants’ execution environments apart at a layer below those application checks, while authorization still has to be set within each scope.

Nango’s multi-tenant credential scoping controls which credentials an identity may request, while the VM boundary separates the environments using those identities. Neither job substitutes for the other. Together, they make it possible to associate secret access with a particular workload and user. That attribution supports the audit posture required by compliance frameworks including HIPAA, SOX, and FedRAMP.

Snapshot scheduling makes the same architecture work for users whose agents are idle much of the time. Their continuity resides in encrypted stored state. Each user can keep an agent’s memory and credential scope from one session to the next without sharing its execution environment with another user. The resulting architecture aligns the product boundary, the credential boundary, and the audit boundary around the same unit, which is the user’s isolated agent.

Filed underPersistent

More in Persistent