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: Pillar Security shows that AI coding agents can convert workspace hook configuration into local command execution paths inside Cursor.
Why it matters: For IAM, PAM, and NHI teams, this is a reminder that approval boundaries must cover agent-written configuration as well as direct shell actions when tools can execute workspace-derived instructions.
By the numbers:
- Cursor assigned this issue CVE-2026-48124 and published an advisory GHSA-pc9j-3qc2-95wv.
👉 Read Pillar Security's research on Cursor sandbox escapes and hook-based execution
Context
AI coding agents often operate inside a boundary that looks safe because direct shell execution is gated, but workspace files can still become a second path to action. In this case, the primary security problem is not prompt content alone. It is the trust placed in agent-written configuration that later gets executed by a helper outside the sandbox.
This matters to identity and access practitioners because the control failure is about delegated authority. A non-human workflow wrote execution state that another component trusted, which is the same governance problem seen in service accounts, automation pipelines, and other NHI-driven paths where write access can become execution access.
The starting position is not unusual. Many developer tools, agents, and compatibility layers assume workspace state is inert. That assumption breaks once project files can launch commands, especially when the file is written by the same agent the sandbox is supposed to contain.
Key questions
Q: What breaks when an AI coding agent can write files that host tools later trust?
A: The sandbox boundary breaks in practice, even if the agent process itself never escapes. Host tools such as task runners, Git helpers, and IDE extensions may treat agent-created files as trusted configuration and execute them. The result is indirect code execution, which means the real control gap is trust in the artefact, not containment of the process.
Q: Why do enterprise AI agents complicate NHI governance?
A: They complicate NHI governance because the security model was built around predictable non-human identities such as API keys and workload credentials. Agents reason over context, can chain actions, and may use multiple protocols in one workflow. That makes permission modelling necessary but insufficient, because the real control issue is whether the execution still reflects approved intent.
Q: How can security teams tell if hook-based automation is becoming a bypass?
A: Look for any file or setting that can cause a command to run without the same approval path as a user-initiated action. If the agent can create or modify that file, the control is likely bypassable. The warning sign is simple: a writeable project artifact produces privileged behaviour outside the expected consent flow.
Q: Who is accountable when an agent-authored config file triggers execution on the host?
A: Accountability sits with the team that defined the trust model and with the product owner who allowed workspace-sourced execution state to run without explicit controls. The issue is not only code quality. It is governance over who can write privileged instructions, how those instructions are approved, and whether the runtime honours them safely.
Technical breakdown
How workspace-sourced hook files turn into command execution
Hook systems convert configuration into runtime behaviour. In Cursor’s case, a workspace-controlled .claude/settings.local.json file could define a Stop hook, and the hook engine later executed the configured command when the turn ended. The important architectural detail is that the agent does not need direct shell permission at the moment the command runs. It only needs write access to a file that another component trusts as executable instruction. That is a boundary failure between authoring and execution, not a simple shell escape.
Practical implication: treat hook files as execution policy, not project metadata.
Why compatibility layers expand the attack surface for AI agents
Compatibility layers are security-sensitive because they inherit the semantics of a foreign system without always inheriting its controls. Here, support for .claude-style hooks created a parallel configuration path that could be populated inside the workspace. If the primary product assumes one config location is sensitive, but a compatibility namespace is loaded with equal trust, the attacker only needs the overlooked path. This pattern is common in agentic tools: one writeable file becomes a bridge to an unsandboxed helper, then the helper performs the privileged action.
Practical implication: inventory every config namespace that can invoke code, including compatibility paths.
What makes agent-written configuration different from ordinary project files
Ordinary project files describe work. Execution configuration instructs software to act. That distinction matters because agentic systems can produce both, and defenders often only protect the obvious command interface. Once the agent is allowed to write a hook definition, the file itself becomes a command carrier. The sandbox may still block direct terminal use, but it no longer controls the full lifecycle of the action. That is why this class of issue sits at the intersection of AI security, NHI governance, and endpoint control.
Practical implication: require explicit approval for any agent-authored file that can change local execution state.
Threat narrative
Attacker objective: The attacker wants to turn a harmless-looking workspace edit into trusted local code execution in the user’s context.
- Entry occurs when the agent is allowed to write files inside the workspace and place a hook configuration under .claude/settings.local.json.
- Escalation occurs when the workspace file is trusted by Cursor’s hook engine and translated into a command that runs outside the agent’s direct approval flow.
- Impact occurs when the command executes in the user’s local context, enabling arbitrary command execution, persistence, or data theft.
Breaches seen in the wild
- Amazon Q AI Coding Agent Compromised — Amazon Q AI coding agent compromised via prompt injection enabling hackers to inject data-wiping commands.
- Replit AI Tool Database Deletion — Replit vibe coding AI assistant deletes live production database and creates 4,000 fake user records.
Read our 52 NHI Breaches Analysis report for a comprehensive view of breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
Workspace-trusted execution is now an identity problem as much as an endpoint problem. When an AI agent can author a file that another local component later executes, the control boundary is no longer just shell approval. It becomes delegated authority over a non-human workflow. That is why NHI governance applies here: the system that writes the instruction and the system that executes it are effectively part of the same trust chain, even if they are different processes. Practitioners should treat write permissions to execution-bearing files as privileged access.
Compatibility namespaces create hidden trust paths that security teams miss. The danger in this case is not the novelty of hooks. It is the tendency to treat alternate config formats as plumbing rather than policy. Once a product reads workspace-sourced execution config, the file path itself becomes a control surface. This is a familiar pattern in identity governance: undocumented exceptions become the real privilege model. Practitioners should map every compatibility path that can alter runtime behaviour and subject it to the same controls as primary config.
Agentic AI security fails when sandboxing stops at direct action and ignores indirect action. Sandbox models that only constrain what the agent can execute immediately are incomplete if the agent can write artifacts that later trigger execution elsewhere. That is a form of control-plane drift, and the same dynamic appears in NHI sprawl when credentials are created in one system and honoured in another without lifecycle alignment. Practitioners should assume that any agent-writeable execution config is a latent bypass until proven otherwise.
Hook configuration is a named example of execution-state exposure. This is not just file abuse. It is the conversion of workspace state into runtime authority. The concept matters because it gives teams a precise way to discuss the risk: files that can change behaviour are not content, they are credentials in another form. Practitioners should classify those files as sensitive execution state and govern them accordingly.
The broader lesson is that approval must follow effect, not interface. Users may approve chat-driven commands while never seeing the downstream hook that actually performs the action. That breaks auditability and undermines least-privilege design. In identity terms, the command path and the execution path are both principals that need governance. Practitioners should design controls around what the system can do, not only what the agent directly requests.
From our research:
- 80% of organisations report their AI agents have already performed actions beyond their intended scope, including accessing unauthorised systems (39%), inappropriately sharing sensitive data (31%), and revealing access credentials (23%), according to AI Agents: The New Attack Surface report.
- 96% of technology professionals identify AI agents as a growing security threat, and 66% believe this risk is immediate.
- Track the governance gap with OWASP Agentic AI Top 10 and map execution-bearing file paths to Top 10 NHI Issues.
What this signals
Execution-state exposure is the right lens for this class of AI agent risk. Once a workspace file can alter runtime behaviour, the boundary has moved from content management to authority management, and that is where identity governance becomes relevant to agentic systems.
Teams should expect more issues in the space between agent-authored configuration and host-side execution, especially where compatibility layers are involved. The practical response is to treat these file paths as privileged control surfaces and map them to policy, logging, and approval requirements.
For practitioners, the programme implication is clear: if an AI workflow can write a file that another component trusts to execute code, then the system has a hidden principal. That hidden principal needs governance in the same way a service account or API key does.
For practitioners
- Classify execution-bearing workspace files as privileged assets Inventory every file that can launch commands, modify hooks, or change local execution state. Put .claude/settings.local.json, similar compatibility paths, and any agent-writable config under the same review standard as shell scripts and startup files.
- Require dedicated approval for indirect command paths Make the approval prompt name both the command and the file or setting that will cause it to run. Do not allow an agent to gain a quieter route through hook engines, background helpers, or workspace watchers that execute later.
- Constrain compatibility paths to the primary security model Apply the same sandbox, policy, and logging rules to legacy or compatibility namespaces as you do to first-class config. If a path can alter execution, it needs the same controls as direct user-facing command execution.
- Monitor for agent-authored execution state changes Alert on creation or modification of hook files, startup scripts, or tool configuration in workspaces where AI agents operate. Pair that telemetry with local command auditing so you can trace file write to execution in one incident timeline.
Key takeaways
- AI coding agents can turn workspace configuration into an execution path, which means sandbox policy must cover indirect actions as well as direct shell commands.
- The evidence points to a recurring pattern in agentic tools: compatibility layers and writeable project files create trust shortcuts that conventional approval models do not see.
- Practitioners should classify hook files and similar execution-bearing artifacts as privileged assets and govern them with the same discipline used for NHI and PAM controls.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10, OWASP Non-Human Identity Top 10 and MITRE ATT&CK address the attack and risk surface, while NIST AI RMF and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | N/A | The issue is agent goal and tool misuse through workspace-written hook config. |
| OWASP Non-Human Identity Top 10 | NHI-03 | Workspace files that trigger commands fit NHI secret and execution-state governance gaps. |
| NIST AI RMF | GOVERN | Agentic execution paths require clear accountability, oversight, and policy ownership. |
| NIST CSF 2.0 | PR.AC-4 | The article is about limiting what can be executed from a trusted workspace path. |
| MITRE ATT&CK | TA0002 , Execution; TA0011 , Command and Control | The chain uses a file-write path to reach local command execution. |
Use the agentic AI Top 10 to classify indirect execution paths and control them before deployment.
Key terms
- Execution-bearing configuration: Configuration that does more than describe behaviour and can directly trigger commands, hooks, or runtime actions. In AI agent environments, these files are sensitive because a write permission can become execution permission when another component trusts the file without fresh approval.
- Compatibility path: A secondary file format or namespace supported so one tool can understand another tool’s conventions. Compatibility paths are risky when they inherit the syntax of a trusted system but not its security controls, because they can quietly expand the attack surface without changing the primary user experience.
- Indirect command path: A route by which software causes execution through a helper, watcher, hook engine, or background process rather than through the direct user-facing command interface. These paths are hard to secure because the action happens later, in a different component, and often outside the approval flow the user expects.
- Execution-state exposure: A condition where a file or setting that should be treated as privileged runtime control is stored in a place the attacker or agent can write. Once exposed, that state can be turned into unauthorised execution, persistence, or policy bypass even if the direct shell remains restricted.
What's in the full report
Pillar Security's full research covers the operational detail this post intentionally leaves for the source:
- The exact proof-of-concept prompt and file-write sequence used to turn .claude/settings.local.json into a Stop hook.
- The advisory context for CVE-2026-48124, including the affected version and patch reference.
- The step-by-step explanation of why the hook engine crossed the sandbox boundary after the workspace file was written.
- The broader series context across The Week of Sandbox Escapes for teams comparing adjacent agent-execution bypass patterns.
👉 The full Pillar Security post shows the proof of concept, advisory details, and boundary analysis.
Deepen your knowledge
The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, machine identity security, and secrets management. It helps practitioners build the control discipline needed to govern agentic workflows, delegated access, and privileged automation.
Published by the NHIMG editorial team on July 22, 2026.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org