The vulnerability is a sandbox escape caused by prototype pollution in @nyariv/sandboxjs. The root cause is the improper handling of protected global objects when they are processed within an array.
The exploitation chain begins when sandboxed code accesses a global object's prototype, like Map.prototype. The addOps<LispType.Prop> handler, prior to the patch, did not sufficiently restrict this access.
Next, the code places this prototype reference into an array (e.g., [Map.prototype]). This triggers the addOps<LispType.CreateArray> handler. This handler uses the valueOrProp function to process each item in the array. The valueOrProp function unwraps the protected Prop object to its raw value, discarding the isGlobal flag that prevents modification.
Once the sandboxed code retrieves the prototype from the array, it has a direct, unprotected reference to the host's object prototype. Any modifications to this object, such as adding new properties, will pollute the prototype for the entire host process. This bypasses the Prop.set security check, which relies on the now-absent isGlobal flag.
Additionally, the patch addresses a related prototype pollution vector in the Scope.getWhereValScope and Scope.getWhereVarScope functions. These functions used the in operator for scope resolution, which allowed an attacker to pollute Object.prototype to inject variables into the sandbox's scope.
The identified functions are central to this exploit path, either by allowing the initial access, stripping the protection, or being independently vulnerable to prototype pollution.