Loading...
Skip to main content

CVE-2026-33306 — Vulnerability in bcrypt — CVE Details

MEDIUM

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

Published March 19, 2026Updated March 25, 2026Source: osv

Summary

### Impact 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. ### Patches This problem has been fixed in version 3.1.22 ### Workarounds Set the cost to something less than 31.

Advisory Timeline

  • First published March 19, 2026 (207 days ago).
  • Last revised March 25, 2026 — 6 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Bundler
Update bcrypt to 3.1.22 or later
gem install bcrypt -v 3.1.22

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: rubygems (1).

PackageEcosystemAffectedFixed In
bcrypt
rubygems
3.1.10, 3.1.11, 3.1.12, 3.1.12.rc1 (+14 more)3.1.22

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 6.5 score means for each attack dimension.

Attack Vector
Local
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
—
Confidentiality
—
Integrity
—
Availability
—

CVSS:4.0/AV:L/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N/E:U

Frequently Asked Questions

What is CVE-2026-33306?
bcrypt-ruby has an Integer Overflow that Causes Zero Key-Strengthening Iterations at Cost=31 on JRuby This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 6.5/10).
How do I check if my project is affected by CVE-2026-33306?
CVE-2026-33306 affects bcrypt. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-33306 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
6.5

Exploitation requires specific conditions or has limited impact. Remediate within weeks.

Also Known As

GHSA-f27w-vcwj-c954

Related CVEs

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies