Credential and Secret Isolation in Per-User Agent VMs
Shared agent pools leak tenant data by design, and per-user microVMs fix it.

Picture a pool-model deployment where Tenant A's agent retrieves internal documents and embeds the relevant passages into a shared vector store. Later, Tenant B's agent runs a task that is semantically similar against that same store, and the top-K nearest neighbors return Tenant A's records. Tenant A's internal customer data now sits inside Tenant B's agent context, and this needs no adversarial prompt, no exploit, and no malicious actor. That sequence is the clearest way to see the actual claim this piece makes: credential and data leakage in multi-tenant agent systems is a structural failure, built into certain deployment architectures by their own design, rather than a bug a more careful engineering team could have caught.
Agent platforms face three isolation dimensions that traditional web applications never had to solve in the same way. Credential isolation means agents need working API keys scoped per tenant, an OpenAI key, a Stripe key, a Salesforce key, not a session token that merely proves identity to a backend. Agents accumulate working memory, vector embeddings, and coordination state across interactions, so if a store is not partitioned, it can surface one tenant's documents inside another tenant's context exactly as described above. If a shared log intermixes two tenants' tool calls, you cannot hand it to one compliance team without exposing the other tenant's records. Failing any one of these three dimensions constitutes a cross-tenant bleed event, the kind of sensitive information disclosure industry security frameworks for LLM applications single out as a top risk category. The rest of this piece works through why that failure is structural, and what architecture actually closes it.
The threat model: what credential exfiltration looks like in a running agent system
Credential exfiltration from a deployed agent does not require a sophisticated attacker. A malicious tool call can reach the cloud metadata server endpoint directly, and that endpoint returns live service-account credentials with no API key, no credential file, and no additional authentication step required to extract them. The agent simply asks, and the metadata service answers, because nothing in the request path distinguishes a legitimate internal call from a tool call an attacker engineered.
A sandbox architecture has to cover five concrete threat vectors, each one a direct consequence of how shared environments are built. Filesystem read and write outside the intended scope lets a compromised process touch data it was never meant to see. Network egress to arbitrary domains lets exfiltrated data leave the environment through channels no policy was written to anticipate. Exposure of the host kernel's syscall surface to agent-executed code turns every kernel vulnerability into a sandbox-breaking vulnerability. Cross-tenant data leakage in multi-tenant environments produces the vector-store bleed described above. Secret exfiltration via environment variables or the /proc filesystem means credentials injected carelessly into a process's environment are often readable by anything else running alongside that process.
Agentic systems add a multiplier that web applications never had to account for. Agentic platforms share base models, MCP tool server endpoints, and OAuth token pools across tenants to keep infrastructure costs down, and the dynamic nature of agent delegation means a compromised credential can travel through delegation chains across tenant boundaries. Agents use credentials autonomously, hop to hop, and no human verifies each step the way a human operator might pause before forwarding a secret to a new system. The question that follows is what architectural property would make this sequence structurally impossible.
Where shared-kernel and pool-model approaches structurally fail
Three multi-tenancy models dominate current agent deployments, and each one fails in a different way. The silo model gives tenants shared-nothing infrastructure, so it has maximum isolation at the highest per-tenant cost, and its operational burden grows linearly as tenant count grows. The pool model, the cheapest to run, offers the weakest isolation and is appropriate only for low-sensitivity workloads with no enterprise customers depending on the boundary holding. The bridge model, shared compute with isolation enforced at the control plane, is the recommended default for B2B SaaS, with its isolation quality depending entirely on whether credentials and memory namespaces are enforced at the infrastructure layer.
That last qualifier is the one that matters. A shared agent container pool that enforces isolation through tenant_id parameter filtering is only as strong as the code checking that parameter. Any application-layer bug, any race condition, any prompt injection that causes the filter to be skipped on a single request produces immediate cross-tenant bleed, because nothing below the application layer is stopping it. The isolation exists as a rule the code is supposed to follow, not as a property of the system that holds even when the code fails to follow it.
Container-based solutions share a kernel and rely on namespace isolation, Linux user, PID, network, UTS, IPC, mount, and cgroup namespaces, to keep tenants apart. These namespaces work for low-risk workloads, but they are not enough for compliance-sensitive multi-tenancy, because they improve isolation without eliminating shared kernel code paths. Two sandboxed processes running in separate containers still share the host kernel, and a kernel vulnerability discovered in that shared kernel propagates laterally across every container running on the host. CWE-653, Improper Isolation or Compartmentalization (previously listed under the name Insufficient Compartmentalization), describes exactly this category of weakness: a boundary that looks like a wall but is actually a set of rules about who is supposed to stay on their own side of it.
An industry control for agent credential isolation names the specific anti-patterns this failure mode produces. It prohibits shared credential pools across tenant boundaries, and it prohibits wildcard OAuth client credentials, the kind of broad-scope token that works everywhere because nobody scoped it to work only somewhere. Both prohibitions target the same underlying problem: a credential or a boundary check that depends on application logic behaving correctly on every single request, forever, is a credential or boundary check that will eventually fail.
A separate kernel per user makes credential isolation structurally guaranteed
A microVM architecture closes the gap namespaces cannot close, because each microVM runs its own independent Linux kernel. Two sandboxes built this way share no kernel code paths whatsoever, which eliminates the possibility of a kernel vulnerability propagating laterally from one tenant's sandbox to another's. Where container namespaces draw a line within a shared kernel, a microVM boundary removes the shared kernel. There is no code path for a vulnerability to travel through, because there is no shared code to carry it.
Firecracker, the virtual machine monitor built for this kind of workload, enforces this boundary with a deliberately minimal device model. Each guest sees only six virtual devices: virtio-net, virtio-blk, a memory balloon device, vsock, a serial port, and a keyboard controller. That narrow surface is a security property, not an incidental limitation. Every device a guest can see is a potential attack surface, and six devices leave far less for a compromised guest to probe or exploit than a general-purpose virtualization layer would.
What this buys a B2B SaaS product is an inherited guarantee. Per-tenant credential vault scopes, blackboard namespace ACLs, and partitioned audit logs enforced at the infrastructure layer mean tenant isolation becomes a structural property of the platform, not a checklist item a developer has to remember to implement correctly on every feature they ship. The CoSAI Agent Credential Isolation control formalizes what that structural guarantee has to include. With per-tenant credential issuance, each tenant's agents get credentials that are structurally invalid outside that tenant, not credentials that are merely supposed to stay inside it. Short-lived, tenant-scoped tokens bind agent-to-tool authentication to a single task or session, so no session outlives its purpose. If tenant boundary validation runs at every MCP protocol hop and delegation step, a credential issued for tenant A cannot be forwarded into tenant B's context, no matter how the orchestration layer tries to route it. Tenant-scoped rotation and revocation means decommissioning an agent in one tenant cannot leave credentials valid in another. Persistent credential state held in agent memory is subject to the same per-tenant scoping as any other credential, so memory-resident secrets do not survive a tenant-boundary transition.
Practitioners reasoning about which isolation model to choose can treat these options as a hierarchy, with each step down removing a structural guarantee and replacing it with a policy-enforced one: a Firecracker microVM at the top, followed by gVisor, followed by bubblewrap or plain namespaces, followed by no isolation. The kernel boundary is the point in that hierarchy where isolation stops depending on correct implementation and becomes a property the system holds regardless of what any single piece of application code does.

The proxy-token pattern: injecting real credentials without exposing them to the agent
A separate kernel per user solves where credentials can travel. It does not by itself solve what the agent gets to see. The production pattern that closes that second gap is a credential injection proxy built on a phantom token approach: the agent inside the VM only ever holds a per-session token, and the real credential is swapped in by a host-side proxy at the moment of egress. The guest VM, at any point in its lifecycle, holds nothing that is valid outside that proxy boundary.
The proxy enforces several things at once. It applies default-deny network policy at the boundary: an allowlist of domains and CIDR ranges, and everything else is blocked. It performs boundary-level secret injection, handing the workload a proxy token that is worthless outside the proxy and swapping in the real credential only at egress. It maintains an upstream IP deny list that closes SSRF and DNS-rebinding gaps, and it blocks the cloud metadata endpoint, the same IMDS endpoint described in the threat model above, by default. It also produces a per-request structured audit trail, so every credential use is logged at the point it actually happens.
The agent-vm project's storage lifecycle design shows what this looks like as a concrete engineering decision. Credentials live in agent-vm's own namespace inside the host OS credential store, and that store is deliberately inert. Storing a value in it does not authorize its use anywhere. Nothing reads a value back out of the store or hands it to a guest, and listing the store's contents exposes service identifiers and storage status only, never partial or full credential values. The store is a place credentials sit, not a place anything can retrieve them from.
This design directly avoids the anti-pattern the CoSAI control calls out: multi-tenant intermediaries that aggregate per-customer credentials into a single pool. That pattern is prohibited architecturally under the control, not merely something a team is expected to secure carefully in operation. The distinction matters, because an aggregated credential pool secured well today is still an aggregated credential pool, and a single misconfiguration or compromised component gives an attacker everything at once. Multiple production sandbox runtimes converge on the host-boundary injection pattern instead. matchlock documents a host-side MITM proxy that injects secrets so the VM never sees real keys, and Cleanroom documents a host-side gateway that brokers credentials into the guest so that secrets never enter the sandbox. Independent implementations arriving at the same boundary placement is evidence that the pattern reflects a structural requirement.
Credential lifecycle inside the VM: scoping, rotation, and sleep-cycle persistence
Persistent VMs that survive across sessions introduce a lifecycle risk that ephemeral sandboxes never face. A credential cached in agent memory or written to disk can outlive the task it was issued for, unless the platform actively enforces per-task scoping and clears that state at every boundary transition. An ephemeral sandbox that dies at the end of a task takes its cached credentials with it by default. A persistent VM has to be told to forget.
The CoSAI memory-resident credential rule addresses this directly: credential caches, session state, and token storage held in agent memory carry the same per-tenant scoping and lifetime bounds as any credential in flight, and memory-resident credentials do not survive a tenant-boundary transition. Short-lived, task-scoped tokens narrow the window during which a captured credential remains usable, so the smaller that window, the smaller the damage any single exfiltration event can do.
Snapshot-and-restore cycles raise a specific question that persistent-VM architectures have to answer deliberately: when a VM is restored from a snapshot, what credential state does the guest inherit? If credentials were written to the guest filesystem or cached in agent memory before the snapshot was taken, those credentials are preserved inside the snapshot and restored along with everything else when the VM comes back. The way to avoid this failure mode is to keep real credentials out of the guest entirely, which is what the proxy-token pattern from the previous section accomplishes. A guest that never holds a live credential in the first place has nothing sensitive to carry into its next snapshot. Tenant-scoped rotation and revocation close the remaining gap: rotating or revoking a credential for one tenant must never affect another tenant's credentials, and a decommissioned credential must not remain valid anywhere in the system after that decommissioning takes effect.
The economics of running an isolated VM per user without paying for idle compute
The strongest objection to per-user VM isolation is cost. Stronger isolation means each user's agent needs its own kernel image and its own memory space, and an agent sitting warm while it waits for its user to return spends most of its running life billing for idle compute. That objection is accurate as a description of always-on virtualization. It does not apply to snapshot-restore scheduling.
A VM built this way does not need to run while idle. It can be frozen to a snapshot and restored in well under a second when the user returns, so the platform pays for storage during the sleep period and pays for compute only while the VM is actually doing something. Copy-on-write memory is what makes this dense at scale: every guest restored from a template reads the same shared template pages, and the kernel allocates a private physical page only at the moment a guest writes to one. A hundred sandboxes restored from a single template do not cost a hundred times that template's RAM footprint upfront, because almost all of that memory starts out shared.
Snapshot-restore also reinforces the credential argument from the previous two sections. Because credentials are injected by the host-side proxy at runtime, they are never present in the snapshot. Restoring a VM does not restore a live credential sitting in memory or on disk. It restores a guest that will request fresh credentials from the proxy the next time it actually needs them. The snapshot itself carries nothing an attacker could extract even if they obtained a copy of it.
AWS Bedrock AgentCore applies this same logic at managed scale. The expensive work of starting up an agent environment is paid once and baked into a snapshot, and every new instance begins by restoring that snapshot. Each user session runs in its own dedicated microVM, with isolated CPU, memory, and filesystem, and the platform's pricing follows directly from that architecture: storage costs apply while an agent sits idle, and compute costs apply only while it is active. That pricing structure is what makes per-user agent deployment viable at the scale a B2B platform needs, in a way that a fleet of always-on virtual machines, billed around the clock whether or not anyone is using them, never could be.
Sources
- Isolation as a First-Class Principle for LLM-Agent System Safety: Concepts, Taxonomy, Challenges and Future Directions
- SUDP: Secret-Use Delegation Protocol for Agentic Systems
- Model Poisoning: Credential Exfiltration in Self-Hosted LLM Deployments
- A kernel for every customer: scaling AI agents to 1000 tenants on ...
- Securely deploying AI agents - Claude Code Docs


