Skip to content

realms-shim / SES sandbox escapes

Critical
warner published GHSA-6jg8-7333-554w Oct 2, 2019 · 1 comment

Package

npm realms-shim, ses (NPM)

Affected versions

realms-shim <= 1.1.2, SES <= 0.6.2

Patched versions

realms-shim 1.2.0, SES 0.6.3

Description

Impact

The realms-shim package implements the Realms proposal. The SES package builds upon Realms to build secure sandboxes for executing untrusted Javascript code. Sandboxed code cannot modify the primordial objects (aka "prototype poisoning") within the sandbox, nor can it interact with other objects unless it is first given a reference to those objects. This provides an "object-capability safe" execution environment.

Several bugs were found in realms-shim, which allow the confined code to escape the sandbox and compromise the "primal realm" (the one which created the sandbox). This generally leads to a full compromise of the application, since the primal realm includes access to e.g. require('fs'), from which the attacker can rewrite the application's source code.

Until very recently, the only convenient way to use the realms-shim package was to include it as a git submodule (the first tagged release was made on 18-Sep-2019), or to use SES. Consequently the vulnerable population includes users of SES-0.6.2 or older, users of realms-shim-1.1.2 or older, and users of any package that use a git-submodule to include the realms-shim.

Patches

The bugs have been fixed in realms-shim-1.2.0, which has been incorporated into SES-0.6.3 . All users should upgrade to one of these releases.

Workarounds

SES and the Realms feature are designed to protect against arbitrary and unreviewed attacker-supplied code. Applications which rely upon this property must upgrade to the newer versions of the libraries to fix the problem.

Other applications might be in a position to have humans review the code before executing it under a Realm, or accept very limited subsets of Javascript. In these cases, the review process might be changed to exclude these attacks.

However, given how flexible Javascript is, this should not be considered a reliable workaround. Upgrading to the newer realms-shim and SES is the recommended mitigation.

References

For more information

If you have any questions or comments about this advisory:

  • Open an issue in the realms-shim or SES repositories
  • Submit security bugs via email at security (at agoric.com)
  • Contact us on twitter: @agoric

Severity

Critical

CVE ID

No known CVE

Weaknesses

No CWEs