Skip to content
Heist/ feed
UnratedFix available

DEBIAN-CVE-2026-33306

Type: advisorySource: OSV1 source record

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.

Announced Group revision 1
Original source ↗

DEBIAN-CVE-2026-33306

Primary source · Revision 1

Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.

Security context

Source reference: osv:DEBIAN-CVE-2026-33306

ruby-bcrypt

Source reference: /affected/0/package/name

Affected versions
3.1.18-1

Source reference: /affected/0/versions

3.1.20-1

Source reference: /affected/0/versions

3.1.21-1

Source reference: /affected/0/versions

3.1.22-1

Source reference: /affected/0/versions

Fixed versions
Not stated in this record
Prerequisites
Not stated in this record

ruby-bcrypt

Source reference: /affected/1/package/name

Affected versions
3.1.20-1

Source reference: /affected/1/versions

3.1.21-1

Source reference: /affected/1/versions

3.1.22-1

Source reference: /affected/1/versions

Fixed versions
Not stated in this record
Prerequisites
Not stated in this record

ruby-bcrypt

Source reference: /affected/2/package/name

Affected versions
3.1.20-1

Source reference: /affected/2/versions

3.1.21-1

Source reference: /affected/2/versions

Fixed versions
3.1.22-1

Source reference: /affected/2/ranges

Prerequisites
Not stated in this record

Structured affected-version data

Original package identities and version rules from this source.

[
  {
    "ranges": [
      {
        "type": "ECOSYSTEM",
        "events": [
          {
            "introduced": "0"
          }
        ]
      }
    ],
    "package": {
      "name": "ruby-bcrypt",
      "purl": "pkg:deb/debian/ruby-bcrypt?arch=source&distro=bookworm",
      "ecosystem": "Debian:12"
    },
    "versions": [
      "3.1.18-1",
      "3.1.20-1",
      "3.1.21-1",
      "3.1.22-1"
    ],
    "database_specific": {
      "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2026-33306.json"
    },
    "ecosystem_specific": {
      "urgency": "not yet assigned"
    }
  },
  {
    "ranges": [
      {
        "type": "ECOSYSTEM",
        "events": [
          {
            "introduced": "0"
          }
        ]
      }
    ],
    "package": {
      "name": "ruby-bcrypt",
      "purl": "pkg:deb/debian/ruby-bcrypt?arch=source&distro=trixie",
      "ecosystem": "Debian:13"
    },
    "versions": [
      "3.1.20-1",
      "3.1.21-1",
      "3.1.22-1"
    ],
    "database_specific": {
      "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2026-33306.json"
    },
    "ecosystem_specific": {
      "urgency": "not yet assigned"
    }
  },
  {
    "ranges": [
      {
        "type": "ECOSYSTEM",
        "events": [
          {
            "introduced": "0"
          },
          {
            "fixed": "3.1.22-1"
          }
        ]
      }
    ],
    "package": {
      "name": "ruby-bcrypt",
      "purl": "pkg:deb/debian/ruby-bcrypt?arch=source&distro=forky",
      "ecosystem": "Debian:14"
    },
    "versions": [
      "3.1.20-1",
      "3.1.21-1"
    ],
    "database_specific": {
      "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2026-33306.json"
    },
    "ecosystem_specific": {
      "urgency": "not yet assigned"
    }
  }
]

Publisher severity

No explicit severity was provided.

Event
#56803 · Revision 1
Added to Heist Feed
Publisher date
Read the original announcement