Summary
CVE-2026-88899 is a critical external control of file path vulnerability (CWE-73) affecting the knowns npm package prior to version 0.31.0. The /api/opencode proxy endpoint fails to validate the x-opencode-directory request header, allowing unauthenticated remote attackers to redirect the embedded OpenCode agent’s file operations to arbitrary directories on the host filesystem. The issue is rated CRITICAL, with a CVSS v3.1 base score of 9.8 and a CVSS v4.0 base score of 9.3.
Technical details
- Root cause: The
proxyOpenCode()function ininternal/server/server.gouses fail-open logic — it only substitutes the server’s safeactiveRootworking directory when the client-supplied value is empty. If an attacker supplies a value, it is passed through unmodified to the underlying OpenCode daemon. - Trigger conditions: An attacker sends an HTTP request to the
knownsserver’s/api/opencodeendpoint with a craftedx-opencode-directoryheader (or?directoryquery parameter) pointing outside the intended project root (e.g.,/root,/etc,~/.ssh). - Attack vector: Network-based, requires no authentication and no user interaction; the vulnerable endpoint listens by default on port 4141.
- Impact: The OpenCode agent initializes file operations at the attacker-specified path with the daemon’s OS-level privileges, enabling reading of sensitive files (SSH keys, credentials,
.envfiles), writing malicious content (e.g., to shell profiles or cron jobs), and deletion/corruption of arbitrary files — resulting in full compromise of confidentiality, integrity, and availability.
Affected software
knowns(npm package, vendor: knowns-dev) — all versions prior to 0.31.0- Fixed in version 0.31.0, which removed the embedded OpenCode proxy entirely as part of a Chat UI removal
Severity
- CVSS v3.1 Base Score: 9.8 (Critical)
- Vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - (A CVSS v4.0 score of 9.3, Critical, is also assigned:
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N)
Mitigation and recommended actions
- Immediate: Upgrade
knownsto version 0.31.0 or later, where the embedded OpenCode proxy endpoint has been removed. - If immediate patching is not possible:
- Restrict network access to the
knownsserver (default port 4141) to trusted hosts only, using firewall rules or network segmentation. - Do not expose the
knownsserver directly to the internet. - Monitor for HTTP requests to
/api/opencodecontaining unexpectedx-opencode-directoryheader values ordirectoryquery parameters referencing paths outside the intended project root. - No official patch exists for versions prior to 0.31.0 — upgrading is the only complete remediation.
- Restrict network access to the

