{"answers":{"affected":"2 open source packages ship an affected version, including bcrypt. It affects 1 product.","exploited":"There is no known exploitation of CVE-2026-33306 in the wild and no public exploit code.","fix":"Upgrade bcrypt to 3.1.22 or later.","what":"CVE-2026-33306 is a medium-severity vulnerability in bcrypt-ruby, published on 24 Mar 2026. It can only be exploited from the same machine or local network, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2026-33306 and fix it if it is affected.\n\nWhat it is: CVE-2026-33306 is a medium-severity vulnerability in bcrypt-ruby, published on 24 Mar 2026. It can only be exploited from the same machine or local network, with no action from the victim.\nExploitation: There is no known exploitation of CVE-2026-33306 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- bcrypt (RubyGems): affected all versions; fixed in 3.1.22\n- bcrypt (RubyGems): affected all versions; fixed in 3.1.22\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2026-33306/ (Markdown: https://insights.sbomify.com/CVE-2026-33306/index.md)","id":"CVE-2026-33306","markdown":"https://insights.sbomify.com/CVE-2026-33306/index.md","name":"CVE-2026-33306","record":{"aliases":["DEBIAN-CVE-2026-33306","GHSA-f27w-vcwj-c954","OESA-2026-1723","UBUNTU-CVE-2026-33306"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["security_bypass"],"network_reachable":"adjacent_or_local","non_default_config":true,"product_category":"Ruby bcrypt library","requires_auth":"none","summary":"Integer overflow in JRuby bcrypt implementation causes zero key-strengthening iterations at cost 31, weakening password security.","user_interaction":"not_required","vuln_class":"integer_overflow"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"bcrypt-ruby","vendor":"bcrypt-ruby_project"}],"cvss":{"score":4.5,"severity":"medium","source":"cna","vector":"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","version":"4.0"},"cwes":[{"id":"CWE-190","name":"Integer Overflow or Wraparound"}],"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.","ecosystems":["RubyGems"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"bcrypt-ruby has an Integer Overflow that Causes Zero Key-Strengthening Iterations at Cost=31 on JRuby","id":"CVE-2026-33306","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"RubyGems","product":null,"products":[],"type":"integer_overflow","year":"2026"},"n_packages":2,"n_references":3,"next":{"headline":"mod_gnutils has stack-based buffer overflow caused by a long client certificate chain","id":"CVE-2026-33307"},"packages":[{"ecosystem":"RubyGems","fixed":["3.1.22"],"introduced":["0"],"last_affected":[],"package":"bcrypt","purl":null,"source":"GHSA-f27w-vcwj-c954"},{"ecosystem":"RubyGems","fixed":["3.1.22"],"introduced":["0"],"last_affected":[],"package":"bcrypt","purl":"pkg:gem/bcrypt","source":"GHSA-f27w-vcwj-c954"}],"prev":{"headline":"OpenEMR has Authorization Bypass in FaxSMS AppDispatch Constructor","id":"CVE-2026-33305"},"products":["bcrypt-ruby"],"published":"2026-03-24","related":[],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"partial"},"state":"PUBLISHED","updated":"2026-03-24","vendors":["bcrypt-ruby"]},"summary":"Integer overflow in JRuby bcrypt implementation causes zero key-strengthening iterations at cost 31, weakening password security.","url":"https://insights.sbomify.com/CVE-2026-33306/"}