realms-shim sandbox breakout via Reflect.construct

Severity: low · CVSS 3.1 · Published 2019-10-04

realms-shim and SES are JavaScript libraries that create sandboxed environments for safely running untrusted code. A critical flaw allows attackers to escape the sandbox by using Reflect.construct on the Function constructor to access objects in the parent realm, enabling arbitrary code execution with full access to the host application (including file system operations).

Technologies: realms-shim (npm), ses (npm). Vendors: npm.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Low severity, with a CVSS score of 3.1, published 4 October 2019.
Which products and versions are affected?
realms-shim (npm) SEMVER:introduced=0,fixed=1.2.0; ses (npm) SEMVER:introduced=0,fixed=0.6.3.
Is there a fix for This vulnerability?
Yes. realms-shim (npm): upgrade to 1.2.0 or later; ses (npm): upgrade to 0.6.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked over the network, in a software library.
Am I affected?
Check whether you run realms-shim (npm) or ses (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • realms-shim (npm): upgrade to 1.2.0 or later
    npm install realms-shim@1.2.0
  • ses (npm): upgrade to 0.6.3 or later
    npm install ses@0.6.3

Technical details

The vulnerability is a sandbox escape in realms-shim versions prior to 1.2.0 and SES versions prior to 0.6.3. Attackers can exploit Reflect.construct on the sandboxed Function constructor to reach the prototypes of the primal (parent) Realm, bypassing the sandbox boundary. The attack requires no authentication or user interaction and is network-accessible if the sandboxed code is reachable via an application interface. A successful exploit grants the attacker full code execution in the primal realm context, including access to require('fs') and ability to modify application source code. The fix is available in realms-shim 1.2.0 and SES 0.6.3.

Affected products

  • Agoric realms-shim < 1.2.0
  • Agoric SES < 0.6.3

Timeline

  • 2019-10-04: disclosed
  • 2019-10-02: patched: realms-shim 1.2.0 and SES 0.6.3 released

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.