CVE-2011-4815

HIGH7.8/ 10.0
Share:
Published: December 30, 2011 at 01:55 AM
Modified: April 11, 2025 at 12:51 AM
Source: cve@mitre.org

Vulnerability Description

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.

CVSS Metrics

Base Score
7.8
Severity
HIGH
Vector String
AV:N/AC:L/Au:N/C:N/I:N/A:C

Weaknesses (CWE)

Source: nvd@nist.gov

AI Security Analysis

01 // Technical Summary

Ruby applications using versions prior to 1.8.7-p357 are vulnerable to a denial-of-service (DoS) attack. By providing specially crafted input, attackers can trigger hash collisions, leading to excessive CPU consumption and application unavailability, effectively rendering the application unresponsive.

02 // Vulnerability Mechanism

Step 1: Payload Generation: The attacker crafts a set of input strings designed to collide within the Ruby hash table. These strings are carefully constructed to produce the same hash value when processed by the vulnerable hash function.

Step 2: Input Delivery: The attacker submits the crafted input to the Ruby application. This could be through a web form, API call, or any other input mechanism that the application uses.

Step 3: Hash Table Population: The Ruby application receives the input and attempts to store it in a hash table (e.g., a hash or a dictionary). Due to the predictable hash function, the crafted input strings all map to the same bucket within the hash table.

Step 4: Collision Trigger: When the application attempts to access or process any of the colliding keys, it must iterate through the entire bucket containing all the colliding entries. This linear search consumes significant CPU resources.

Step 5: Denial of Service: The CPU consumption caused by the linear search leads to a denial-of-service. The application becomes unresponsive, unable to process legitimate requests, and potentially crashes or becomes unavailable.

03 // Deep Technical Analysis

The vulnerability stems from the lack of randomization in Ruby's hash function implementation. Specifically, the hash function used in older versions of Ruby (CRuby) does not adequately prevent predictable hash collisions. An attacker can craft input that forces multiple keys to hash to the same bucket within a hash table. When the application attempts to retrieve or process these colliding keys, it results in a linear search through the bucket, leading to a significant performance degradation. This is because the hash table's performance degrades from O(1) to O(n) for lookups and insertions in the worst-case scenario, where n is the number of colliding keys. The root cause is the predictable nature of the hash function, which allows attackers to control the hash values of their input.

References & Intelligence

http://archives.neohapsis.com/archives/bugtraq/2011-12/0181.html
Source: cve@mitre.org
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/391606
Source: cve@mitre.org
http://jvn.jp/en/jp/JVN90615481/index.html
Source: cve@mitre.org
http://jvndb.jvn.jp/ja/contents/2012/JVNDB-2012-000066.html
Source: cve@mitre.org
http://lists.apple.com/archives/security-announce/2012/May/msg00001.html
Source: cve@mitre.org
http://rhn.redhat.com/errata/RHSA-2012-0069.html
Source: cve@mitre.org
http://rhn.redhat.com/errata/RHSA-2012-0070.html
Source: cve@mitre.org
http://secunia.com/advisories/47405
Source: cve@mitre.org
http://secunia.com/advisories/47822
Source: cve@mitre.org
http://support.apple.com/kb/HT5281
Source: cve@mitre.org
http://www.kb.cert.org/vuls/id/903934
Source: cve@mitre.org
US Government Resource
http://www.nruns.com/_downloads/advisory28122011.pdf
Source: cve@mitre.org
http://www.ocert.org/advisories/ocert-2011-003.html
Source: cve@mitre.org
http://www.ruby-lang.org/en/news/2011/12/28/denial-of-service-attack-was-found-for-rubys-hash-algorithm/
Source: cve@mitre.org
http://www.securitytracker.com/id?1026474
Source: cve@mitre.org
https://exchange.xforce.ibmcloud.com/vulnerabilities/72020
Source: cve@mitre.org
http://archives.neohapsis.com/archives/bugtraq/2011-12/0181.html
Source: af854a3a-2127-422b-91ae-364da2661108
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/391606
Source: af854a3a-2127-422b-91ae-364da2661108
http://jvn.jp/en/jp/JVN90615481/index.html
Source: af854a3a-2127-422b-91ae-364da2661108
http://jvndb.jvn.jp/ja/contents/2012/JVNDB-2012-000066.html
Source: af854a3a-2127-422b-91ae-364da2661108
http://lists.apple.com/archives/security-announce/2012/May/msg00001.html
Source: af854a3a-2127-422b-91ae-364da2661108
http://rhn.redhat.com/errata/RHSA-2012-0069.html
Source: af854a3a-2127-422b-91ae-364da2661108
http://rhn.redhat.com/errata/RHSA-2012-0070.html
Source: af854a3a-2127-422b-91ae-364da2661108
http://secunia.com/advisories/47405
Source: af854a3a-2127-422b-91ae-364da2661108
http://secunia.com/advisories/47822
Source: af854a3a-2127-422b-91ae-364da2661108
http://support.apple.com/kb/HT5281
Source: af854a3a-2127-422b-91ae-364da2661108
http://www.kb.cert.org/vuls/id/903934
Source: af854a3a-2127-422b-91ae-364da2661108
US Government Resource
http://www.nruns.com/_downloads/advisory28122011.pdf
Source: af854a3a-2127-422b-91ae-364da2661108
http://www.ocert.org/advisories/ocert-2011-003.html
Source: af854a3a-2127-422b-91ae-364da2661108
http://www.ruby-lang.org/en/news/2011/12/28/denial-of-service-attack-was-found-for-rubys-hash-algorithm/
Source: af854a3a-2127-422b-91ae-364da2661108
http://www.securitytracker.com/id?1026474
Source: af854a3a-2127-422b-91ae-364da2661108
https://exchange.xforce.ibmcloud.com/vulnerabilities/72020
Source: af854a3a-2127-422b-91ae-364da2661108
CVE-2011-4815 - HIGH Severity (7.8) | Free CVE Database | 4nuxd