CVE-2021-21413: Isolated vm Misuse Of `Reference` And Other Vulnerability
HIGHCVE-2021-21413 is a HIGH (CVSS 8.0) misuse of `reference` and other vulnerability (CWE-913: Improper Control of Dynamically-Managed Code Resources) affecting Isolated vm libraries in the npm ecosystem. The issue involves misuse of `reference` and other transferable apis may lead to access to nodejs isolate. Remediation is available by upgrading affected packages to version 4.0.0.
CVE-2021-21413 at a Glance
Security Impact
CVSS: 8.0
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N).
How to Fix CVE-2021-21413
To remediate this vulnerability, upgrade all affected Isolated vm dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install isolated-vm@4.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls isolated-vm
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-21413, inspect your project dependencies using npm:
npm ls isolated-vm
Analyze the terminal output to locate any version of Isolated vm in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.0), your application is affected.
Note: The npm ls isolated-vm command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-913: Improper Control of Dynamically-Managed Code Resources, where the product does not properly restrict reading from or writing to dynamically-managed code resources such as variables, objects, classes, attributes, functions, or executable instructions or statements. In Isolated vm, 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-2021-21413 Affected Isolated vm Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
isolated-vm
|
npm |
< 4.0.0
|
4.0.0
|
References
Frequently Asked Questions
What is CVE-2021-21413?
Which Isolated vm versions are affected?
What version fixes CVE-2021-21413?
Is isolated-vm affected?
What is the CVSS score of CVE-2021-21413?
What CWE is associated with CVE-2021-21413?
How can I check npm dependencies for CVE-2021-21413?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-mmhj-4w6j-76h7",
"modified" : "2021-03-30T22:27:45Z",
"published" : "2021-04-06T17:22:55Z",
"aliases" : [ "CVE-2021-21413" ],
"summary" : "Misuse of `Reference` and other transferable APIs may lead to access to nodejs isolate",
"details" : "Versions of `isolated-vm` before v4.0.0, and especially before v3.0.0, have API pitfalls which may make it easy for implementers to expose supposed secure isolates to the permissions of the main nodejs isolate.\n\n`Reference` objects allow access to the underlying reference's full prototype chain. In an environment where the implementer has exposed a `Reference` instance to an attacker they would be able to use it to acquire a `Reference` to the nodejs context's `Function` object.\n\nSimilar application-specific attacks could be possible by modifying the local prototype of other API objects.\n\nAccess to `NativeModule` objects could allow an attacker to load and run native code from anywhere on the filesystem. If combined with, for example, a file upload API this would allow for arbitrary code execution.\n\nTo address these issues the following changes were made in v4.0.0:\n- Documentation was updated with more explicit guidelines on building secure applications.\n- `Reference` instances will no longer follow prototype chains by default, nor will they invoke accessors or proxies.\n- All `isolated-vm` API prototypes are now immutable.\n- `NativeModule` constructor may only be invoked from a nodejs isolate.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "isolated-vm"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.0.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/laverdet/isolated-vm/security/advisories/GHSA-mmhj-4w6j-76h7"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21413"
}, {
"type" : "WEB",
"url" : "https://github.com/laverdet/isolated-vm/commit/2646e6c1558bac66285daeab54c7d490ed332b15"
}, {
"type" : "WEB",
"url" : "https://github.com/laverdet/isolated-vm/commit/27151bfecc260e96714443613880e3b2e6596704"
}, {
"type" : "WEB",
"url" : "https://github.com/laverdet/isolated-vm/blob/main/CHANGELOG.md#v400"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-913" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-03-30T22:27:45Z",
"nvd_published_at" : "2021-03-30T23:15:00Z"
}
}