VYPR
Critical severityNVD Advisory· Published Jan 26, 2026· Updated Jan 27, 2026

vm2 has a Sandbox Escape

CVE-2026-22709

Description

vm2 is an open source vm/sandbox for Node.js. In vm2 prior to version 3.10.2, Promise.prototype.then Promise.prototype.catch callback sanitization can be bypassed. This allows attackers to escape the sandbox and run arbitrary code. In lib/setup-sandbox.js, the callback function of localPromise.prototype.then is sanitized, but globalPromise.prototype.then is not sanitized. The return value of async functions is globalPromise object. Version 3.10.2 fixes the issue.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
vm2npm
< 3.10.23.10.2

Affected products

1

Patches

1
4b009c2d4b11

fix: use Reflect.apply instead of .call() in Promise handlers (#549)

https://github.com/patriksimek/vm2Patrik SimekJan 17, 2026via ghsa
4 files changed · +110 310
  • lib/setup-sandbox.js+2 2 modified
    @@ -57,7 +57,7 @@ globalPromise.prototype.then = function then(onFulfilled, onRejected) {
     			return apply(origOnRejected, this, [error]);
     		};
     	}
    -	return globalPromiseThen.call(this, onFulfilled, onRejected);
    +	return apply(globalPromiseThen, this, [onFulfilled, onRejected]);
     };
     
     globalPromise.prototype.catch = function _catch(onRejected) {
    @@ -69,7 +69,7 @@ globalPromise.prototype.catch = function _catch(onRejected) {
     			return apply(origOnRejected, this, [error]);
     		};
     	}
    -	return globalPromiseCatch.call(this, onRejected);
    +	return apply(globalPromiseCatch, this, [onRejected]);
     };
     
     const localReflectApply = (target, thisArg, args) => {
    
  • package.json+1 1 modified
    @@ -13,7 +13,7 @@
     		"alcatraz",
     		"contextify"
     	],
    -	"version": "3.10.1",
    +	"version": "3.10.2",
     	"main": "index.js",
     	"sideEffects": false,
     	"repository": "github:patriksimek/vm2",
    
  • package-lock.json+81 307 modified
    @@ -1,12 +1,12 @@
     {
     	"name": "vm2",
    -	"version": "3.10.1",
    +	"version": "3.10.2",
     	"lockfileVersion": 2,
     	"requires": true,
     	"packages": {
     		"": {
     			"name": "vm2",
    -			"version": "3.10.1",
    +			"version": "3.10.2",
     			"license": "MIT",
     			"dependencies": {
     				"acorn": "^8.14.1",
    @@ -412,16 +412,6 @@
     				"url": "https://github.com/sponsors/epoberezkin"
     			}
     		},
    -		"node_modules/ansi-colors": {
    -			"version": "4.1.3",
    -			"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz",
    -			"integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==",
    -			"dev": true,
    -			"license": "MIT",
    -			"engines": {
    -				"node": ">=6"
    -			}
    -		},
     		"node_modules/ansi-styles": {
     			"version": "4.3.0",
     			"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
    @@ -438,39 +428,12 @@
     				"url": "https://github.com/chalk/ansi-styles?sponsor=1"
     			}
     		},
    -		"node_modules/anymatch": {
    -			"version": "3.1.3",
    -			"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
    -			"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
    -			"dev": true,
    -			"license": "ISC",
    -			"dependencies": {
    -				"normalize-path": "^3.0.0",
    -				"picomatch": "^2.0.4"
    -			},
    -			"engines": {
    -				"node": ">= 8"
    -			}
    -		},
     		"node_modules/balanced-match": {
     			"version": "1.0.0",
     			"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
     			"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
     			"dev": true
     		},
    -		"node_modules/binary-extensions": {
    -			"version": "2.3.0",
    -			"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
    -			"integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
    -			"dev": true,
    -			"license": "MIT",
    -			"engines": {
    -				"node": ">=8"
    -			},
    -			"funding": {
    -				"url": "https://github.com/sponsors/sindresorhus"
    -			}
    -		},
     		"node_modules/brace-expansion": {
     			"version": "1.1.12",
     			"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
    @@ -482,19 +445,6 @@
     				"concat-map": "0.0.1"
     			}
     		},
    -		"node_modules/braces": {
    -			"version": "3.0.3",
    -			"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
    -			"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
    -			"dev": true,
    -			"license": "MIT",
    -			"dependencies": {
    -				"fill-range": "^7.1.1"
    -			},
    -			"engines": {
    -				"node": ">=8"
    -			}
    -		},
     		"node_modules/browser-stdout": {
     			"version": "1.3.1",
     			"resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
    @@ -555,28 +505,19 @@
     			}
     		},
     		"node_modules/chokidar": {
    -			"version": "3.6.0",
    -			"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
    -			"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
    +			"version": "4.0.3",
    +			"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
    +			"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
     			"dev": true,
     			"license": "MIT",
     			"dependencies": {
    -				"anymatch": "~3.1.2",
    -				"braces": "~3.0.2",
    -				"glob-parent": "~5.1.2",
    -				"is-binary-path": "~2.1.0",
    -				"is-glob": "~4.0.1",
    -				"normalize-path": "~3.0.0",
    -				"readdirp": "~3.6.0"
    +				"readdirp": "^4.0.1"
     			},
     			"engines": {
    -				"node": ">= 8.10.0"
    +				"node": ">= 14.16.0"
     			},
     			"funding": {
     				"url": "https://paulmillr.com/funding/"
    -			},
    -			"optionalDependencies": {
    -				"fsevents": "~2.3.2"
     			}
     		},
     		"node_modules/cliui": {
    @@ -730,9 +671,9 @@
     			"license": "MIT"
     		},
     		"node_modules/diff": {
    -			"version": "5.2.0",
    -			"resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz",
    -			"integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==",
    +			"version": "7.0.0",
    +			"resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz",
    +			"integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==",
     			"dev": true,
     			"license": "BSD-3-Clause",
     			"engines": {
    @@ -970,19 +911,6 @@
     				"node": ">=16.0.0"
     			}
     		},
    -		"node_modules/fill-range": {
    -			"version": "7.1.1",
    -			"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
    -			"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
    -			"dev": true,
    -			"license": "MIT",
    -			"dependencies": {
    -				"to-regex-range": "^5.0.1"
    -			},
    -			"engines": {
    -				"node": ">=8"
    -			}
    -		},
     		"node_modules/find-up": {
     			"version": "5.0.0",
     			"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
    @@ -1061,21 +989,6 @@
     				"url": "https://github.com/sponsors/isaacs"
     			}
     		},
    -		"node_modules/fsevents": {
    -			"version": "2.3.3",
    -			"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
    -			"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
    -			"dev": true,
    -			"hasInstallScript": true,
    -			"license": "MIT",
    -			"optional": true,
    -			"os": [
    -				"darwin"
    -			],
    -			"engines": {
    -				"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
    -			}
    -		},
     		"node_modules/get-caller-file": {
     			"version": "2.0.5",
     			"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
    @@ -1107,19 +1020,6 @@
     				"url": "https://github.com/sponsors/isaacs"
     			}
     		},
    -		"node_modules/glob-parent": {
    -			"version": "5.1.2",
    -			"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
    -			"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
    -			"dev": true,
    -			"license": "ISC",
    -			"dependencies": {
    -				"is-glob": "^4.0.1"
    -			},
    -			"engines": {
    -				"node": ">= 6"
    -			}
    -		},
     		"node_modules/glob/node_modules/brace-expansion": {
     			"version": "2.0.2",
     			"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
    @@ -1214,19 +1114,6 @@
     				"node": ">=0.8.19"
     			}
     		},
    -		"node_modules/is-binary-path": {
    -			"version": "2.1.0",
    -			"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
    -			"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
    -			"dev": true,
    -			"license": "MIT",
    -			"dependencies": {
    -				"binary-extensions": "^2.0.0"
    -			},
    -			"engines": {
    -				"node": ">=8"
    -			}
    -		},
     		"node_modules/is-extglob": {
     			"version": "2.1.1",
     			"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
    @@ -1250,14 +1137,14 @@
     				"node": ">=0.10.0"
     			}
     		},
    -		"node_modules/is-number": {
    -			"version": "7.0.0",
    -			"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
    -			"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
    +		"node_modules/is-path-inside": {
    +			"version": "3.0.3",
    +			"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
    +			"integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
     			"dev": true,
     			"license": "MIT",
     			"engines": {
    -				"node": ">=0.12.0"
    +				"node": ">=8"
     			}
     		},
     		"node_modules/is-plain-obj": {
    @@ -1441,29 +1328,30 @@
     			}
     		},
     		"node_modules/mocha": {
    -			"version": "11.1.0",
    -			"resolved": "https://registry.npmjs.org/mocha/-/mocha-11.1.0.tgz",
    -			"integrity": "sha512-8uJR5RTC2NgpY3GrYcgpZrsEd9zKbPDpob1RezyR2upGHRQtHWofmzTMzTMSV6dru3tj5Ukt0+Vnq1qhFEEwAg==",
    +			"version": "11.7.5",
    +			"resolved": "https://registry.npmjs.org/mocha/-/mocha-11.7.5.tgz",
    +			"integrity": "sha512-mTT6RgopEYABzXWFx+GcJ+ZQ32kp4fMf0xvpZIIfSq9Z8lC/++MtcCnQ9t5FP2veYEP95FIYSvW+U9fV4xrlig==",
     			"dev": true,
     			"license": "MIT",
     			"dependencies": {
    -				"ansi-colors": "^4.1.3",
     				"browser-stdout": "^1.3.1",
    -				"chokidar": "^3.5.3",
    +				"chokidar": "^4.0.1",
     				"debug": "^4.3.5",
    -				"diff": "^5.2.0",
    +				"diff": "^7.0.0",
     				"escape-string-regexp": "^4.0.0",
     				"find-up": "^5.0.0",
     				"glob": "^10.4.5",
     				"he": "^1.2.0",
    +				"is-path-inside": "^3.0.3",
     				"js-yaml": "^4.1.0",
     				"log-symbols": "^4.1.0",
    -				"minimatch": "^5.1.6",
    +				"minimatch": "^9.0.5",
     				"ms": "^2.1.3",
    +				"picocolors": "^1.1.1",
     				"serialize-javascript": "^6.0.2",
     				"strip-json-comments": "^3.1.1",
     				"supports-color": "^8.1.1",
    -				"workerpool": "^6.5.1",
    +				"workerpool": "^9.2.0",
     				"yargs": "^17.7.2",
     				"yargs-parser": "^21.1.1",
     				"yargs-unparser": "^2.0.0"
    @@ -1487,16 +1375,19 @@
     			}
     		},
     		"node_modules/mocha/node_modules/minimatch": {
    -			"version": "5.1.6",
    -			"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
    -			"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
    +			"version": "9.0.5",
    +			"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
    +			"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
     			"dev": true,
     			"license": "ISC",
     			"dependencies": {
     				"brace-expansion": "^2.0.1"
     			},
     			"engines": {
    -				"node": ">=10"
    +				"node": ">=16 || 14 >=14.17"
    +			},
    +			"funding": {
    +				"url": "https://github.com/sponsors/isaacs"
     			}
     		},
     		"node_modules/ms": {
    @@ -1512,16 +1403,6 @@
     			"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
     			"dev": true
     		},
    -		"node_modules/normalize-path": {
    -			"version": "3.0.0",
    -			"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
    -			"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
    -			"dev": true,
    -			"license": "MIT",
    -			"engines": {
    -				"node": ">=0.10.0"
    -			}
    -		},
     		"node_modules/optionator": {
     			"version": "0.9.4",
     			"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
    @@ -1629,18 +1510,12 @@
     				"url": "https://github.com/sponsors/isaacs"
     			}
     		},
    -		"node_modules/picomatch": {
    -			"version": "2.3.1",
    -			"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
    -			"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
    +		"node_modules/picocolors": {
    +			"version": "1.1.1",
    +			"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
    +			"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
     			"dev": true,
    -			"license": "MIT",
    -			"engines": {
    -				"node": ">=8.6"
    -			},
    -			"funding": {
    -				"url": "https://github.com/sponsors/jonschlinkert"
    -			}
    +			"license": "ISC"
     		},
     		"node_modules/prelude-ls": {
     			"version": "1.2.1",
    @@ -1673,16 +1548,17 @@
     			}
     		},
     		"node_modules/readdirp": {
    -			"version": "3.6.0",
    -			"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
    -			"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
    +			"version": "4.1.2",
    +			"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
    +			"integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
     			"dev": true,
     			"license": "MIT",
    -			"dependencies": {
    -				"picomatch": "^2.2.1"
    -			},
     			"engines": {
    -				"node": ">=8.10.0"
    +				"node": ">= 14.18.0"
    +			},
    +			"funding": {
    +				"type": "individual",
    +				"url": "https://paulmillr.com/funding/"
     			}
     		},
     		"node_modules/require-directory": {
    @@ -1868,19 +1744,6 @@
     				"url": "https://github.com/chalk/supports-color?sponsor=1"
     			}
     		},
    -		"node_modules/to-regex-range": {
    -			"version": "5.0.1",
    -			"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
    -			"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
    -			"dev": true,
    -			"license": "MIT",
    -			"dependencies": {
    -				"is-number": "^7.0.0"
    -			},
    -			"engines": {
    -				"node": ">=8.0"
    -			}
    -		},
     		"node_modules/type-check": {
     			"version": "0.4.0",
     			"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
    @@ -1931,9 +1794,9 @@
     			}
     		},
     		"node_modules/workerpool": {
    -			"version": "6.5.1",
    -			"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz",
    -			"integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==",
    +			"version": "9.3.4",
    +			"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.4.tgz",
    +			"integrity": "sha512-TmPRQYYSAnnDiEB0P/Ytip7bFGvqnSU6I2BcuSw7Hx+JSg/DsUi5ebYfc8GYaSdpuvOcEs6dXxPurOYpe9QFwg==",
     			"dev": true,
     			"license": "Apache-2.0"
     		},
    @@ -2452,12 +2315,6 @@
     				"uri-js": "^4.2.2"
     			}
     		},
    -		"ansi-colors": {
    -			"version": "4.1.3",
    -			"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz",
    -			"integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==",
    -			"dev": true
    -		},
     		"ansi-styles": {
     			"version": "4.3.0",
     			"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
    @@ -2467,28 +2324,12 @@
     				"color-convert": "^2.0.1"
     			}
     		},
    -		"anymatch": {
    -			"version": "3.1.3",
    -			"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
    -			"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
    -			"dev": true,
    -			"requires": {
    -				"normalize-path": "^3.0.0",
    -				"picomatch": "^2.0.4"
    -			}
    -		},
     		"balanced-match": {
     			"version": "1.0.0",
     			"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
     			"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
     			"dev": true
     		},
    -		"binary-extensions": {
    -			"version": "2.3.0",
    -			"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
    -			"integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
    -			"dev": true
    -		},
     		"brace-expansion": {
     			"version": "1.1.12",
     			"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
    @@ -2499,15 +2340,6 @@
     				"concat-map": "0.0.1"
     			}
     		},
    -		"braces": {
    -			"version": "3.0.3",
    -			"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
    -			"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
    -			"dev": true,
    -			"requires": {
    -				"fill-range": "^7.1.1"
    -			}
    -		},
     		"browser-stdout": {
     			"version": "1.3.1",
     			"resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
    @@ -2548,19 +2380,12 @@
     			}
     		},
     		"chokidar": {
    -			"version": "3.6.0",
    -			"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
    -			"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
    +			"version": "4.0.3",
    +			"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
    +			"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
     			"dev": true,
     			"requires": {
    -				"anymatch": "~3.1.2",
    -				"braces": "~3.0.2",
    -				"fsevents": "~2.3.2",
    -				"glob-parent": "~5.1.2",
    -				"is-binary-path": "~2.1.0",
    -				"is-glob": "~4.0.1",
    -				"normalize-path": "~3.0.0",
    -				"readdirp": "~3.6.0"
    +				"readdirp": "^4.0.1"
     			}
     		},
     		"cliui": {
    @@ -2668,9 +2493,9 @@
     			"dev": true
     		},
     		"diff": {
    -			"version": "5.2.0",
    -			"resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz",
    -			"integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==",
    +			"version": "7.0.0",
    +			"resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz",
    +			"integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==",
     			"dev": true
     		},
     		"eastasianwidth": {
    @@ -2828,15 +2653,6 @@
     				"flat-cache": "^4.0.0"
     			}
     		},
    -		"fill-range": {
    -			"version": "7.1.1",
    -			"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
    -			"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
    -			"dev": true,
    -			"requires": {
    -				"to-regex-range": "^5.0.1"
    -			}
    -		},
     		"find-up": {
     			"version": "5.0.0",
     			"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
    @@ -2887,13 +2703,6 @@
     				}
     			}
     		},
    -		"fsevents": {
    -			"version": "2.3.3",
    -			"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
    -			"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
    -			"dev": true,
    -			"optional": true
    -		},
     		"get-caller-file": {
     			"version": "2.0.5",
     			"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
    @@ -2934,15 +2743,6 @@
     				}
     			}
     		},
    -		"glob-parent": {
    -			"version": "5.1.2",
    -			"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
    -			"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
    -			"dev": true,
    -			"requires": {
    -				"is-glob": "^4.0.1"
    -			}
    -		},
     		"globals": {
     			"version": "14.0.0",
     			"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
    @@ -2983,15 +2783,6 @@
     			"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
     			"dev": true
     		},
    -		"is-binary-path": {
    -			"version": "2.1.0",
    -			"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
    -			"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
    -			"dev": true,
    -			"requires": {
    -				"binary-extensions": "^2.0.0"
    -			}
    -		},
     		"is-extglob": {
     			"version": "2.1.1",
     			"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
    @@ -3007,10 +2798,10 @@
     				"is-extglob": "^2.1.1"
     			}
     		},
    -		"is-number": {
    -			"version": "7.0.0",
    -			"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
    -			"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
    +		"is-path-inside": {
    +			"version": "3.0.3",
    +			"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
    +			"integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
     			"dev": true
     		},
     		"is-plain-obj": {
    @@ -3142,28 +2933,29 @@
     			"dev": true
     		},
     		"mocha": {
    -			"version": "11.1.0",
    -			"resolved": "https://registry.npmjs.org/mocha/-/mocha-11.1.0.tgz",
    -			"integrity": "sha512-8uJR5RTC2NgpY3GrYcgpZrsEd9zKbPDpob1RezyR2upGHRQtHWofmzTMzTMSV6dru3tj5Ukt0+Vnq1qhFEEwAg==",
    +			"version": "11.7.5",
    +			"resolved": "https://registry.npmjs.org/mocha/-/mocha-11.7.5.tgz",
    +			"integrity": "sha512-mTT6RgopEYABzXWFx+GcJ+ZQ32kp4fMf0xvpZIIfSq9Z8lC/++MtcCnQ9t5FP2veYEP95FIYSvW+U9fV4xrlig==",
     			"dev": true,
     			"requires": {
    -				"ansi-colors": "^4.1.3",
     				"browser-stdout": "^1.3.1",
    -				"chokidar": "^3.5.3",
    +				"chokidar": "^4.0.1",
     				"debug": "^4.3.5",
    -				"diff": "^5.2.0",
    +				"diff": "^7.0.0",
     				"escape-string-regexp": "^4.0.0",
     				"find-up": "^5.0.0",
     				"glob": "^10.4.5",
     				"he": "^1.2.0",
    +				"is-path-inside": "^3.0.3",
     				"js-yaml": "^4.1.0",
     				"log-symbols": "^4.1.0",
    -				"minimatch": "^5.1.6",
    +				"minimatch": "^9.0.5",
     				"ms": "^2.1.3",
    +				"picocolors": "^1.1.1",
     				"serialize-javascript": "^6.0.2",
     				"strip-json-comments": "^3.1.1",
     				"supports-color": "^8.1.1",
    -				"workerpool": "^6.5.1",
    +				"workerpool": "^9.2.0",
     				"yargs": "^17.7.2",
     				"yargs-parser": "^21.1.1",
     				"yargs-unparser": "^2.0.0"
    @@ -3179,9 +2971,9 @@
     					}
     				},
     				"minimatch": {
    -					"version": "5.1.6",
    -					"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
    -					"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
    +					"version": "9.0.5",
    +					"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
    +					"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
     					"dev": true,
     					"requires": {
     						"brace-expansion": "^2.0.1"
    @@ -3201,12 +2993,6 @@
     			"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
     			"dev": true
     		},
    -		"normalize-path": {
    -			"version": "3.0.0",
    -			"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
    -			"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
    -			"dev": true
    -		},
     		"optionator": {
     			"version": "0.9.4",
     			"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
    @@ -3276,10 +3062,10 @@
     				"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
     			}
     		},
    -		"picomatch": {
    -			"version": "2.3.1",
    -			"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
    -			"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
    +		"picocolors": {
    +			"version": "1.1.1",
    +			"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
    +			"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
     			"dev": true
     		},
     		"prelude-ls": {
    @@ -3304,13 +3090,10 @@
     			}
     		},
     		"readdirp": {
    -			"version": "3.6.0",
    -			"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
    -			"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
    -			"dev": true,
    -			"requires": {
    -				"picomatch": "^2.2.1"
    -			}
    +			"version": "4.1.2",
    +			"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
    +			"integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
    +			"dev": true
     		},
     		"require-directory": {
     			"version": "2.1.1",
    @@ -3426,15 +3209,6 @@
     				"has-flag": "^4.0.0"
     			}
     		},
    -		"to-regex-range": {
    -			"version": "5.0.1",
    -			"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
    -			"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
    -			"dev": true,
    -			"requires": {
    -				"is-number": "^7.0.0"
    -			}
    -		},
     		"type-check": {
     			"version": "0.4.0",
     			"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
    @@ -3469,9 +3243,9 @@
     			"dev": true
     		},
     		"workerpool": {
    -			"version": "6.5.1",
    -			"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz",
    -			"integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==",
    +			"version": "9.3.4",
    +			"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.4.tgz",
    +			"integrity": "sha512-TmPRQYYSAnnDiEB0P/Ytip7bFGvqnSU6I2BcuSw7Hx+JSg/DsUi5ebYfc8GYaSdpuvOcEs6dXxPurOYpe9QFwg==",
     			"dev": true
     		},
     		"wrap-ansi": {
    
  • test/vm.js+26 0 modified
    @@ -1294,6 +1294,32 @@ describe('VM', () => {
     		`), /process is not defined/);
     	});
     
    +	it('Function.prototype.call attack via Promise', async () => {
    +		const vm2 = new VM();
    +		// This attack attempts to override Function.prototype.call to capture
    +		// references to functions being called. If globalPromise.prototype.then
    +		// or .catch used .call() directly, an attacker could intercept and
    +		// access host objects through the captured function reference.
    +		// With the fix, Reflect.apply is used instead of .call(), so the
    +		// attacker's override is never triggered and nothing is captured.
    +		const result = await vm2.run(`
    +			new Promise((resolve) => {
    +				let captured = [];
    +				const origCall = Function.prototype.call;
    +				Function.prototype.call = function(...args) {
    +					captured.push(this.name || 'anonymous');
    +					return origCall.apply(this, args);
    +				};
    +				Promise.resolve().then(() => {
    +					resolve(captured);
    +				});
    +			});
    +		`);
    +		// With the fix, Promise.prototype.then should use Reflect.apply,
    +		// so Function.prototype.call should not be intercepted
    +		assert.strictEqual(result.length, 0, 'Function.prototype.call should not be intercepted by Promise.then');
    +	});
    +
     	after(() => {
     		vm = null;
     	});
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

5

News mentions

2