CVE catalog

CVE-2026-33306

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

[CVE catalog]

Severity
Medium · CVSS 6.7CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
Published
Source
[NVD] · [CVE record]
EPSS
0.24% · Oct 25, 2026

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.

Vulnerable and fixed packages

Distribution-reported package versions and fixes. These do not depend on matching against the OpenFactory package catalog.

DistributionPackageReleaseVersionStatus
Debianruby-bcryptsid3.1.22-1fixed
Debianruby-bcryptforky3.1.22-1fixed
Debianruby-bcrypttrixie3.1.20-1vulnerable
Debianruby-bcryptbookworm3.1.18-1vulnerable
RubygemsbcryptNot reported3.1.22fixed
Cperuby-bcryptNot reportedNot reportedvulnerable
Ubuntubcrypt16.041.1-8.1vulnerable
Ubuntubcrypt18.041.1-8.1vulnerable
Ubuntubcrypt18.041.1-8.1build1vulnerable

Fixed-version evidence

DistributionPackageTypeReleaseFixed versionUrgencyOriginBugs
Debianruby-bcryptsourcesid3.1.22-1not yet assignedNot reportedNot reported
Debianruby-bcryptsourceforky3.1.22-1not yet assignedNot reportedNot reported
Debianruby-bcryptsourcetrixie(unfixed)not yet assignedNot reportedNot reported
Debianruby-bcryptsourcebookworm(unfixed)not yet assignedNot reportedNot reported
RubygemsbcryptrubygemsNot reported3.1.22Not reportedNot reportedNot reported

Notes

[trixie] ruby-bcrypt: Minor issue [bookworm] ruby-bcrypt: Minor issue

OpenFactory catalog packages

[Debian 12 (Bookworm)]

  • [ruby-bcrypt]Affected
    Details (2)
    • 3.1.18-1 · amd64 · bookworm

      Affected

      nvd · ruby-bcrypt · debian · bookworm; nvd · ruby-bcrypt · debian · 12

    • 3.1.18-1 · arm64 · bookworm

      Affected

      nvd · ruby-bcrypt · debian · bookworm; nvd · ruby-bcrypt · debian · 12

[Debian 13 (Trixie)]

  • [ruby-bcrypt]Affected

    Source package: [ruby-bcrypt]

    Details (2)
    • 3.1.20-1+b2 · amd64 · trixie

      Affected

      nvd · ruby-bcrypt · debian · 13

    • 3.1.20-1+b2 · arm64 · trixie

      Affected

      nvd · ruby-bcrypt · debian · 13

Observed:

References