Skip to content

Deno permission escalation vulnerability via open of privileged files with missing `--deny` flag

High severity GitHub Reviewed Published May 7, 2024 in denoland/deno

Package

cargo deno (Rust)

Affected versions

< 1.43.1

Patched versions

1.43.1

Description

The Deno sandbox may be unexpectedly weakened by allowing file read/write access to privileged files in various locations on Unix and Windows platforms. For example, reading /proc/self/environ may provide access equivalent to --allow-env, and writing /proc/self/mem may provide access equivalent to --allow-all.

Users who grant read and write access to the entire filesystem may not realize that these access to these files may have additional, unintended consequences. The documentation did not reflect that this practice should be undertaken to increase the strength of the security sandbox.

Impact

Users who run code with --allow-read or --allow-write may unexpectedly end up granting additional permissions via file-system operations.

Patches

Deno 1.43 and above require explicit --allow-all access to read or write /etc, /dev on unix platform (as well as /proc and /sys on linux platforms), and any path starting with \\ on Windows.

Workarounds

The security sandbox in previous versions of Deno allows for denial of access to these files, but it requires an explicit addition of deny flags: --deny-read=/dev --deny-read=/sys --deny-read=/proc --deny-read=/etc --deny-write=/dev --deny-write=/sys --deny-write=/proc --deny-write=/etc. Note that symlinks in allowed locations may defeat this protection in earlier versions of Deno.

Reporters

This vulnerability was reported by a number of analysts. Thanks to oliver@secfault-security.com, finn@secfault-security.com, @leesh3288, and @cristianstaicu for their reports and analysis.

References

@mmastrac mmastrac published to denoland/deno May 7, 2024
Published by the National Vulnerability Database May 7, 2024
Published to the GitHub Advisory Database May 8, 2024
Reviewed May 8, 2024

Severity

High
8.5
/ 10

CVSS base metrics

Attack vector
Adjacent
Attack complexity
Low
Privileges required
High
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High
CVSS:3.1/AV:A/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H

Weaknesses

CVE ID

CVE-2024-34346

GHSA ID

GHSA-23rx-c3g5-hv9w

Source code

Credits

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