The vulnerability is a classic prototype pollution issue within the seroval library's JSON deserialization process. The root cause lies in the deserializeProperties function, which, prior to the patch, would directly assign properties to a newly created object without any validation of the property keys. An attacker could craft a JSON payload containing a __proto__ key to modify the Object.prototype of the running application. This could lead to various consequences, including denial of service, or potentially remote code execution in some contexts.
The patch addresses this by introducing a new function, isValidKey, which explicitly checks for and disallows malicious keys like __proto__, constructor, and prototype. The deserializeProperties function was refactored to use a new assignProperty function, which in turn uses isValidKey to ensure that only safe properties are assigned to the deserialized object. The primary vulnerable function is deserializeProperties, as it contained the unsafe property assignment logic. The functions deserializeObject and the public API fromJSON are also relevant as they are part of the call stack that leads to the vulnerable code path during exploitation.