Hands Off Development

Per-Task VM Isolation for Cursor and Codex Evaluated Against Real Engineering Threat Models

Sandbox escapes show why microVMs matter more than OS-level isolation for coding agents.

· 8 min read
Cover illustration for “Per-Task VM Isolation for Cursor and Codex Evaluated Against Real Engineering Threat Models”
Cloud Agent Environments · November 6, 2026 · 8 min read · 1,784 words

The best cloud coding agents for engineering teams have execution boundaries that fit the threats the team faces and the rules for its data. Per-task VM isolation for Cursor and Codex must be evaluated through the kernel separation, task disposal, network policy, and secret handling behind the “sandboxed” label. Codex cloud and Cursor’s process sandbox offer different protections, but neither prevents prompt injection from misusing legitimately granted access.

Why per-task VM isolation is a threat-model question, not a checkbox

A developer’s agent deleted their home directory. An agent that can run shell commands, install packages, write files, and call APIs can damage anything it has access to. Better prompts are not an execution boundary. The protection depends on where the code runs and which resources that environment exposes.

For engineering teams, the relevant threats include filesystem access outside the intended workspace, credential exposure, unrestricted network egress, host-kernel exploitation, and cross-tenant leakage. These threats require different controls. A filesystem policy does not give code a separate kernel, and kernel separation does not stop an authorized API call. Prompt injection cuts across these categories because it can redirect access the agent already possesses. “Sandboxed” therefore describes the start of an evaluation.

The isolation spectrum and why most of it fails for autonomous agents

OS process sandboxes set rules for what code can do within the operating system it runs on. Seatbelt and sandbox-exec on macOS, and Landlock plus seccomp on Linux, restrict what a process can do without giving it a separate kernel. Standard Docker/runc containers add namespace and cgroup isolation but also share the host kernel. That shared boundary limits their security guarantee. A kernel vulnerability or misconfiguration can expose the host and neighboring workloads, making these tiers insufficient for compliance-sensitive multi-tenancy.

gVisor inserts a user-space kernel that intercepts syscalls before they reach the host kernel. It provides stronger separation than standard containers, with some I/O overhead, and suits compute-heavy workloads that do not require full VM isolation. Kata Containers instead wraps a hypervisor-backed environment in a container API native to a container orchestration platform, using options including Firecracker, Cloud Hypervisor, and QEMU. Its boot time is around 200ms.

Firecracker microVMs give each workload its own guest kernel under KVM hardware virtualization. They boot around 125ms with under 5 MiB overhead per VM, so each task can have a fresh boundary. Escape requires crossing the hypervisor boundary. Containers suit workloads that can trust a shared kernel, while microVMs suit workloads whose code cannot share that trust. Autonomous agents acting on adversarial inputs belong in the latter category when host compromise or cross-tenant access is in scope, although hardware isolation is not immunity from every exploit.

Diagram: The Isolation Spectrum: From OS Sandbox to MicroVM. Visualizes: Show a ranked progression of five isolation tiers from weakest to strongest hardware separation, with each tier's key mechanism and its critical limitation.

How Cursor and Codex actually implement isolation, and what each approach commits to

Cursor combines approval tiers through Run Modes with an OS-level sandbox for terminal commands. Sandboxed agents operate within the permitted environment and request approval to step outside it, often for internet access. Cursor 2.0+ uses Seatbelt through sandbox-exec on macOS, while Linux kernel 6.2+ supports its Landlock and seccomp approach. Neither provides a separate guest kernel. Sandboxing rolled out across macOS and Linux over early 2026, while Windows uses the Linux sandbox inside WSL2 as a bridge, with native Windows sandboxing still in development.

Codex cloud provisions a fresh microVM for each task. OpenAI’s Codex Cloud documentation says internet access is blocked by default during the agent phase, while setup scripts still have internet access to install dependencies. That phase distinction is essential. Published allocations are 2 vCPUs, 8 GiB memory, and 8 GiB disk on Plus, and 4 vCPUs, 16 GiB memory, and 32 GiB disk on Pro/Business/Enterprise/Edu. These figures show how much of each resource a task gets, but resource abuse and unsafe actions are still possible.

The harness also determines the scope of protection. Codex CLI offers read-only, workspace-write, and danger-full-access modes, with workspace-write recommended for most development workflows. It should not be conflated with Codex cloud. Claude Code 1.3 offers opt-in process sandboxing, off by default, through Sandboxed Bash using Seatbelt on macOS and bubblewrap on Linux/WSL2. That protection excludes file tools, MCP servers, and hooks, while the beta @anthropic-ai/sandbox-runtime package wraps the entire process with explicit opt-in. Codex cloud fits parallel isolated tasks followed by diff review, whereas process-sandbox harnesses fit live repository work and coordinated sessions with a different exposure profile.

Where OS-level sandboxing breaks: the Cursor CVE chain as a worked example

CVE-2026-26268, with a CVSS score of 8.1, illustrates a boundary failure in Cursor’s git workflow. Prompt injection caused the agent to write malicious content to .git/hooks/pre-commit. Git then ran the hook as part of its normal work. Code executed outside the sandbox with full user privileges, without additional user interaction after the initial injection. Direct restrictions on writes outside the workspace did not prevent a permitted workspace write from becoming executable input to a trusted component.

Pillar Security’s “Week of Sandbox Escapes” research covered Cursor, Codex CLI, Gemini CLI, and Antigravity. None of its seven disclosed issues broke the sandbox itself. Each issue took advantage of a gap between what the sandbox restricted and what a trusted component later read, ran, or scanned. The enforcement policy could hold locally while the wider workflow failed.

A microVM relocates the host-protection boundary to the hypervisor, a deliberately minimal attack surface. That changes what an attacker must cross to reach the host. It does not automatically secure every trusted component that consumes task output. The hook example therefore supports a narrower conclusion than “VMs solve sandbox escapes.” Each property must be checked against both direct escape attempts and allowed paths that turn data into an action.

Mapping each isolation property to the threats it defeats — and where even microVMs fall short

Ephemerality addresses state accumulation between tasks. Destroying a per-task VM clears the credentials, processes, secrets, and file artifacts left in it, so that execution state does not pass to the next caller. NVIDIA’s AI Red Team guidance from January 2026 flagged accumulated code, intellectual property, and secrets in long-running sandboxes and recommended explicit lifecycle management. A secret inside the VM can still be read during the task, and destroying the VM afterward cannot undo a leak.

A dedicated guest kernel means a guest-level exploit must also cross the hypervisor boundary to compromise the host or neighboring tenants. The same distinction applies to time-of-check-to-time-of-use races. A TOCTOU race can invalidate a checked state before an operation uses it, but a race confined to the guest does not by itself grant host access.

Mohammadreza Rashidi’s The Balkanization of Execution-Security Research for AI Coding Agents connects TOCTOU and MCP threats through this validate-then-act pattern. Both can involve state becoming invalid between a check and an action. The systematization also identifies the runc container-escape class as a reason to distinguish shared-kernel isolation from hardware separation. The location of the race is decisive. A VM cannot fix an authorization decision based on stale state within its own boundary.

Egress control addresses exfiltration and network-based lateral movement. Default-deny networking prevents an injected agent from contacting arbitrary destinations, calling unconfigured external APIs, or making unexpected network calls to introduce supply-chain attacks. Codex cloud applies this restriction only during the agent phase. NVIDIA’s recommended egress allowlisting narrows reachable destinations but does not make them inherently safe for every request. Permitted outbound connections remain possible leakage paths, particularly when an attacker can predict the allowed destinations.

Keeping credentials outside the sandbox and using a proxy only for allowlisted destinations avoids exposing them directly in the agent’s environment unless a task requires it. Claude Code’s project-load data-exfiltration CVE shows that data can be exposed while trust is being established, before a user confirms trust. Runtime isolation alone starts too late for that case. Even with a proxy, a legitimate database write or API operation remains available for misuse if the agent is authorized to request it.

Prompt injection is the residual gap across these properties. No isolation tier prevents a compromised prompt from directing an otherwise permitted API call. The systematization reports benign but out-of-scope actions at rates up to 17.1% under realistic prompting, showing that malicious intent is not necessary for overreach. Input validation, tool call allowlists, output auditing, and human approval for specific action classes must therefore complement the execution boundary.

What Codex's cloud execution model trades for VM-level isolation

Source code is transmitted to OpenAI’s infrastructure for processing, so the execution model requires code to leave customer infrastructure during the task. OpenAI offers enterprise data handling agreements, but those agreements do not change where cloud execution occurs. Teams with strict rules for source-code classification or regulations to meet must assess that transfer on its own, apart from protection against host escape.

Local execution presents the reverse trade-off in this comparison. Cursor’s process sandbox can keep repository execution local, but it lacks the per-task guest-kernel boundary described above. NVIDIA’s guidance supplements enterprise sandboxing with secret injection controls, egress allowlisting, per-action manual approval, and lifecycle management. Those layers address specific gaps without converting a process sandbox into a microVM. Virtualization can also keep code on customer infrastructure, so teams whose code cannot leave it can consider a self-hosted alternative to Codex cloud.

How should engineering teams evaluate cloud coding agents for their threat model?

Teams should begin with data classification, tenancy, credentials, and network policy. Shared environments with compliance requirements need a microVM-level boundary beyond what container namespaces alone provide. If source code cannot leave customer infrastructure, cloud execution needs clear approval under the policy or a self-hosted alternative. Credential scope deserves its own audit. The default should keep secrets outside the agent environment, expose them only where required, and limit their use to allowlisted destinations.

The next step is to match the harness and environment to those requirements. A process sandbox can suit single-tenant, low-sensitivity local work, while per-task microVMs fit untrusted-input and multi-tenant workloads needing hardware separation. Teams using Cursor’s process sandbox should add explicit network egress controls, while VM-based deployments still need secret handling and approval for high-consequence actions. The isolation tier and capability policy should be evaluated together, including whether a permitted action can exceed the assigned task.

Managed, fully configured VM environments offer a way to run cloud agents without making each development team manage the execution infrastructure. Harness-agnostic platforms can place Claude Code, Codex, Cursor, or Opencode within the same sandboxed environment, allowing model or harness changes without redesigning the security boundary. That convenience still needs accountable execution. Every run should be attributable to its source, harness, model, and credential for incident forensics and for measuring what shipped. The purchasing decision should rest on demonstrated isolation properties, accepted data transfers, and explicit controls for actions the sandbox permits but the task does not.

Sources

  1. The Balkanization of Execution-Security Research for AI Coding Agents: Isolation, Access Control, and Time-of-Check-to-Time-of-Use Vulnerabilities

More in Cloud Agent Environments