Incorrect Authorization Affecting vm2 package, versions <3.12.2


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.4% (32nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Incorrect Authorization vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-VM2-20158386
  • published27 Sept 2026
  • disclosed27 Sept 2026
  • creditUnknown

Introduced: 27 Sep 2026

NewCVE-2026-100721  (opens in a new tab)
CWE-863  (opens in a new tab)

How to fix?

Upgrade vm2 to version 3.12.2 or higher.

Overview

vm2 is a sandbox that can run untrusted code with whitelisted Node's built-in modules.

Affected versions of this package are vulnerable to Incorrect Authorization via LegacyResolver.isPathAllowed in lib/resolver-compat.js, which uses a raw path.startsWith(mod.path) check to authorize module loads against an allowlisted external module path. Because startsWith performs string prefix matching without enforcing a path boundary, a sibling package whose name shares a prefix with an allowlisted package (e.g., foo2 when foo is allowlisted) passes the check: the stripped remainder (2/index.js) contains no node_modules segment, so the subsequent guard does not catch it. An attacker who controls code running inside the sandbox under an external: {modules: ['foo'], transitive: false} configuration can therefore require an un-allowlisted sibling package, escaping the intended module boundary and gaining access to arbitrary modules the embedder never authorized.

CVSS Base Scores

version 4.0
version 3.1