The vulnerability is a prototype pollution issue in the lodash library, specifically within the baseUnset function, which is utilized by the public-facing _.unset and _.omit functions. The root cause was an inadequate validation of property paths provided to these functions. The prior implementation had a check to block paths containing constructor.prototype, but this was easily bypassed. Attackers could wrap malicious path segments like 'constructor' in an array (e.g., [['constructor']]). The code's typeof key !== 'string' check would then cause the validation to be skipped, as the type of the array is 'object'. This allowed for traversal up the prototype chain and the deletion of properties from built-in JavaScript object prototypes.
The patch resolves this by strengthening the validation logic. It now normalizes each segment of the path using a toKey() function before validation. Subsequently, it unconditionally blocks any path that includes either 'constructor' or 'prototype' as an intermediate (non-terminal) segment. This effectively prevents any attempt to traverse into and modify the prototypes of built-in objects. The public functions _.unset and _.omit are the primary vectors through which this vulnerability could be exploited.