CVEfocus › CVE database › CVE-2026-33306

CVE-2026-33306bcrypt-ruby has an Integer Overflow that Causes Zero Key-Strengthening Iterations at…

CVSS 4.5 MediumEPSS 0.3% (higher than 14% of CVEs)Published 2026-03-24Updated 2026-03-24Assigner: GitHub_M

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.

CWE-190

What to do

Fixed builds are available from Debian, RubyGems: see the table below for the fixed version per release.

Debian, Ubuntu have not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

2Fixed
4Fix pending

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 18.04bcryptFix pendingUBUNTU-CVE-2026-33306
Ubuntu 16.04bcryptFix pendingUBUNTU-CVE-2026-33306
Debian 14ruby-bcryptFixed3.1.22-1DEBIAN-CVE-2026-33306
Debian 13ruby-bcryptFix pendingDEBIAN-CVE-2026-33306
Debian 12ruby-bcryptFix pendingDEBIAN-CVE-2026-33306
RubyGems librarybcryptFixed3.1.22GHSA-f27w-vcwj-c954

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.