The vulnerability exists in the piscina library due to a prototype pollution weakness. The Piscina class constructor and its run method directly access the filename property from a user-provided options object without verifying if it's an "own" property. An attacker can pollute the global Object.prototype by adding a filename property to it. When an application using piscina creates a new Piscina instance or calls the run method with an options object that doesn't have its own filename property, the JavaScript runtime traverses the prototype chain and uses the attacker-controlled filename from Object.prototype. This leads to the piscina worker loading and executing a malicious file specified by the attacker, resulting in Remote Code Execution (RCE) within the context of the worker thread.
The patch mitigates this by ensuring that the filename property is only read from the options object itself and not from its prototype chain. In the constructor, this is done by creating a new null-prototype object from the provided options. In the run method, it's fixed by using Object.prototype.hasOwnProperty.call(options, 'filename') to check for the property's existence before using it.
The identified vulnerable functions, Piscina.constructor and Piscina.run, are the entry points where the polluted filename property is processed, making them the key indicators of exploitation in a runtime profile.