endo icon indicating copy to clipboard operation
endo copied to clipboard

Scope proxy leak allow constructive access to global lexicals

Open mhofman opened this issue 3 years ago • 0 comments

A property of the globalLexicals option of the Compartment constructor is that they can only be accessed lexically, which can be denied to evaluated code by simple code transforms. However combined with the leak of scope proxy objects (#31), evaluate code can constructively reach the global lexicals.

const c = new Compartment({}, { globalLexicals: { foo() { return 'secret'; } });
c.evaluate(`
  globalThis.getThis = function() { return this; };
  const hiddenFoo = getThis()[['f', 'o', 'o'].join('')];
  hiddenFoo()
`);

Unlike #876 this affects all evaluators.

mhofman avatar Sep 22 '21 23:09 mhofman