Paperclip Unauthenticated Remote Code Execution via Import Authorization Bypass
An unauthenticated attacker can achieve remote code execution on Paperclip instances by exploiting multiple vulnerabilities, including open signup, self-approval of CLI authentication challenges, and missing authorization checks in the company import endpoint, leading to arbitrary command execution as the server's OS user.
Paperclip is vulnerable to an unauthenticated remote code execution (RCE) flaw, affecting instances running in authenticated mode with default configurations. This vulnerability allows attackers to gain full control of the system without requiring any user interaction or credentials. The exploit chain consists of several steps, including creating an account without email verification, generating and approving a CLI authentication token, and exploiting a missing authorization check in the company import endpoint. This allows the attacker to deploy a malicious agent configured with a process adapter, enabling arbitrary command execution as the server's OS user. The vulnerability affects versions prior to 2026.410.0 of the paperclipai and @paperclipai/server npm packages.
Attack Chain
- Account Creation: The attacker creates a new account via the
/api/auth/sign-up/emailendpoint. No invite token or email verification is required. - Sign In: The attacker signs in with the newly created account via the
/api/auth/sign-in/emailendpoint, obtaining a session cookie. - CLI Auth Challenge Creation: The attacker creates a CLI auth challenge via the
/api/cli-auth/challengesendpoint. No authentication is needed for this step. The response includes atokenandboardApiToken. - CLI Auth Challenge Approval: The attacker approves the CLI auth challenge via the
/api/cli-auth/challenges/<id>/approveendpoint using the session cookie obtained in step 2. The server only verifies that the caller is a board user, not that they are the challenge creator. - Company Import: The attacker exploits the missing
assertInstanceAdmincheck in the/api/companies/importendpoint to import a malicious company configuration. This configuration includes an agent with aprocessadapter that specifies a command to execute. - Agent Trigger: The attacker triggers the malicious agent via the
/api/agents/<agent-id>/wakeupendpoint. - Command Execution: The
processadapter executes the attacker-specified command (e.g.,bash -c "id > /tmp/pwned.txt && ..."), resulting in code execution as the server's OS user.
Impact
Successful exploitation allows an unauthenticated attacker to execute arbitrary commands as the Paperclip server's OS user. This grants:
- Full filesystem access (read/write as the server user)
- Access to all data in the Paperclip database
- Ability to pivot to internal network services
- Ability to disrupt all agent operations
The attack is fully automated and works against the default deployment configuration, posing a critical risk to affected systems.
Recommendation
- Disable open registration by default: Modify
server/src/config.ts:172to change?? falseto?? trueand documentPAPERCLIP_AUTH_DISABLE_SIGN_UPin the deployment guide. - Prevent CLI auth self-approval: Modify
server/src/routes/access.tsaround line 1700 to reject when the approving user is the same user who created the challenge. - Require email verification: Modify
server/src/auth/better-auth.ts:91to setrequireEmailVerification: true. - Add
assertInstanceAdminto the import endpoint fornew_companymode: Modifyserver/src/routes/companies.ts, lines 161-176, to include theassertInstanceAdmincheck forPOST /importandPOST /import/previewwhenmodeis set tonew_company. - Monitor web server logs for POST requests to
/api/companies/importthat do not originate from an instance administrator to detect potential exploitation attempts, utilizing the rule below.
Detection coverage 2
Detect Company Import Without Instance Admin
highDetects attempts to import a new company without instance administrator privileges.
Detect CLI Auth Challenge Creation
mediumDetects the creation of CLI auth challenges, which may be followed by unauthorized approval.
Detection queries are available on the platform. Get full rules →
Indicators of compromise
1
| Type | Value |
|---|---|
| attacker@evil.com |