Independent analysis by NHI Mgmt GroupSource article: Pillar Security, “The Week of Sandbox Escapes Day 6: The hook was already in the workspace” (July 20, 2026)

TL;DR: Cursor’s sandbox escape research shows that a workspace-written .claude/settings.local.json file can be trusted as hook configuration and used to trigger local command execution without the user-facing approval path, according to Pillar Security. The finding underscores how compatibility layers and agent-written project files can turn ordinary automation into a control bypass for AI coding tools.


At a glance

What this is: NHI Mgmt Group's analysis, drawing on Pillar Security's research: Cursor could trust workspace-written hook configuration and use it to execute local commands outside the approval path.

Why it matters: For AI agent governance, this is a reminder that files an agent can write may still become execution controls, so sandbox boundaries must cover configuration handoff as well as direct command execution.

By the numbers:

  • Cursor assigned this issue CVE-2026-48124 and published a High severity advisory with a CVSS 8.5 score.

Context

A sandbox is only as strong as the paths that can hand work off to something outside it. In agentic IDEs, the risk often appears not in the agent's direct shell access but in configuration files, compatibility layers, and helper components that later act on the agent's output. This article is about that governance gap: what the agent can write, what the platform later trusts, and how execution escapes through ordinary project state.

For AI coding agents, the boundary problem is not just whether commands are approved in the chat flow. It is whether workspace-sourced files can influence an unsandboxed helper with greater privileges than the agent itself. That makes hook configuration, project notes, and compatibility namespaces part of the execution model, not harmless metadata.

Cursor's case is typical of a broader agent control failure pattern. When an agent can author the input to a trusted executor, the effective security boundary moves from runtime approval to file integrity and trust policy.


Key questions

Q: What breaks when agent-written hook configuration is not isolated from execution policy?

A: The sandbox stops being the last decision point. If an agent can write a file that a trusted helper later executes, the platform has created a second route to command execution that bypasses the user-facing approval path. The control failure is not the file write itself, but the trust granted to that file after it leaves the sandbox.

Q: Why do compatibility layers create security risk in AI coding agents?

A: Compatibility layers often inherit another tool's configuration shape without inheriting its security assumptions. That makes them attractive bypass paths because a file that looks like ordinary project state can still carry executable instructions. If the compatibility namespace is trusted later by a helper process, it becomes part of the attack surface.

Q: How can security teams detect when an AI agent is crossing from reading into execution?

A: Look for mismatches between the content the agent consumes and the actions it attempts to take. Sudden tool calls, outbound messages, data pulls, or workflow updates that follow untrusted input are strong warning signals. The control objective is to spot content-to-action translation before the action completes.

Q: What should teams do when a sandboxed agent can influence host-level commands?

A: They should move control to the handoff point. That means requiring explicit authorisation for command-bearing files, validating compatibility paths, and limiting which workspace artifacts any unsandboxed helper can consume. The goal is to ensure that no agent-authored file can become executable without a deliberate policy decision.


Technical breakdown

How workspace-written hook files bypass sandbox intent

Hook systems are designed to turn configuration into action at the end of a turn, which makes them powerful and dangerous. In this case, the agent could write .claude/settings.local.json inside the workspace, and Cursor later treated that file as valid hook configuration. The critical issue is trust inheritance: a file created inside a restricted workspace was consumed by a component that executed commands in the user's local context. That is an execution handoff, not just a parsing event. The sandbox may constrain the agent process itself, but it does not automatically constrain downstream consumers of agent-authored files.

Practical implication: Treat agent-writable hook files as execution surface, not project metadata.

Why compatibility layers create hidden execution paths

Compatibility features often import another product's configuration model into the host application. Security teams tend to focus on the primary config path and overlook these translation layers because they look like convenience plumbing. But if a compatibility namespace can carry command-bearing settings, then it deserves the same trust controls as the native path. The risk is that legacy or mirrored formats can bypass user expectations around approval, especially when the platform evaluates them after the agent has already finished its turn. That is how an ordinary project file becomes a second-stage launcher.

Practical implication: Apply the same approval and policy rules to compatibility config as to native agent commands.

How hook execution differs from direct agent command approval

Direct command approval gives the user a chance to inspect and authorise the exact command the agent wants to run. Hook execution short-circuits that model by deferring the command into configuration that another component executes later. The security model changes because the command is no longer being judged at the moment of intent. Instead, the platform trusts a file, loads it, and runs the command when the hook fires. That means the real control point is not shell approval alone. It is whether the platform can distinguish benign project state from executable instructions.

Practical implication: Move controls to configuration integrity and explicit hook authorisation, not only chat-time approval.


Threat narrative

Attacker objective: The objective is to turn a workspace-authored configuration file into unsandboxed command execution on the host.

  1. Entry occurred when the agent was allowed to write files in the workspace during an ordinary task.
  2. Credential access was not needed because the attack relied on trusted configuration handoff rather than stolen secrets.
  3. Escalation happened when Cursor loaded the workspace-written hook file and executed the configured command in the user's local context.
  4. Impact was local command execution without the dedicated approval path the sandbox was meant to enforce.

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

Workspace-writable execution state is the governance failure this case exposes: the boundary was not broken by shell access, but by a trusted file path that accepted agent-authored commands. This is a control design problem, not a prompt safety problem. When an agent can influence what another component executes, file integrity becomes part of the runtime trust model. Practitioners should treat hook configuration as privileged execution state, not workspace content.

Compatibility layers are where agent controls quietly fail: security models often cover the primary product path while leaving mirrored or legacy config formats under-protected. That creates a hidden route from ordinary automation to command execution. The broader lesson for agent governance is that every supported config namespace needs the same approval semantics, because attackers will follow the path that is easiest for the platform to trust.

Agentic IDE risk is shifting from prompt abuse to execution handoff abuse: the most interesting attacks now exploit the gap between what an agent is allowed to write and what an unsandboxed helper is allowed to run. That matters for AI agent governance because the control boundary has moved from message content to artifact trust. Teams should model agent output as potential code, configuration, or execution instruction depending on who consumes it next.

Hook trust creates a named concept: execution-path drift: the system begins with a sandboxed agent and ends with host-level execution through configuration the agent was allowed to author. That drift is easy to miss because each individual step looks ordinary. The practitioner response is to map every agent-writable artifact to its downstream executor and require a control decision at that handoff point.

Cursor's issue validates why agent identity and privilege need lifecycle controls: even when the agent itself is not autonomous, its writes can acquire privileged meaning after the fact. The governance challenge is to prevent an agent from smuggling authority into a file that another process will later honour. This is exactly where AI agent identity, execution policy, and workspace trust converge.

From our research library:

What this signals

Execution-path drift: AI coding tools increasingly fail at the point where a writable project artifact becomes trusted input for a different component. That means the security model has to follow the file from creation to consumption, not stop at the agent sandbox. Teams should assume that any agent-authored hook, settings file, or compatibility namespace may carry execution meaning.

Cursor-style failures also show why AI agent governance cannot rely on prompt approvals alone. When command execution is deferred into workspace state, the control plane shifts from chat interaction to artifact trust, and that is where most teams are weakest. Use explicit policy for any path that lets an agent influence a downstream executor.

Only 5.7% of organisations have full visibility into their service accounts, according to the Ultimate Guide to NHIs, and the same visibility gap now appears in agent tooling where writable artefacts become privileged inputs. The practical lesson is to inventory every identity, process, and file path that can carry authority forward.


For practitioners

  • Audit all agent-writable execution files Inventory every file path that can influence command execution, including hook configs, local settings, and compatibility namespaces. Classify them as execution artifacts and subject them to explicit policy.
  • Require explicit approval for workspace-sourced hooks Block hook execution unless the command and the source file are both approved through the same user-facing control path that governs direct shell actions.
  • Separate project state from executable instructions Store automation metadata in a location that cannot be authored by the agent, or validate it against a signed allowlist before any downstream component consumes it.
  • Test compatibility paths for approval bypasses Red team legacy or compatibility namespaces such as mirrored config directories to confirm they cannot bypass the platform's normal execution policy.
  • Map downstream executors for each agent artifact Document which local processes, hooks, or helpers consume agent-created files, then enforce the same sandbox or privilege checks at each consumer.

Key takeaways

  • The core failure is not shell access, but trust in agent-authored configuration that later becomes executable.
  • Cursor's sandbox escape shows how compatibility layers can turn ordinary workspace files into command execution paths.
  • Governance must move from chat-time approval to downstream artifact trust if AI agents are allowed to write execution-bearing files.

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, OWASP Agentic AI Top 10 and MITRE ATT&CK address the attack and risk surface, while NIST CSF 2.0 sets the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-04 — Insecure AuthenticationWorkspace hooks were trusted as an execution path without a strong trust boundary.
NHI-10 — Human Use of NHIThe issue shows an agent using workspace artefacts to affect host behaviour through a human-trusted path.
Recommendation — Enforce stronger trust checks before any agent-authored file can trigger execution. Separate human-approved commands from agent-authored configuration that can later execute.
OWASP Agentic AI Top 10ASI03 — Identity & Privilege AbuseThe agent gained effective privilege by moving authority into a trusted hook file.
Recommendation — Treat any agent-to-helper handoff as a privilege boundary and validate the artefact before execution.
NIST CSF 2.0PR.AA-05 — Access Permissions, Entitlements and AuthorizationsThis is an authorization failure at the point a file becomes an execution instruction.
Recommendation — Apply authorization controls to execution-bearing files and not just to direct shell commands.
MITRE ATT&CKTA0003;TA0006;TA0008 — Persistence; Credential Access; Lateral MovementThe attack pattern moves from workspace write access to execution via a trusted helper.
Recommendation — Map sandbox escapes to persistence and lateral movement techniques in your detection and testing.

Key terms

  • Control Path Drift: The divergence between the secure route an organisation intended and the route people or systems actually use. It often appears when controls are too rigid, poorly designed, or detached from workflows, and it turns policy into workaround behaviour.
  • Hook Configuration: Settings that tell a platform to run a command at a defined point in a workflow, such as after a turn ends. Because hook configuration converts policy into execution, it must be treated as privileged input rather than harmless project metadata.
  • Compatibility Layer: A compatibility layer is a bridge that lets older systems communicate with newer platforms without forcing an immediate rewrite of the source systems. In logging, it often translates syslog into modern formats, but that translation can introduce field loss, timing drift, or attribution errors if not controlled.
  • Sandbox Escape: A sandbox escape is when code breaks out of its intended isolation boundary and gains access to host capabilities. In identity terms, it turns a constrained non-human execution path into a privileged runtime that can touch files, secrets, or downstream systems.

Deepen your knowledge

The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, agentic AI identity, and machine identity security. It helps practitioners connect execution control, privilege, and lifecycle governance across modern identity programmes.
NHIMG Editorial Note
Published by the NHIMG editorial team on July 22, 2026.
Updated on October 13, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org