Details
Attack Scenarios
- Desktop user (local_trusted): Any process or malicious web page making local HTTP requests to
127.0.0.1:3100can achieve RCE with zero authentication - Team deployment (authenticated): Any employee with Paperclip access can compromise the server and all repositories managed by it
- Chained attack: Combine with SSRF or DNS rebinding to attack Paperclip instances from the network
---
Remediation Recommendations
Immediate (Critical)
- Input validation: Reject or sanitize
cleanupCommandandteardownCommandfields in the PATCH handler. Do not allow user-supplied values to be passed to shell execution.
- Command allowlisting: If custom cleanup commands are needed, implement a strict allowlist of permitted commands (e.g.,
git clean,rm -rf <workspace_dir>).
- Use `execFile` instead of `spawn` with shell: Replace
spawn(shell, ["-c", command])withexecFile()using an argument array, which prevents shell metacharacter injection.
Short-term
- Authorization check: Add proper authorization checks BEFORE processing the PATCH request. Validate that the user has explicit permission to modify workspace configuration.
- Separate config fields: Do not allow the same endpoint to update both workspace status and security-sensitive configuration fields like commands.
Long-term
- Sandboxed execution: Run cleanup commands in a sandboxed environment (container, VM) with minimal privileges.
- Audit logging: Log all modifications to command fields for forensic analysis.
- Security review: Audit all
spawn,exec, andexecFilecalls across the codebase for similar injection patterns.
---
Proof of Concept Script
Script
poc_paperclip_rce.py
The full automated PoC is available as poc_paperclip_rce.py. It:
- Auto-detects deployment mode and skips auth for
local_trusted - Discovers company and workspace automatically
- Reactivates failed/archived workspaces
- On Windows, auto-locates
sh.exefrom Git and restarts Paperclip if needed - Runs 3 independent RCE proofs: file write, systeminfo, calc.exe
- Works on Linux, macOS, and Windows
Usage:
python poc_paperclip_rce.py --target http://127.0.0.1:3100