The vulnerability lies in the Rack::QueryParser's handling of query strings without limits on the number of parameters or overall size, leading to potential DoS. The provided commits (2bb5263b464b65ba4b648996a579dbd180d2b712, 3f5a4249118d09d199fe480466c8c6717e43b6e3, and cd6b70a1f2a1016b73dc906f924869f4902c2d74) all modify lib/rack/query_parser.rb.
The core change is the introduction of the check_query_string method, which is now called by both parse_query and parse_nested_query before they proceed with parsing.
In commit 2bb5263b464b65ba4b648996a579dbd180d2b712 (and similarly in the other commits), the parse_query and parse_nested_query methods were changed from:
(qs || '').split(separator ? (COMMON_SEP[separator] || /[#{separator}] */n) : DEFAULT_SEP).each do |p|
and
(qs || '').split(separator ? (COMMON_SEP[separator] || /[#{separator}] */n) : DEFAULT_SEP).each do |p|
to:
check_query_string(qs, separator).split(separator ? (COMMON_SEP[separator] || /[#{separator}] */n) : DEFAULT_SEP).each do |p|
and
check_query_string(qs, separator).split(separator ? (COMMON_SEP[separator] || /[#{separator}] */n) : DEFAULT_SEP).each do |p|
This indicates that prior to this change, these two methods directly processed the query string (qs) without any preliminary checks on its size or the number of parameters it contained. The check_query_string method was added to implement these missing checks (@bytesize_limit and @params_limit). Therefore, Rack::QueryParser.parse_query and Rack::QueryParser.parse_nested_query are the functions that were vulnerable to the unbounded parameter parsing.