GHSA-w3hv-x4fp-6h6j: @grackle ai/server @grackle-ai/server Has Missing WebSocket Origin Vulnerability

HIGH
CWE-346
Published
Advisory Summary

GHSA-w3hv-x4fp-6h6j is a HIGH @grackle-ai/server has missing websocket origin vulnerability (CWE-346: Origin Validation Error) affecting @grackle ai/server libraries in the npm ecosystem. The issue involves @grackle-ai/server has missing websocket origin header validation. Remediation is available by upgrading affected packages to version 0.70.3.

GHSA-w3hv-x4fp-6h6j at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-w3hv-x4fp-6h6j
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-346: Origin Validation Error
Affected Product @grackle ai/server
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-w3hv-x4fp-6h6j

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

@grackle-ai/server fixed: 0.70.3
npm install @grackle-ai/server@0.70.3
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 @grackle-ai/server

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-w3hv-x4fp-6h6j, inspect your project dependencies using npm:

npm ls @grackle-ai/server

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

Note: The npm ls @grackle-ai/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-346: Origin Validation Error, where the product does not properly verify that the source of data or communication is valid. In @grackle ai/server, 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

### Impact The WebSocket upgrade handler in the server validates authentication (API key token or session cookie) but does not check the `Origin` header. A malicious webpage on a different origin could initiate a WebSocket connection to `ws://localhost:3000/ws` if it can leverage the user's session cookie (which is `SameSite=Lax`, allowing top-level navigations). This enables **cross-origin WebSocket hijacking** — if a user visits a malicious site while a Grackle session is active, the attacker's page could open a WebSocket and subscribe to real-time events (session output, task updates, environment state). **Affected code:** - `packages/server/src/ws-bridge.ts:80-91` — connection handler accepts WebSocket upgrades without checking `req.headers.origin` ### Patches **Fix:** Validate `req.headers.origin` against an allowlist before accepting connections: ```typescript const origin = req.headers.origin || ""; if (origin && !origin.includes("localhost") && !origin.includes("127.0.0.1")) { ws.close(4003, "Invalid origin"); return; } ``` ### Workarounds Ensure the Grackle server is only accessible on `127.0.0.1` (the default). Do not use `--allow-network` in untrusted network environments. ### Resources - CWE-346: Origin Validation Error - File: `packages/server/src/ws-bridge.ts`

GHSA-w3hv-x4fp-6h6j Affected @grackle ai/server Versions

1 component(s)
Fixed Versions:
0.70.3
Product / Package Ecosystem Affected Versions Fixed Version
@grackle-ai/server
npm
< 0.70.3
0.70.3

References

Frequently Asked Questions

What is GHSA-w3hv-x4fp-6h6j?
GHSA-w3hv-x4fp-6h6j is a security vulnerability in @grackle ai/server involving @grackle-ai/server has Missing WebSocket Origin Header Validation under CWE-346: Origin Validation Error.
Which @grackle ai/server versions are affected?
Affected versions include releases prior to 0.70.3 across affected packages: @grackle-ai/server.
What version fixes GHSA-w3hv-x4fp-6h6j?
Upgrading to 0.70.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @grackle-ai/server affected?
Yes, @grackle-ai/server is affected in releases prior to 0.70.3. Upgrade your dependency to 0.70.3 or later.
What CWE is associated with GHSA-w3hv-x4fp-6h6j?
GHSA-w3hv-x4fp-6h6j is classified under CWE-346: Origin Validation Error (The product does not properly verify that the source of data or communication is valid.).
How can I check npm dependencies for GHSA-w3hv-x4fp-6h6j?
Run the dependency tree command: 'npm ls @grackle-ai/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-w3hv-x4fp-6h6j",
  "modified" : "2026-03-25T17:28:05Z",
  "published" : "2026-03-25T17:27:48Z",
  "aliases" : [ ],
  "summary" : "@grackle-ai/server has Missing WebSocket Origin Header Validation",
  "details" : "### Impact\n\nThe WebSocket upgrade handler in the server validates authentication (API key token or session cookie) but does not check the `Origin` header. A malicious webpage on a different origin could initiate a WebSocket connection to `ws://localhost:3000/ws` if it can leverage the user's session cookie (which is `SameSite=Lax`, allowing top-level navigations).\n\nThis enables **cross-origin WebSocket hijacking** — if a user visits a malicious site while a Grackle session is active, the attacker's page could open a WebSocket and subscribe to real-time events (session output, task updates, environment state).\n\n**Affected code:**\n- `packages/server/src/ws-bridge.ts:80-91` — connection handler accepts WebSocket upgrades without checking `req.headers.origin`\n\n### Patches\n\n**Fix:** Validate `req.headers.origin` against an allowlist before accepting connections:\n```typescript\nconst origin = req.headers.origin || \"\";\nif (origin && !origin.includes(\"localhost\") && !origin.includes(\"127.0.0.1\")) {\n  ws.close(4003, \"Invalid origin\");\n  return;\n}\n```\n\n### Workarounds\n\nEnsure the Grackle server is only accessible on `127.0.0.1` (the default). Do not use `--allow-network` in untrusted network environments.\n\n### Resources\n\n- CWE-346: Origin Validation Error\n- File: `packages/server/src/ws-bridge.ts`",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@grackle-ai/server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.70.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.70.2"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nick-pape/grackle/security/advisories/GHSA-w3hv-x4fp-6h6j"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nick-pape/grackle"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-346" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-25T17:27:48Z",
    "nvd_published_at" : null
  }
}