CVE-2022-50996: WWW::Form::UrlEncoded::XS versions before 0.28 for Perl write past the end of the Perl argument stack when parse_urlencoded returns many pairs
WWW::Form::UrlEncoded::XS versions before 0.28 for Perl write past the end of the Perl argument stack when parseurlencoded returns many pairs.
parseurlencoded returns its result as a list, pushing each decoded key and value onto the argument stack without first extending the stack to fit them. parseurlencodedarrayref returns an array reference and is not affected.
A remote client that sends a query string or request body with many pairs to an application parsing it with parseurlencoded can corrupt memory and crash the process.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
WWW-Form-UrlEncoded-XSto a version that resolves this vulnerability.Fixed in 0.28
Event History
Frequently Asked Questions
Which applications are exposed to remote attack?
Applications that accept attacker-controlled query strings or request bodies and pass them to parse_urlencoded are exposed. A remote client can trigger memory corruption and crash the process by sending input containing many key-value pairs.
Are all parsing APIs in this package affected?
No. The issue affects parse_urlencoded, which returns decoded pairs as a list. parse_urlencoded_arrayref returns an array reference and is not affected.
What can be done if an immediate upgrade is not possible?
Avoid using parse_urlencoded for untrusted request data and use parse_urlencoded_arrayref instead. Limiting the number of accepted query or body pairs can also reduce exposure where such limits can be enforced.
How can I determine whether an application is affected?
Check whether it uses WWW::Form::UrlEncoded::XS before version 0.28 and calls parse_urlencoded on client-controlled query strings or request bodies. Calls to parse_urlencoded_arrayref are not affected.