CVE-2024-27931: Deno Insufficient Permission Checking Vulnerability
MODERATECVE-2024-27931 is a MODERATE (CVSS 5.8) insufficient permission checking vulnerability (CWE-20: Improper Input Validation) affecting Deno libraries in the crates.io ecosystem. The issue involves insufficient permission checking in `deno.maketemp*` apis. Remediation is available by upgrading affected packages to version 1.41.1.
CVE-2024-27931 at a Glance
Security Impact
CVSS: 5.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:N/S:C/C:N/I:L/A:N).
How to Fix CVE-2024-27931
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.
Upgrade deno to 1.41.1
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-27931, 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.1), 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. 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
CVE-2024-27931 Affected Deno Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
deno
|
crates.io |
< 1.41.1
|
1.41.1
|
References
Frequently Asked Questions
What is CVE-2024-27931?
Which Deno versions are affected?
What version fixes CVE-2024-27931?
Is deno affected?
What is the CVSS score of CVE-2024-27931?
What CWE is associated with CVE-2024-27931?
How can I check crates.io dependencies for CVE-2024-27931?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-hrqr-jv8w-v9jh",
"modified" : "2024-03-05T20:30:03Z",
"published" : "2024-03-05T16:19:44Z",
"aliases" : [ "CVE-2024-27931" ],
"summary" : "Insufficient permission checking in `Deno.makeTemp*` APIs",
"details" : "### Impact\n\nInsufficient 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.\n\nA 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:\n\n```\n$ mkdir /tmp/good\n$ mkdir /tmp/bad\n$ deno repl --allow-write=/tmp/good\n> Deno.makeTempFileSync({ dir: \"/tmp/bad\" })\n┌ ⚠️ Deno requests write access to \"/tmp/bad\".\n├ Requested by `Deno.makeTempFile()` API.\n├ Run again with --allow-write to bypass this prompt.\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all write permissions) > n\n❌ Denied write access to \"/tmp/bad\".\nUncaught PermissionDenied: Requires write access to \"/tmp/bad\", run again with the --allow-write flag\n at Object.makeTempFileSync (ext:deno_fs/30_fs.js:176:10)\n at <anonymous>:1:27\n> Deno.makeTempFileSync({ dir: \"/tmp/good\", prefix: \"../bad/\" })\n\"/tmp/good/../bad/a9432ef5\"\n$ ls -l /tmp/bad/a9432ef5\n-rw-------@ 1 user group 0 Mar 4 09:20 /tmp/bad/a9432ef5\n```\n\n### Patches\n\nThis is fixed in Deno 1.41.1.\n\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "deno"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.41.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/denoland/deno/security/advisories/GHSA-hrqr-jv8w-v9jh"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-27931"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/denoland/deno"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-03-05T16:19:44Z",
"nvd_published_at" : "2024-03-05T17:15:07Z"
}
}