GHSA-265w-rf2w-cjh4 Paperclip: Privilege Escalation via Agent-Controlled workspaceStrategy.provisionCommand Leading to OS Command Execution
SummaryPaperclip contains a privilege escalation vulnerability that allows an attacker with an Agent API key to execute arbitrary OS commands on the Paperclip server host.
An attacker with an agent credential can escalate privileges from the agent runtime to the Paperclip server host.
The vulnerability occurs because agents are allowed to update their own adapterConfig via the /agents/:id API endpoint.
The configuration field adapterConfig.workspaceStrategy.provisionCommand is later executed by the server runtime using:As a result, an attacker controlling an agent credential can inject arbitrary shell commands which are executed by the Paperclip server during workspace provisioning.
This breaks the intended trust boundary between agent runtime configuration and server host execution, allowing a compromised or malicious agent to escalate privileges and run commands on the host system.
This vulnerability allows remote code execution on the server host.DetailsRootcauseAgent configuration can be modified through the API endpoint:The validation schema allows arbitrary configuration fields:This allows attackers to inject arbitrary keys into the adapter configuration object.
Later, during workspace provisioning, the server runtime executes a shell command derived directly from this configuration.
Relevant code path:Example logic:Inside runWorkspaceCommand the command is executed using:Because no validation, escaping, or allowlist is applied, attacker-controlled configuration becomes a direct OS command execution primitive.Affected FilesFunctions involved:Attacker ModelRequired privileges:
Attacker needs:This credential is intended for agent automation and should not grant host-level execution privileges.
Agent credentials may also be exposed to external runtimes, plugins, or third-party agent providers. Allowing such credentials to configure host-executed commands creates a privilege escalation vector.
No board or administrator access is required.Attacker ChainComplete exploit chain:Trust Boundary ViolationPaperclip’s architecture assumes the following separation:This allows an agent to execute commands outside its intended permissions.Why This Is a Vulnerability (Not Expected Behavior)The provisionCommand field appears intended for trusted operators configuring workspace strategies.
However, the current API design allows agents themselves to modify this configuration.
Because agent credentials are designed for automation and may be exposed to agent runtimes, plugins, or external providers, allowing them to configure commands executed by the host introduces a privilege escalation vector.
Therefore:The vulnerability arises from insufficient separation between configuration authority and execution authority.PoCThe following PoC demonstrates safe command execution by writing a marker file on the server.
The PoC does not modify system state beyond creating a file.Step 1 — Setup EnvironmentRun Server:Login Claude:Step 2 — Obtain Agent API keyCreate an agent via the UI or CLI and obtain its API key.
Example:Step 3 — Identify agent IDStep 4 — Inject malicious configurationStep 5 — Trigger executionStep 6 — Verify command executionImpactSuccessful exploitation allows:Potential attacker actions:Because Paperclip orchestrates multiple agents and repositories, this can lead to full compromise of the deployment environment.
This effectively allows a malicious agent to escape the orchestration layer and execute arbitrary commands on the server host.Recommended FixRestrict configuration authority
Agents should not be able to modify execution-sensitive configuration fields.
Example mitigation:Server-side allowlist
Only allow trusted configuration keys.
Example:Avoid shell execution
Instead of:prefer:or a restricted command runner.Input validation
Reject commands containing shell operators:Sandboxed workspace execution
Workspace provisioning should run in a restricted environment (container / sandbox).Minimal Patch SuggestionOne possible mitigation is to prevent agent principals from modifying execution-sensitive configuration fields such as `workspaceStrategy.provisionCommand`.
For example, during agent configuration updates, the server can explicitly reject this field when the request is authenticated using an Agent API key.
Example TypeScript guard:Additionally, the server should avoid executing arbitrary shell commands derived from configuration values.
Instead of executing:prefer structured execution:or restrict the command to a predefined allowlist.Security Impact StatementAn authenticated attacker with an Agent API key can modify their agent configuration to inject arbitrary shell commands into `workspaceStrategy.provisionCommand`. These commands are executed by the Paperclip server during workspace provisioning via `spawn("/bin/sh", ["-c", command])`, resulting in arbitrary command execution on the host system.DisclosureThis vulnerability was discovered during security research on the Paperclip orchestration runtime.
The issue is reported privately to allow maintainers to patch before public disclosure.
CVSS v3.1 score: 8.8