CVE-2026-92940: vm2 3.11.3 through 3.11.6 HTTPS Credential Exposure via globalAgent

Published Sep 17, 2026
·
Updated

Summary

vm2 3.11.6 exposes the host process's real https.globalAgent when a NodeVM is explicitly allowed to require https. The module is wrapped as read-only, but calls to methods on the shared agent still mutate the host object. Sandbox code can register a free listener and receive host request options and the host TLS socket whenever an unrelated host HTTPS request releases a pooled connection.

In a contained test, sandbox code allowed only the https builtin:

- read the host request's bearer token from the agent event; - attached a data listener to the released host TLS socket and read the next host response body in plaintext; - learned the private service host and port; - sent an attacker-chosen authenticated POST using the stolen host token; and - received confirmation that the service accepted the action.

The host application never passed its credentials, request, response, socket, or destination into the sandbox. They crossed the boundary solely because vm2 exposes the process-global HTTPS agent instead of a sandbox-local network module instance.

Details

The vulnerable boundary is the default builtin loader in lib/builtin.js:

js builtins.set(key, special ? special : vm => vm.readonly(hostRequire(key)));

The wrapper recursively exposes properties of the actual host module. For ordinary constants, a read-only proxy can be sufficient. It is not sufficient for process-global EventEmitter objects whose methods mutate internal state.

https.globalAgent is the default agent used by host HTTPS requests when the host does not supply a separate agent. The agent is shared by the entire Node.js thread. Its free event supplies both:

- the TLSSocket that has just completed a request and is available for reuse; and - the connection/request options used to place that socket in the pool.

The following sandbox code registers directly on that host singleton:

js const https = require('https');

https.globalAgent.on('free', (socket, options) => { const token = options.headers.Authorization; const destination = {host: options.host, port: options.port};

socket.on('data', chunk => { capturedHostTraffic += chunk.toString('utf8'); });

const req = https.request({ hostname: destination.host, port: destination.port, path: '/sandbox-action', method: 'POST', headers: {Authorization: token}, agent: false, }); req.end(attackerChosenBody); });

Calling .on() is not a property assignment, so the read-only handler forwards it to the real host Agent. When the host later emits free, vm2 invokes the sandbox callback with bridged views of the live options and socket. Reading nested header values succeeds. Calling socket.on() also forwards to the real socket, letting the sandbox observe the decrypted bytes emitted during a later request on that connection.

The complete exploit flow is:

text attacker-controlled NodeVM program with https allowed -> subscribe to the real host https.globalAgent -> unrelated host HTTPS request completes -> shared Agent emits live socket and request options into sandbox callback -> sandbox reads host Authorization token and private destination -> sandbox attaches to the released TLSSocket -> next host response is exposed in plaintext -> sandbox reuses stolen token for attacker-chosen authenticated request

This is a distinct residual of the same process-wide observability class for which other host builtins are rejected. The current dangerous-builtin filter does not classify https as process-global because the module also has legitimate sandbox network APIs. A safe implementation must avoid exposing the host singleton, such as by providing a sandbox-local module facade and sandbox-local Agent.

PoC

The attached PoC uses only a temporary certificate and a loopback HTTPS server.

1. Install Node.js and OpenSSL. 2. In the attached poc directory, run:

bash npm install --ignore-scripts node poc.js

3. A vulnerable result includes all of the following markers:

- leaked host token: Bearer VM2HOSTAUTHORIZATIONf7952a; - captured host response: VM2PRIVATEHOSTRESPONSE47b2d6; - attacker-chosen authenticated action: VM2SANDBOXACTION8d14c3; - server decision: ACTIONACCEPTED.

The first host request carries the token. After it completes, the sandbox callback receives the token and independently sends the action request. The second host request reuses the pooled TLS connection; the sandbox's listener reads that response from the live socket. The PoC fails unless both confidentiality and integrity effects occur.

Impact

This is cross-boundary exposure and misuse of a process-global authenticated network resource.

An attacker who can submit code to a NodeVM with https allowed can, when the host uses the default HTTPS agent:

- steal Authorization, Cookie, API-key, proxy-authorization, and other sensitive request options; - discover private service hostnames and ports used only by host code; - read plaintext response headers and bodies on reused TLS connections; - steal client-certificate, private-key, passphrase, CA, or session-related options when the host supplies them through request options; - perform authenticated actions using stolen bearer credentials; - write to or destroy live host sockets, disrupting or corrupting unrelated traffic; - cross tenant boundaries when multiple sandboxes and host workloads share one process.

The sandbox already has the intentional ability to make its own HTTPS requests. It does not intentionally have authority to observe or reuse the host application's credentials and connections. A host that always supplies a separate private Agent for every sensitive request avoids this specific singleton, but that is not the default behavior.

Other sources

vm2 versions 3.11.3 through 3.11.6 expose the host process's real https.globalAgent to sandboxed code when a NodeVM is explicitly configured to allow require('https'). The builtin loader wraps host modules in a read-only proxy, but method calls such as Agent.prototype.on() are forwarded to the underlying host object, so sandbox code can register a listener for the agent's 'free' event. When an unrelated host HTTPS request releases a pooled connection, the listener receives the live host request options and the host TLSSocket, allowing sandboxed code to read the host's Authorization header and private destination host/port, attach a data listener to the released socket and read subsequent host response bodies in plaintext, and issue attacker-chosen authenticated requests using the stolen credentials. The issue is fixed in 3.11.7.

— MITRE

Affected Software

2 affected componentsFixes available
npm/vm2>=3.11.3<=3.11.6
npm/vm2>=3.11.3<=3.11.6
3.11.7

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/vm2 to a version that resolves this vulnerability.

    Fixed in 3.11.7
  2. Upgrade

    Upgrade vm2 to a version that resolves this vulnerability.

    Fixed in 3.11.7
  3. Compensating control

    Avoid exposing the host process-global https.globalAgent to sandboxed code; use a sandbox-local module facade and sandbox-local Agent, or supply a separate private Agent for every sensitive host request.

Event History

Sep 17, 2026
CVE Published
via MITRE·01:46 PM
Data Sourced
via MITRE·01:46 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·02:17 PM
DescriptionSeverityWeakness
Oct 1, 2026
Advisory Published
via GitHub·03:38 PM
Data Sourced
via GitHub·03:38 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are exposed to this issue?

Deployments using vm2 versions 3.11.3 through 3.11.6 are exposed only when a NodeVM is explicitly configured to permit require('https'). The affected sandbox can then access behavior of the host process's shared https.globalAgent.

2

What must an attacker be able to do to exploit it?

An attacker needs to execute code inside an affected NodeVM where the https builtin has been allowed. Exploitation also depends on the host process making HTTPS requests that use the pooled global agent, so a released connection can trigger the sandbox-registered listener.

3

What could an attacker obtain or do after exploitation?

Sandboxed code can obtain live host request options and a host TLS socket, including Authorization headers and private destination host and port information. It can read subsequent HTTPS response bodies in plaintext and send attacker-chosen authenticated requests with stolen credentials.

4

What should be done if upgrading cannot happen immediately?

Do not allow require('https') in NodeVM configurations until the affected vm2 version can be replaced. This removes the explicitly required condition that exposes the host HTTPS global agent.

5

How can I determine whether I am affected?

Check whether vm2 is at version 3.11.3 through 3.11.6 and inspect NodeVM configuration for explicit permission to require the https builtin. Also identify whether the host process makes HTTPS requests using the shared global agent, particularly requests carrying Authorization credentials.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203