/

CVE-2026-41208

Severity:

HIGH RISK

(8.8)

OS Command Injection in Paperclip Server

CVE-2026-41208

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution and Privilege Escalation on Server Host

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Paperclip's server component improperly trusts agent-controlled configuration, allowing an attacker with an Agent API key to inject arbitrary shell commands into a provisioning command executed on the host.

By updating the adapterConfig.workspaceStrategy.provisionCommand field through the /agents/:id API, a malicious or compromised agent can escalate from the agent runtime context to remote code execution on the Paperclip server host.

Affected context

This vulnerability affects deployments of the @paperclipai/server package where:

  • Agents are issued API keys that can call /agents/:id to update their own configuration.
  • The server later uses values from adapterConfig.workspaceStrategy.provisionCommand to construct and execute shell commands for workspace provisioning.
  • There is no strict separation between agent-supplied configuration and privileged host-level command execution.

It is most relevant in multi-agent or multi-tenant environments where agent credentials may be compromised or controlled by untrusted parties.

Exploit preconditions

  • Attack surface: Paperclip server HTTP API (specifically /agents/:id).
  • Required access: Valid Agent API key associated with an existing agent, or the ability to compromise such a credential.
  • Trigger point: Any server operation that triggers workspace provisioning and executes adapterConfig.workspaceStrategy.provisionCommand.
  • Why exploitation is possible: The server treats agent-controlled configuration as trusted and interpolates it into a host-level shell command without sufficient validation, escaping, or isolation, enabling arbitrary command injection.

Why this happens

The core issue is that untrusted, agent-controlled configuration is allowed to influence a shell command that runs with the Paperclip server's host privileges.

This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where data from a less-privileged context (the agent) is incorporated into an OS command string without robust neutralization or strict command construction.

Conceptually, the design assumes that agent configuration is trustworthy and safe to execute, breaking the intended trust boundary between the agent runtime and the host system.

Instead of treating provisionCommand as declarative configuration or a restricted parameter set, the implementation effectively exposes a generic execution hook to the agent, which can then be abused to run arbitrary shell commands.

Potential impact

  • Remote execution of arbitrary OS commands on the Paperclip server host.
  • Full compromise of the Paperclip server process, including its data and secrets.
  • Lateral movement to other services or infrastructure reachable from the server host.
  • Modification or exfiltration of business data managed by the AI agents.
  • Use of the compromised host as a foothold for broader network attacks or supply-chain abuse.

General mitigation guidance

Effective mitigation focuses on treating agent-controlled configuration as untrusted input and strictly limiting what can be executed on the host:

  • Replace free-form shell commands in configuration (such as provisionCommand) with declarative, parameterized operations that map to a fixed set of server-side actions.
  • Introduce strict allowlists for any command-like behavior: expose only specific subcommands or flags, and do not allow arbitrary shell fragments.
  • Avoid shell interpretation where possible by using APIs or direct system calls (e.g., spawn processes with static command arrays and validated arguments instead of shell-joined strings).
  • Enforce a clear trust boundary between agents and the host: treat agent configuration as untrusted user input and apply robust validation and sanitization of all fields that influence execution.
  • Run host-level provisioning logic under reduced privileges and, where possible, within isolated sandboxes or containers to limit blast radius if an execution path is misused.
  • Apply least-privilege to Agent API keys and rotate credentials regularly so that compromise of one agent does not easily lead to high-impact actions on the host.

How teams detect issues like this

Organizations can approach detection through a combination of code- and runtime-level techniques:

  • Static analysis: Configure rules that flag uses of agent- or user-controlled configuration in:
  • Shell command construction (child_process.exec, execSync, or similar APIs).
  • String concatenation or templating used to build command lines, especially where the source is configuration fields like adapterConfig.workspaceStrategy.provisionCommand.
  • Code review: During reviews, explicitly examine any code that:
  • Executes commands on the host.
  • Accepts or propagates values from configuration tied to less-trusted actors (agents, tenants, or external users).
  • Bridges between a lower-privileged runtime and the host environment.
  • Policy enforcement: Add CI/CD checks or lint rules that:
  • Prohibit arbitrary command execution driven by client or agent configuration.
  • Require justification and security review for new command execution code paths.
  • Runtime monitoring: Use logging and intrusion detection to:
  • Record which commands are executed as part of workspace provisioning.
  • Alert on unusual or high-risk command patterns, such as outbound network utilities, data exfiltration tooling, or unexpected interpreters.

Sources

SourceLink
github.comgithub.com/paperclipai/paperclip/security/advisories/GHSA-265w-rf2w-cjh4

Frequently asked

questions

Yes, if the Paperclip server's API is exposed (directly or via a gateway) and an attacker can obtain or control an Agent API key, they can send crafted requests to the /agents/:id endpoint and potentially achieve remote code execution on the host.

The attacker needs a valid Agent API key or equivalent credentials that allow updating an agent's configuration via the /agents/:id API. They do not need direct shell access or admin access to the server; control over the agent configuration is sufficient.

Remove the ability for agents or other untrusted parties to define or modify raw shell commands in configuration. Instead, design provisioning as a fixed set of server-controlled operations with limited, validated parameters, and avoid any shell-based interpretation of untrusted data.

Establish architectural rules that forbid arbitrary code or command execution based on untrusted configuration, enforce strict trust boundaries between components, and use static analysis and code review checklists to scrutinize any new command execution paths. Treat all agent- and user-controlled input as untrusted and validate or constrain it before it can influence privileged operations on the host.

Find out what's already
exploitable in your codebase.