CVE-2026-49406 Overview
CVE-2026-49406 is a path traversal vulnerability in the Deno JavaScript, TypeScript, and WebAssembly runtime. The flaw affects Deno versions prior to 2.7.12 when running in Bring Your Own Node Modules (BYONM) mode with nodeModulesDir: "manual". The module resolver fails to validate that a package's resolved entrypoint stays within its node_modules/<pkg>/ directory. A malicious package.jsonmain field containing .. segments can resolve to arbitrary files on disk. The resolver then reads those files while bypassing the --allow-read permission allowlist. This vulnerability is tracked as [CWE-22] (Improper Limitation of a Pathname to a Restricted Directory).
Critical Impact
A require("evil-pkg") call can read arbitrary files on the host filesystem, bypassing Deno's permission model and disclosing data that direct Deno.readTextFileSync(...) calls would be denied.
Affected Products
- Deno runtime versions prior to 2.7.12
- Deno deployments configured with BYONM mode (nodeModulesDir: "manual")
- Applications using require() to load untrusted npm packages under BYONM
Discovery Timeline
- 2026-06-23 - CVE-2026-49406 published to NVD
- 2026-06-23 - Last updated in NVD database
Technical Details for CVE-2026-49406
Vulnerability Analysis
The vulnerability resides in Deno's BYONM module resolution path. When Deno runs with nodeModulesDir: "manual", the resolver locates a package entrypoint by reading the main field from package.json. The resolver joins this value with the package directory but does not normalize or constrain the result. An attacker crafting a package.json with a main value such as ../../../../etc/passwd causes the resolver to compute a path outside node_modules/<pkg>/.
The critical security gap occurs at the file read step. The resolver loads the resolved file directly without consulting Deno's --allow-read permission allowlist. Deno's sandbox normally requires explicit grants for filesystem reads, but the module loader treats package resolution as an internal operation exempt from that check.
Exploitation requires the victim to invoke require("evil-pkg") against an attacker-controlled package. The contents of the targeted file are returned to the calling code as the package module, enabling information disclosure of files the runtime user can read on disk.
Root Cause
The resolver omits a containment check that would ensure the resolved entrypoint path remains a descendant of the package's node_modules/<pkg>/ directory. The permission model is also not consulted during module load, which is the secondary defense failure.
Attack Vector
Exploitation is local and requires low privileges. An attacker supplies a malicious npm package, either through dependency confusion, a compromised registry, or a supply chain attack. The victim must install the package and invoke require() on it under BYONM mode. No user interaction beyond normal application execution is required. See the GitHub Security Advisory GHSA-968w-xfqw-vp9q for the upstream technical write-up.
Detection Methods for CVE-2026-49406
Indicators of Compromise
- Presence of package.json files under node_modules/ containing main field values with .. path segments or absolute paths.
- Deno processes reading files outside expected node_modules/<pkg>/ directories during module load.
- Unexpected file read syscalls from the Deno runtime targeting sensitive paths such as /etc/, ~/.ssh/, or ~/.aws/.
Detection Strategies
- Scan repositories and container images for package.json files whose main field references parent directories or absolute paths.
- Audit Deno invocations to identify projects running with nodeModulesDir: "manual" and untrusted third-party packages.
- Inspect Deno version strings across CI/CD pipelines and developer workstations for builds older than 2.7.12.
Monitoring Recommendations
- Log filesystem access by Deno processes and alert on reads outside the project working directory and node_modules/.
- Track installed npm package provenance and flag newly added dependencies for review before use under BYONM.
- Correlate Deno runtime telemetry with permission-flag arguments to identify deployments running without strict --allow-read allowlists.
How to Mitigate CVE-2026-49406
Immediate Actions Required
- Upgrade Deno to version 2.7.12 or later on all developer workstations, build agents, and production hosts.
- Audit existing node_modules trees for package.json files containing suspicious main values referencing parent paths.
- Restrict use of BYONM mode (nodeModulesDir: "manual") to trusted, vetted dependencies only.
Patch Information
The Deno project fixed this vulnerability in release 2.7.12. The patch adds a containment check ensuring resolved package entrypoints remain within the package directory. Refer to the GitHub Security Advisory GHSA-968w-xfqw-vp9q for release notes and patch references.
Workarounds
- Avoid BYONM mode where possible and use Deno's default module resolution.
- Pin and vendor only trusted npm packages, removing or replacing any package with a main field containing .. or absolute paths.
- Run Deno workloads under restricted OS users so that arbitrary file reads disclose less sensitive data.
# Configuration example
deno upgrade --version 2.7.12
deno --version
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

