The vulnerability is a sandbox escape in the vm2 library, caused by a flaw in how the bridge between the sandbox and the host environment handles property setting. Specifically, the BaseHandler.set method in lib/bridge.js did not adhere to the ECMAScript specification for Proxy traps. It failed to consider the receiver of a property assignment, which is crucial when dealing with prototype inheritance.
When code inside the sandbox created an object that inherited from a host object's proxy (e.g., using Object.create(hostProxy)), and then assigned a property to this new object, the set trap was triggered. The vulnerable implementation would incorrectly write this property directly onto the host object, instead of the new object within the sandbox. This provided a direct channel for a sandboxed attacker to modify host objects, leading to a complete sandbox escape and potential for remote code execution on the host machine.
The provided patch addresses this by introducing a check. It compares the receiver of the set operation with the canonical proxy for the host object. If they are not the same, it means the write is happening on an inheriting object, and the property is correctly defined on the receiver within the sandbox, preventing the write from leaking to the host. The analysis of the commit patch confirms that BaseHandler.set is the single vulnerable function modified to fix this issue.