Read the docs
TI-2026-25717 Aliases CVE-2026-33306GHSA-f27w-vcwj-c954

bcrypt-ruby has an Integer Overflow that Causes Zero Key-Strengthening Iterations at Cost=31 on JRuby

Priority LOW 20CWE-190Published · Updated

Key facts

Attack vector
Local
Privileges required
None
User interaction
None
Attack complexity
High
Attack requirements
Present
Impact type
Code execution
Confidentiality · integrity · availability
High · High · None
Fix status
Fixed

Attack profile from CVSS 4.0 · CNA. Fix status from CNA and GitHub. Impact type from CWE-190 and the CVSS impact.

Summary

bcrypt-ruby is a Ruby binding for the OpenBSD bcrypt() password hashing algorithm. Prior to version 3.1.22, an integer overflow in the Java BCrypt implementation for JRuby can cause zero iterations in the strengthening loop. Impacted applications must be setting the cost to 31 to see this happen. The JRuby implementation of bcrypt-ruby (`BCrypt.java`) computes the key-strengthening round count as a signed 32-bit integer. When `cost=31` (the maximum allowed by the gem), signed integer overflow causes the round count to become negative, and the strengthening loop executes **zero iterations**. This collapses bcrypt from 2^31 rounds of exponential key-strengthening to effectively constant-time computation — only the initial EksBlowfish key setup and final 64x encryption phase remain. The resulting hash looks valid (`$2a$31$...`) and verifies correctly via `checkpw`, making the weakness invisible to the application. This issue is triggered only when cost=31 is used or when verifying a `$2a$31$` hash. This problem has been fixed in version 3.1.22. As a workaround, set the cost to something less than 31.

Why it matters now

Exploitation None reported CISA SSVC · not in CISA KEV
EPSS 0.00237 14th percentileScored 2026-11-07
Fix Fixed bcrypt-ruby (bcrypt-ruby): 3.1.22bcrypt (RubyGems): 3.1.22

SSVC decision points

CISA ADP · SSVC 2.0.3

Exploitation
None
Automatable
No
Technical impact
Partial

The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.

Affected products

VendorProductAffected versionsFixed inStatusSource
bcrypt-rubybcrypt-rubybefore 3.1.223.1.22Patch availableCNA
—bcrypt (RubyGems)before 3.1.223.1.22Patch availableGHSA-f27w-vcwj-c954
  • bcrypt-ruby Vendorbcrypt-ruby Affected before 3.1.22 Fixed in 3.1.22 Patch available CNA
  • bcrypt (RubyGems) Vendor— Affected before 3.1.22 Fixed in 3.1.22 Patch available GHSA-f27w-vcwj-c954

CPE configurations NVD · 1

CPEVersionsRoleVendor
cpe:2.3:a:bcrypt-ruby_project:bcrypt-ruby:*:*:*:*:*:ruby:*:*before 3.1.22VulnerableBcrypt-ruby Project
  • cpe:2.3:a:bcrypt-ruby_project:bcrypt-ruby:*:*:*:*:*:ruby:*:* Versions before 3.1.22 Vulnerable ·Bcrypt-ruby Project

Remediation

  • Fix · CNA bcrypt-ruby (bcrypt-ruby) Fixed in 3.1.22
  • Fix · GHSA-f27w-vcwj-c954 bcrypt (RubyGems) Fixed in 3.1.22 Advisory →

Vendor assessments

Red Hat

Red Hat rating: Moderate. Red Hat's page for this CVE →

Not affected: 1 product
  • Red Hat Satellite 6

Timeline

  1. 2026-10-02 Threatist record created from CVE-2026-33306
  2. 2026-10-03 Alias added: GHSA-f27w-vcwj-c954

References

Sources