Subscribe to the Non-Human & AI Identity Journal

Why do coding agents create persistence risk even when sandboxed?

Because persistence does not require the agent to escape at runtime. It only needs permission to leave behind trusted files, startup logic, or task metadata that the editor or operating system will later consume. Once that happens, the dangerous action occurs after the sandbox is gone, under the user’s privileges.

Why This Matters for Security Teams

Sandboxing reduces runtime blast radius, but it does not remove the ability of a coding agent to leave durable artifacts behind. If the agent can write to a workspace, dotfiles, build scripts, task runners, editor settings, or local automation hooks, it may plant logic that executes later with the user’s privileges. That turns a bounded session into a delayed trust abuse problem, which is exactly the kind of failure mode highlighted by the OWASP Agentic AI Top 10 and the broader governance concerns in the NIST AI Risk Management Framework.

The practical issue is persistence, not escape. A coding agent that can alter repository files, package manifests, CI triggers, or local startup configuration may not need elevated privileges to create a future execution path. Security teams often underestimate this because the action looks harmless at write time, then becomes dangerous when a developer opens the project, runs a build, or syncs settings across environments. In practice, many security teams encounter persistence only after the modified workspace has already been reused, rather than through intentional review of agent-written artifacts.

How It Works in Practice

Coding agents usually operate through tools that can read, write, and sometimes execute within a development environment. That is enough to create persistence if the agent can influence files or settings that the host later trusts. Typical examples include package scripts, shell profiles, IDE workspace settings, task definitions, git hooks, notebook metadata, startup jobs, and automation files that are outside the sandbox boundary once the session ends.

The risk increases when the agent can chain actions across multiple steps. For example, it may place a benign-looking change in a configuration file, then rely on a later human action to trigger it. This aligns with agentic attack patterns described in the MITRE ATLAS adversarial AI threat matrix, especially where prompt manipulation, tool misuse, or indirect execution paths are involved. Current guidance suggests treating any agent that can persist state as a high-risk actor, even if the runtime is tightly sandboxed.

  • Limit write access to only the minimum paths needed for the task.
  • Separate ephemeral scratch space from trusted project files and startup locations.
  • Review changes to automation, build, and editor configuration with the same scrutiny as code.
  • Log every file write, command invocation, and tool call made by the agent.
  • Require human approval before anything that can execute later is committed or synced.

These controls work best when the sandbox also blocks access to user profiles, shared dotfiles, and repository-managed hooks, because otherwise the agent can still plant durable instructions that survive the session. These controls tend to break down in developer workstations that share the same filesystem and credentials across local tools, cloud sync, and source control.

Common Variations and Edge Cases

Tighter sandboxing often increases workflow friction, requiring organisations to balance developer velocity against the risk of delayed execution. Best practice is evolving here, and there is no universal standard for every coding environment yet. Some teams assume a read-write workspace is acceptable because execution is blocked, but that is only safe when the workspace cannot influence future execution paths.

Edge cases matter. A coding agent may not need to persist obvious malware-like code; it may only need to alter task metadata, dependency resolution, or project templates so that the next build or launch behaves differently. The problem also extends to cross-device sync, shared templates, and monorepo tooling, where a change in one place propagates into many environments. The NIST Cybersecurity Framework 2.0 is useful here because the issue spans governance, protection, detection, and recovery, not just containment.

For higher-risk deployments, align controls with agent-specific threat modeling and validated guardrails, using sources such as the CSA MAESTRO agentic AI threat modeling framework and the NIST AI Risk Management Framework. The core rule is simple: if an agent can write something the system will trust later, sandboxing has not eliminated persistence risk, it has only delayed it.

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 and MITRE ATLAS address the attack and risk surface, while NIST AI RMF, NIST CSF 2.0 and NIST AI 600-1 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
NIST AI RMF AI risk governance covers delayed misuse of agent-written artifacts.
OWASP Agentic AI Top 10 Agentic apps face persistence through tool and file manipulation.
MITRE ATLAS AML.TA0002 Persistence can follow indirect manipulation and tool misuse patterns.
NIST CSF 2.0 PR.AC-4 Least privilege limits which files and startup paths the agent can alter.
NIST AI 600-1 GenAI controls apply to output validation and safe tool use in agents.

Threat model agent workflows for indirect actions that create durable execution paths.