GHSA-H85J-HV3C-QFGQ

Vulnerability from github – Published: 2026-10-01 15:38 – Updated: 2026-10-01 15:38
VLAI
Summary
vm2 exposes host HTTPS credentials and TLS traffic through globalAgent
Details

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:

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:

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:

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

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

  2. leaked host token: Bearer VM2_HOST_AUTHORIZATION_f7952a;

  3. captured host response: VM2_PRIVATE_HOST_RESPONSE_47b2d6;
  4. attacker-chosen authenticated action: VM2_SANDBOX_ACTION_8d14c3;
  5. server decision: ACTION_ACCEPTED.

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.

Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 3.11.6"
      },
      "package": {
        "ecosystem": "npm",
        "name": "vm2"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "3.11.3"
            },
            {
              "fixed": "3.11.7"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-92940"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-668"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-10-01T15:38:26Z",
    "nvd_published_at": null,
    "severity": "CRITICAL"
  },
  "details": "Summary\n\nvm2 3.11.6 exposes the host process\u0027s 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.\n\nIn a contained test, sandbox code allowed only the `https` builtin:\n\n- read the host request\u0027s bearer token from the agent event;\n- attached a data listener to the released host TLS socket and read the next host response body in plaintext;\n- learned the private service host and port;\n- sent an attacker-chosen authenticated POST using the stolen host token; and\n- received confirmation that the service accepted the action.\n\nThe 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.\n\n### Details\n\nThe vulnerable boundary is the default builtin loader in `lib/builtin.js`:\n\n```js\nbuiltins.set(key, special ? special : vm =\u003e vm.readonly(hostRequire(key)));\n```\n\nThe 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.\n\n`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:\n\n- the `TLSSocket` that has just completed a request and is available for reuse; and\n- the connection/request options used to place that socket in the pool.\n\nThe following sandbox code registers directly on that host singleton:\n\n```js\nconst https = require(\u0027https\u0027);\n\nhttps.globalAgent.on(\u0027free\u0027, (socket, options) =\u003e {\n  const token = options.headers.Authorization;\n  const destination = {host: options.host, port: options.port};\n\n  socket.on(\u0027data\u0027, chunk =\u003e {\n    capturedHostTraffic += chunk.toString(\u0027utf8\u0027);\n  });\n\n  const req = https.request({\n    hostname: destination.host,\n    port: destination.port,\n    path: \u0027/sandbox-action\u0027,\n    method: \u0027POST\u0027,\n    headers: {Authorization: token},\n    agent: false,\n  });\n  req.end(attackerChosenBody);\n});\n```\n\nCalling `.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.\n\nThe complete exploit flow is:\n\n```text\nattacker-controlled NodeVM program with https allowed\n  -\u003e subscribe to the real host https.globalAgent\n  -\u003e unrelated host HTTPS request completes\n  -\u003e shared Agent emits live socket and request options into sandbox callback\n  -\u003e sandbox reads host Authorization token and private destination\n  -\u003e sandbox attaches to the released TLSSocket\n  -\u003e next host response is exposed in plaintext\n  -\u003e sandbox reuses stolen token for attacker-chosen authenticated request\n```\n\nThis 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.\n\n### PoC\n\nThe attached PoC uses only a temporary certificate and a loopback HTTPS server.\n\n1. Install Node.js and OpenSSL.\n2. In the attached `poc` directory, run:\n\n   ```bash\n   npm install --ignore-scripts\n   node poc.js\n   ```\n\n3. A vulnerable result includes all of the following markers:\n\n   - leaked host token: `Bearer VM2_HOST_AUTHORIZATION_f7952a`;\n   - captured host response: `VM2_PRIVATE_HOST_RESPONSE_47b2d6`;\n   - attacker-chosen authenticated action: `VM2_SANDBOX_ACTION_8d14c3`;\n   - server decision: `ACTION_ACCEPTED`.\n\nThe 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\u0027s listener reads that response from the live socket. The PoC fails unless both confidentiality and integrity effects occur.\n\n### Impact\n\nThis is cross-boundary exposure and misuse of a process-global authenticated network resource.\n\nAn attacker who can submit code to a `NodeVM` with `https` allowed can, when the host uses the default HTTPS agent:\n\n- steal Authorization, Cookie, API-key, proxy-authorization, and other sensitive request options;\n- discover private service hostnames and ports used only by host code;\n- read plaintext response headers and bodies on reused TLS connections;\n- steal client-certificate, private-key, passphrase, CA, or session-related options when the host supplies them through request options;\n- perform authenticated actions using stolen bearer credentials;\n- write to or destroy live host sockets, disrupting or corrupting unrelated traffic;\n- cross tenant boundaries when multiple sandboxes and host workloads share one process.\n\nThe 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\u0027s 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.",
  "id": "GHSA-h85j-hv3c-qfgq",
  "modified": "2026-10-01T15:38:26Z",
  "published": "2026-10-01T15:38:26Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/patriksimek/vm2/security/advisories/GHSA-h85j-hv3c-qfgq"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-92940"
    },
    {
      "type": "WEB",
      "url": "https://github.com/patriksimek/vm2/commit/aa146a77f859325e079f3bfbfe6d8309af483daa"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/patriksimek/vm2"
    },
    {
      "type": "WEB",
      "url": "https://github.com/patriksimek/vm2/releases/tag/v3.11.7"
    },
    {
      "type": "WEB",
      "url": "https://www.vulncheck.com/advisories/vm2-3.11.3-through-3.11.6-https-credential-exposure-via-globalagent"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:L",
      "type": "CVSS_V3"
    }
  ],
  "summary": "vm2 exposes host HTTPS credentials and TLS traffic through globalAgent"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Loading…

Loading…

Related by attack behaviour

Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.


Loading…