CVE-2026-33306 bcrypt-ruby has an Integer Overflow that Causes Zero Key-Strengthening Iterations at Cost=31 on JRuby
- Published
- Updated
- Exploit status
- Proof-of-concept only
- CISA SSVC
- No known exploitation · automatable: no · technical impact: partial
- Technology
- DebianRed Hat
Description
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.
Upgrade path
6 packages: 3 fixed, 2 with no fix yet.
| Package | Affected | Fixed in | Status |
|---|---|---|---|
| debian/ruby-bcrypt(Debian 12) | = 3.1.18-1; = 3.1.20-1; = 3.1.21-1; = 3.1.22-1 +1 more | No fix listed | No fix yet |
| debian/ruby-bcrypt(Debian 13) | = 3.1.20-1; = 3.1.21-1; = 3.1.22-1; All versions | No fix listed | No fix yet |
| bcrypt-ruby project bcrypt-ruby | < 3.1.22 | 3.1.22 | Fixed |
| debian/ruby-bcrypt(Debian 14) | < 3.1.22-1; = 3.1.20-1; = 3.1.21-1 | 3.1.22-1 | Fixed |
| rubygems bcrypt(RubyGems) | < 3.1.22; <= 3.1.21; = 3.1.3; = 3.1.6 +16 more | 3.1.22 | Fixed |
| bcrypt-ruby | = < 3.1.22 | No fix listed | Versions listed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| rubygems bcrypt(RubyGems) | < 3.1.22 | 3.1.22 |
| rubygems bcrypt(RubyGems) | = 3.1.10 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.11 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.12 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.12.rc1 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.13 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.14 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.15 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.16 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.17 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.18 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.19 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.20 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.21 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.3 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.6 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.7 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.8 | No fix listed |
| rubygems bcrypt(RubyGems) | = 3.1.9 | No fix listed |
| bcrypt-ruby | = < 3.1.22 | No fix listed |
| rubygems bcrypt(RubyGems) | <= 3.1.21 | No fix listed |
| debian/ruby-bcrypt(Debian:12) | All versions | No fix listed |
| debian/ruby-bcrypt(Debian:12) | = 3.1.18-1 | No fix listed |
| debian/ruby-bcrypt(Debian:12) | = 3.1.20-1 | No fix listed |
| debian/ruby-bcrypt(Debian:12) | = 3.1.21-1 | No fix listed |
Show 9 more
| Product | Affected versions | Fixed in |
|---|---|---|
| debian/ruby-bcrypt(Debian:12) | = 3.1.22-1 | No fix listed |
| debian/ruby-bcrypt(Debian:13) | All versions | No fix listed |
| debian/ruby-bcrypt(Debian:13) | = 3.1.20-1 | No fix listed |
| debian/ruby-bcrypt(Debian:13) | = 3.1.21-1 | No fix listed |
| debian/ruby-bcrypt(Debian:13) | = 3.1.22-1 | No fix listed |
| debian/ruby-bcrypt(Debian:14) | < 3.1.22-1 | 3.1.22-1 |
| debian/ruby-bcrypt(Debian:14) | = 3.1.20-1 | No fix listed |
| debian/ruby-bcrypt(Debian:14) | = 3.1.21-1 | No fix listed |
| bcrypt-ruby project bcrypt-ruby | < 3.1.22 | 3.1.22 |
References
- https://github.com/bcrypt-ruby/bcrypt-ruby/security/advisories/GHSA-f27w-vcwj-c954 mitigation vendor-advisory
- nvd.nist.gov third-party-advisory vendor-advisory
- https://github.com/bcrypt-ruby/bcrypt-ruby/commit/831ce64cb0a9502130fa93a28bfd9527a5fa45c4 patch
- github.com product
- https://github.com/bcrypt-ruby/bcrypt-ruby/releases/tag/v3.1.22 product release-notes
- github.com exploit
- github.com
- Debian Security Tracker CVE-2026-33306 vendor-advisory
- Red Hat CVE page vendor-advisory
- Red Hat Bugzilla 2450565 issue-tracking
- www.cve.org