The vulnerability exists in the query-string-parser package, version 1.0.0. The root cause is the lack of sanitization of keys parsed from the query string, which leads to a prototype pollution vulnerability. The analysis of the source code in index.js reveals two key functions involved in the vulnerability.
The queryStringToObject function is the main function that takes the raw query string as input. It splits the query string into key-value pairs and then calls the _fillValue function to construct a nested object. However, it does not validate the keys before passing them on.
The _fillValue function is a recursive function that builds the result object. It uses the keys from the query string to create or modify properties on the object. The vulnerability is triggered when a key is __proto__. In this case, the function modifies the Object.prototype instead of the intended object, retval. Any subsequent object creation in the application will inherit the polluted properties, which can lead to denial of service, remote code execution, or other security impacts.
Since there is no patch available for this vulnerability, any usage of query-string-parser@1.0.0 is considered vulnerable.