MEDIUM 5.5

CVE-2026-49406: Deno Path Traversal in BYONM Module Resolution

Deno, a modern JavaScript and TypeScript runtime, has a path traversal vulnerability in its module resolver when operating in BYONM (Bring Your Own Node Modules) mode. A malicious package can craft a package.json file with directory traversal sequences (..) in its main field, causing Deno to load files from arbitrary locations on disk rather than from within the package's intended directory. Critically, this circumvents Deno's permission system—files that would normally be blocked by --allow-read restrictions can be read anyway if accessed through a require() call. The issue affects Deno versions prior to 2.7.12 and is resolved in that release.

Source data · NVD / CISA · public domain

CVSS
3.1 · 5.5 MEDIUM · CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Weaknesses (CWE)
CWE-22
Affected products
1 configuration(s)
Published / Modified
2026-06-23 / 2026-06-26

NVD description (verbatim)

Deno is a JavaScript, TypeScript, and WebAssembly runtime. Prior to 2.7.12, when Deno was run in BYONM mode (nodeModulesDir: "manual"), the module resolver did not validate that a package's resolved entrypoint stayed within its node_modules/<pkg>/ directory. A malicious package.json whose main field contained .. segments was able to resolve to an arbitrary path on disk, and the resolver then read that file without consulting the --allow-read allowlist. This let a require("evil-pkg") call return the contents of a file that a direct Deno.readTextFileSync(...) call would have been blocked from reading. This vulnerability is fixed in 2.7.12.

2 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability stems from insufficient path validation in Deno's module resolution logic when BYONM mode is enabled (nodeModulesDir: "manual"). When resolving a package's entrypoint, the resolver accepts the value from the package.json main field without verifying that the resolved path remains within the package's own node_modules/<pkg>/ directory. An attacker can include parent directory references (..) in the main field to traverse outside the package directory and point to arbitrary files on the filesystem. The resolver then reads the target file directly, bypassing the --allow-read permission allowlist that would normally govern file access. This creates a privilege escalation where code execution within a require() context gains unintended file access. The fix in 2.7.12 adds proper path normalization and validation to ensure resolved entrypoints cannot escape their designated package directories.

Business impact

For organizations relying on Deno in production, particularly in multi-tenant or sandboxed environments, this vulnerability undermines the security model. The permission allowlist system—a core trust boundary in Deno—can be bypassed, potentially exposing sensitive files (configuration, credentials, source code) to packages that should have limited access. In development environments where BYONM mode is used, the risk extends to supply chain attacks: a compromised or malicious package dependency can silently exfiltrate data that developers believed was protected. Teams shipping Deno applications must assume that any transitive dependency could leverage this flaw to read files outside its intended scope.

Affected systems

Deno versions prior to 2.7.12 are affected when explicitly operating in BYONM mode (nodeModulesDir: "manual" in deno.json or equivalent configuration). Systems using Deno's default module resolution strategy are not impacted. The vulnerability requires the use of a malicious or compromised npm package with a crafted package.json, making it relevant to any Deno project that consumes npm dependencies via node_modules.

Exploitability

Exploitability is straightforward: an attacker must publish or compromise an npm package and manipulate its package.json main field to include path traversal sequences. The attack requires local code execution (require() of the malicious package) and is not remotely exploitable on its own. However, the low barrier to entry—simply editing a package.json field—combined with the commonality of transitive dependencies means the risk is practically significant in supply chain scenarios. No user interaction is needed beyond the normal act of installing and using a package.

Remediation

Upgrade Deno to version 2.7.12 or later. Organizations should audit their Deno deployments to identify which systems are using BYONM mode and prioritize updates accordingly. As an interim mitigation (if immediate upgrading is not feasible), restrict the packages installed in node_modules to trusted sources only, implement dependency scanning to detect suspicious package.json configurations, and consider using lock files to pin exact versions and prevent unexpected package updates.

Patch guidance

Apply the update to Deno 2.7.12 as soon as feasible. The patch includes corrected path validation logic that normalizes and validates entrypoint paths before resolution. Verify the update has been applied by checking the Deno version (deno --version should report 2.7.12 or later). Test your existing Deno applications post-upgrade to ensure no regressions in module resolution behavior, particularly if your codebase has non-standard require() patterns.

Detection guidance

Audit your deno.json or deno.jsonc configuration files for the presence of nodeModulesDir: "manual" to identify systems in BYONM mode. Review installed npm packages for suspicious package.json main fields containing .. or unusual path patterns—tooling like npm audit can help, though focused inspection may be necessary. Monitor file access patterns in Deno processes; unexpected reads of sensitive files outside expected directories could indicate exploitation. Use software composition analysis tools to track Deno versions across your infrastructure and flag instances below 2.7.12.

Why prioritize this

Although classified as MEDIUM severity, this vulnerability merits prompt attention because it directly undermines a foundational security mechanism (the permission allowlist) that developers rely on to contain untrusted code. The barrier to exploitation is low, and the impact—unauthorized file disclosure—can compromise secrets and intellectual property. Prioritize patching systems that use BYONM mode and consume external npm packages, particularly in supply chain-sensitive contexts.

Risk score, explained

The CVSS 3.1 score of 5.5 (MEDIUM) reflects local attack vector, low privileges required, low complexity, and a confidentiality impact with no integrity or availability damage. The score appropriately captures that the vulnerability requires local code execution and delivers information disclosure rather than system compromise. However, the score does not fully account for the privilege escalation aspect (bypassing intended access controls) or the risk amplification in supply chain scenarios, so security teams should consider context-specific factors when prioritizing.

Frequently asked questions

Does this affect Deno users who are not using BYONM mode?

No. The vulnerability is specific to BYONM mode (nodeModulesDir: "manual"). Users relying on Deno's default module resolution are not affected. Check your deno.json configuration to verify which mode you are using.

Can this vulnerability be exploited without a malicious package being installed?

No. The exploit requires that a malicious or compromised npm package with a crafted package.json be installed and then used via require(). Exposure is limited to projects that consume npm packages through node_modules in BYONM mode.

What exactly can an attacker read with this vulnerability?

An attacker can read any file on the filesystem that the Deno process has permissions to read at the OS level, regardless of Deno's --allow-read restrictions. This typically includes configuration files, environment files, source code, and other sensitive data accessible to the user running Deno.

Is there a workaround if I cannot upgrade immediately?

A temporary workaround is to minimize the attack surface by strictly vetting and pinning npm dependencies, avoiding new installs from untrusted sources, and implementing file access monitoring. However, upgrading to 2.7.12 is the only complete fix.

This analysis is provided for informational purposes and represents the state of knowledge as of the publication date. Vulnerability details, patch availability, and affected versions should be verified directly with Deno's official security advisories and release notes before making production decisions. Organizations should conduct their own risk assessments based on their specific infrastructure, configuration, and threat model. SEC.co makes no warranty regarding the completeness or accuracy of this analysis and recommends consulting official vendor documentation and security guidance for definitive remediation steps. Source: NVD (public-domain), retrieved 2026-07-29. Analysis generated by SEC.co (claude-haiku-4-5).