Denial of Service Vulnerability in JRuby: Hash Collision Attack

jruby Updated 02 Oct 2025

Summary

28/11/2012
N/A
Yes i
Unrated
Not published

CVE-2012-5370: JRuby computes hash values without properly 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... Affects jruby versions < 1.5.6-5. Fixed in 1.5.6-5. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

JRuby is an implementation of the Ruby programming language on the Java Virtual Machine (JVM). It allows Ruby applications to run on the JVM, providing compatibility with Java libraries and performance benefits. However, JRuby is susceptible to a specific vulnerability that allows attackers to exploit hash collisions, leading to potential denial of service (DoS) conditions in applications that utilize hash tables.

Vulnerability Detail

The vulnerability, identified as CVE-2012-5370, arises from JRuby's method of computing hash values without adequate restrictions, enabling attackers to trigger predictable hash collisions. This can lead to excessive CPU consumption, effectively causing a denial of service for applications that rely on hash tables. The attack is characterized by a universal multicollision attack against the MurmurHash2 algorithm, which is distinct from other vulnerabilities such as CVE-2011-4838.

How To Fix

Minimum fixed version

1.5.6-5

This is the first release that contains the fix.

sudo apt-get install --only-upgrade jruby

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading is not immediately feasible, consider implementing a custom hash function or using a different data structure that is less susceptible to hash collision attacks. Additionally, limiting the size of input data to hash tables can mitigate the impact of potential collisions.

Conclusion

CVE-2012-5370 presents a significant risk to applications using JRuby due to its vulnerability to hash collision attacks. It is crucial for developers to upgrade to the fixed version to ensure the security and stability of their applications. For those unable to upgrade immediately, implementing workarounds can help mitigate the risks.

See every vulnerability recorded for jruby →

Share this vulnerability

FAQ

CVE-2012-5370 is a vulnerability in JRuby that allows attackers to exploit hash collisions, leading to denial of service conditions.

You can check if your application is affected by using the Vulert playground at Vulert Scanner, which allows you to monitor for open-source vulnerabilities without requiring any installation.

The primary consequence is denial of service due to excessive CPU consumption, which can disrupt the normal functioning of applications that utilize hash tables.

Yes, upgrading to JRuby version 1.5.6-5 or later will resolve the vulnerability.

Consider implementing a custom hash function or using alternative data structures to reduce the risk of hash collisions until you can upgrade.

Related vulnerabilities

Recent vulnerabilities recorded for jruby.

How To Fix

Minimum fixed version

1.5.6-5

This is the first release that contains the fix.

sudo apt-get install --only-upgrade jruby

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback