CVE-2024-27936: Deno Deno's Deno_runtime Vulnerable To Interactive Vulnerability

HIGH
Advisory Identifier: GHSA-m4pq-fv2w-6hrw
CVSS 8.8
CWE-150
Published
Advisory Summary

CVE-2024-27936 is a HIGH (CVSS 8.8) deno's deno_runtime vulnerable to interactive vulnerability (CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences) affecting Deno libraries in the crates.io ecosystem. The issue involves deno's deno_runtime vulnerable to interactive permission prompt spoofing via improper ansi stripping. Remediation is available by upgrading affected packages to version 1.41.0, 0.147.0.

CVE-2024-27936 at a Glance

CVE Identifier CVE-2024-27936
GHSA Identifier GHSA-m4pq-fv2w-6hrw
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences
Affected Product Deno
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 8.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2024-27936

To remediate this vulnerability, upgrade all affected Deno dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

deno fixed: 1.41.0
Upgrade deno to 1.41.0
deno_runtime fixed: 0.147.0
Upgrade deno_runtime to 0.147.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for deno

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-27936, inspect your project dependencies for Deno:

inspect dependencies for deno

Analyze the terminal output to locate any version of Deno in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.41.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences, where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as escape, meta, or control character sequences when they are sent to a downstream component. In Deno, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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](https://github.com/denoland/deno/commit/78d430103a8f6931154ddbbe19d36f3b8630286d), 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`. ``` javascript 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.

CVE-2024-27936 Affected Deno Versions

2 component(s)
Fixed Versions:
1.41.00.147.0
Product / Package Ecosystem Affected Versions Fixed Version
deno
crates.io
≥ 1.32.1
< 1.41.0
1.41.0
deno_runtime
crates.io
≥ 0.103.0
< 0.147.0
0.147.0

References

Frequently Asked Questions

What is CVE-2024-27936?
CVE-2024-27936 is a security vulnerability in Deno involving Deno's deno_runtime vulnerable to interactive permission prompt spoofing via improper ANSI stripping under CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences.
Which Deno versions are affected?
Affected versions include releases prior to 1.41.0, 0.147.0 across affected packages: deno, deno_runtime.
What version fixes CVE-2024-27936?
Upgrading to 1.41.0, 0.147.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is deno affected?
Yes, deno is affected in releases prior to 1.41.0. Upgrade your dependency to 1.41.0 or later.
Is deno_runtime affected?
Yes, deno_runtime is affected in releases prior to 0.147.0. Upgrade your dependency to 0.147.0 or later.
What is the CVSS score of CVE-2024-27936?
CVE-2024-27936 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-27936?
CVE-2024-27936 is classified under CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences (The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as escape, meta, or control character sequences when they are sent to a downstream component.).
How can I check crates.io dependencies for CVE-2024-27936?
Run the dependency tree command: 'inspect dependencies for deno'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-m4pq-fv2w-6hrw",
  "modified" : "2024-06-10T12:32:57Z",
  "published" : "2024-03-05T20:54:14Z",
  "aliases" : [ "CVE-2024-27936" ],
  "summary" : "Deno's deno_runtime vulnerable to interactive permission prompt spoofing via improper ANSI stripping",
  "details" : "### Summary\nA maliciously crafted permission request can show the spoofed permission prompt by inserting a broken ANSI escape sequence into the request contents.\n\n### Details\nIn [the patch for CVE-2023-28446](https://github.com/denoland/deno/commit/78d430103a8f6931154ddbbe19d36f3b8630286d), 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.\n\nFor 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.\n\nThis difference allows a malicious Deno program to spoof the contents of the permission prompt.\n\n\n### PoC\nRun 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`.\n``` javascript\nconst permission = { name: \"read\", path: \"/tmp/hello\\u001b[/../../etc/hosts\" };\nawait Deno.permissions.request(permission);\nconsole.log(await Deno.readTextFile(\"/etc/hosts\"));\n```\n\n#### Expected prompt\n```\n┌ ⚠️  Deno requests read access to \"/etc/hosts\".\n├ Requested by `Deno.permissions.query()` API\n├ Run again with --allow-read to bypass this prompt.\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all read permissions) >\n```\n\n#### Actual prompt\n```\n┌ ⚠️  Deno requests read access to \"/tmp/hellotc/hosts\".\n├ Requested by `Deno.permissions.query()` API\n├ Run again with --allow-read to bypass this prompt.\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all read permissions) >\n\n```\n\n### Impact\nAny 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "deno"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.32.1"
      }, {
        "fixed" : "1.41.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "deno_runtime"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.103.0"
      }, {
        "fixed" : "0.147.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/denoland/deno/security/advisories/GHSA-m4pq-fv2w-6hrw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-27936"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/denoland/deno/commit/78d430103a8f6931154ddbbe19d36f3b8630286d"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/denoland/deno/commit/7e6b94231290020b55f1d08fb03ea8132781abc5"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/denoland/deno"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-150" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-05T20:54:14Z",
    "nvd_published_at" : "2024-03-21T02:52:22Z"
  }
}