CVE-2011-4815: Input Validation
Julian Wälde and Alexander Klink reported a flaw in the hash function used in the implementation of the Ruby arrays implemented using the hash table.
A specially-crafted set of keys could trigger hash function collisions, which degrade hash table performance by changing hash table operations complexity from an expected/average O(1) to the worst case O(n). Reporters were able to find colliding strings efficiently using equivalent substrings or meet in the middle techniques.
As various web application frameworks for Ruby automatically pre-fill certain arrays with data from the HTTP request (such as GET or POST parameters) for Ruby web application, a remote attacker could use this flaw to make Ruby interpreter use excessive amount of CPU time by sending a POST request with large amount of parameters which hash to the same value.
This problem is similar to the issue that was previously reported for and fixed in e.g. perl: http://www.cs.rice.edu/~scrosby/hash/CrosbyWallachUsenixSec2003.pdf
Note: This issue did not affect Ruby 1.9, which already randomizes hash function in a similar way perl does.
Other sources
Ruby (aka CRuby) before 1.8.7-p357 computes hash values without restricting the ability to trigger hash collisions predictably, which allows context-dependent attackers to cause a denial of service (CPU consumption) via crafted input to an application that maintains a hash table.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Rubyto a version that resolves this vulnerability.Fixed in 1.8.7-p357
Event History
Frequently Asked Questions
What is the severity of CVE-2011-4815?
CVE-2011-4815 is classified as a denial of service vulnerability due to its potential to cause excessive CPU consumption.
How do I fix CVE-2011-4815?
To fix CVE-2011-4815, upgrade Ruby to version 1.8.7-p357 or later.
What software versions are affected by CVE-2011-4815?
CVE-2011-4815 affects Ruby versions 1.8.7-p299 through 1.8.7-p352.
What kind of attack does CVE-2011-4815 facilitate?
CVE-2011-4815 allows context-dependent attackers to trigger hash collisions, leading to denial of service.
Is CVE-2011-4815 specific to a certain operating system?
CVE-2011-4815 is related to the Ruby programming language and is not specific to any particular operating system.