Executive brief
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).
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