realms-shim sandbox breakout via transform function

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

realms-shim is a JavaScript library that provides sandboxed code execution, restricting untrusted code to a limited set of exposed objects and functions. A flaw in the code transformation pipeline exposed internal Realm objects to transformer functions, allowing confined code to escape the sandbox and gain full control of the parent application.

Technologies: realms-shim (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 21 October 2019.
Which products and versions are affected?
realms-shim (npm) SEMVER:introduced=0,fixed=1.2.1.
Is there a fix for This vulnerability?
Yes. realms-shim (npm): upgrade to 1.2.1 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) 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.1 or later
    npm install realms-shim@1.2.1

Technical details

The vulnerability is a sandbox escape caused by improper isolation of internal Realm objects during the transformation pipeline. The evaluate() function accepts a transforms option containing code rewriting functions (intended for Babel-like syntax extensions). A primal-Realm object was inadvertently exposed to these transform functions; malicious confined code could provide a crafted rewriter that captured this object and used it to break out of the sandbox. The attack requires the confined code to have access to the evaluate() function with transforms enabled. The vulnerability is fixed in version 1.2.1.

Affected products

  • Agoric realms-shim <1.2.1

Timeline

  • 2019-10-16: disclosed
  • 2019-10-16: patched: Fix released in version 1.2.1

References

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