Skip to content

vm.runInContext is memory unsafe and can be used to dump core #8537

Closed
@deian

Description

@deian
  • Version: 6.5.0
  • Platform:
  • Subsystem: vm

vm.runInContext is memory unsafe and can be used to dump core.

This doesn't seem like a serious security vulnerability (hence my reporting here), but can certainly be used to cause DOS and it might be nice to have a stdlib that is memory safe.

const vm = require('vm');

const target = {a : 1337};

const handler = {
  getOwnPropertyDescriptor: (target, prop) => {
    throw 'w00t';
    // causes FromJust on line 128 of src/node_contextify.cc to dump core
  },
};

const sandbox = new Proxy(target, handler);


const context = new vm.createContext(sandbox);
const script = new vm.Script('');
script.runInContext(context);

Related to: #8539, #8538, #7902

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Issues and PRs that require attention from people who are familiar with C++.vmIssues and PRs related to the vm subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions