The vulnerability lies in the inconsistent handling of duplicate parameters within HTTP headers by the @hapi/content library. The analysis of the patch commit 3850079550c191d25e3643dc82a6d61144db8c2f reveals the two key vulnerable functions: type and disposition.
-
disposition function: This function parses the Content-Disposition header. Before the patch, if a header contained duplicate parameters (e.g., filename="safe.txt"; filename="shell.php"), the function would simply overwrite the value, effectively keeping the last one seen. This created a parameter smuggling vulnerability, as a web application firewall (WAF) or proxy might interpret the header differently (e.g., by taking the first parameter), leading to a bypass of security controls like file upload filters.
-
type function: This function parses the Content-Type header. It had a similar issue where it would retain the first occurrence of charset and boundary parameters, silently ignoring subsequent ones. This could also lead to interpretation conflicts with other systems in the request chain.
The patch addresses these issues by adding explicit checks within both functions to detect and throw an error upon finding duplicate parameters, unless the duplication is explicitly allowed by RFC specifications (as in the case of ext-value in Content-Disposition). Therefore, any runtime profile during exploitation of this vulnerability would show traces originating from the type and disposition functions as they process the malicious headers.