---
id: "GHSA-2cm2-m3w5-gp2f"
page: "https://infrastack.ai/live/GHSA-2cm2-m3w5-gp2f"
kind: "vulnerability"
aliases: ["GHSA-2cm2-m3w5-gp2f"]
title: "vm2 has access to `VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL`"
severity: "medium"
cvss: 5.3
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "vm2", "fixed": ["3.11.2"], "affected": "< 3.11.2", "ecosystem": "npm"}]
ecosystems: ["npm"]
tags: ["cwe-693", "node.js", "npm", "package", "vm2"]
not_affected_if: ["trusted-code-only", "vm2-not-installed"]
published_at: "2026-05-08T16:22:52+00:00"
first_seen_at: "2026-11-05T21:44:25+00:00"
updated_at: "2026-11-05T21:45:25+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-2cm2-m3w5-gp2f", "first_seen_at": "2026-11-05T21:44:25+00:00"}]
exploit_sources: []
---

# vm2 has access to `VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL`

Link for people: https://infrastack.ai/live/GHSA-2cm2-m3w5-gp2f (this .md is for agents)

The vm2 npm package is a JavaScript sandbox, and an incomplete earlier fix still lets code inside the sandbox reach its internal state object by name. Code run through vm2 can read internal state that should stay hidden from it, which can lead to escaping the sandbox.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- npm:vm2 affected < 3.11.2 fixed 3.11.2

## How to check

- Run `npm ls vm2` in the project to find every installed copy of vm2 and its version.
- Check the lockfile (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`) for vm2 entries below `3.11.2`.

## Fix

- `vm2` `3.11.2` (fixed version per the advisory's product range).

## Timeline

- 2026-11-05T21:44:25+00:00 ghsa https://github.com/advisories/GHSA-2cm2-m3w5-gp2f

## Documents

- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/patriksimek/vm2/security-advisories/GHSA-2cm2-m3w5-gp2f
- [advisory] Maintainer's advisory: github.com https://github.com/patriksimek/vm2/security/advisories/GHSA-2cm2-m3w5-gp2f
- [fix] Release: github.com https://github.com/patriksimek/vm2/releases/tag/v3.11.2
- [fix] Patch: github.com https://github.com/patriksimek/vm2/commit/99d410bb7e0d607c56e68b420720a586dc0dd300

## From the sources

### Summary

https://github.com/patriksimek/vm2/security/advisories/GHSA-wp5r-2gw5-m7q7 is not fully patched.

### Details

It is still possible to get access to `VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL`.

### PoC

```js
const {VM} = require("vm2");
const vm = new VM();
console.log(vm.run(`
 globalThis['VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL']
`));
```

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
