CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-XJ2X-F8QW-37MR

GHSA-xj2x-f8qw-37mr: Denial of Service via Multi-Byte UTF-8 Slicing Panic in Rust bcrypt Crate

Alon Barad
Alon Barad
Software Engineer

Dec 4, 2026·10 min read·4 visits

Executive Summary (TL;DR)

The Rust bcrypt crate (versions 0.19.0 and 0.19.1) fails to verify that input hash strings contain only ASCII characters before performing fixed-index string slicing in split_hash. Passing a 60-byte string with multi-byte UTF-8 characters spanning byte offsets 1, 3, 4, 6, 7, or 22 triggers an immediate runtime panic, resulting in a denial of service. Users should upgrade to version 0.19.2, which rejects non-ASCII input strings prior to slicing.

A denial-of-service vulnerability exists in versions 0.19.0 and 0.19.1 of the Rust bcrypt crate (tracked as GHSA-xj2x-f8qw-37mr and RUSTSEC-2026-0199). When parsing a 60-byte hash string containing multi-byte UTF-8 sequences positioned across internal slice offsets, the split_hash function performs direct string slicing across non-character boundaries. This violation of Rust's UTF-8 string invariants triggers an unhandled thread panic (str::slice_error_fail), enabling attackers who can supply or modify hash strings to crash authentication worker threads or terminate processes configured to abort on panic.

Vulnerability Overview

The bcrypt crate (Keats/rust-bcrypt) is a pure-Rust implementation of the OpenBSD Blowfish password hashing algorithm. It exposes core cryptographic verification routines, primarily bcrypt::verify and HashParts::from_str, which accept a plaintext password and a modular crypt format hash string (&str) for authentication validation. Because password verification sits directly on the authentication path of web applications, API gateways, and system daemons, its parser processes inputs retrieved from authentication databases, external identity providers, or configuration files.

In versions 0.19.0 and 0.19.1, the internal hash parser function split_hash contains an uncaught exception flaw classified under CWE-248 (Uncaught Exception) and CWE-1286 (Improper Validation of Syntactic Integrity of Input). The parser validates that the input &str has a byte length of exactly 60 (hash.len() == 60), which corresponds to the standard length of a modular crypt bcrypt output. However, it fails to verify that the string consists exclusively of single-byte ASCII characters before indexing into the string slice.

In the Rust programming language, the &str primitive is guaranteed to be valid UTF-8, and standard range indexing (&s[start..end]) operates on byte offsets that must align with valid UTF-8 code point boundaries. When a 60-byte string containing multi-byte UTF-8 characters is passed to bcrypt::verify or HashParts::from_str such that a multi-byte sequence straddles one of the parser's hardcoded slice offsets, the Rust standard library invokes core::str::slice_error_fail. This immediately triggers an unhandled runtime panic.

Because the bcrypt crate enforces #![forbid(unsafe_code)], this boundary violation is caught safely by the Rust runtime before any out-of-bounds memory access or memory corruption can occur. The security impact is strictly confined to availability. In multi-threaded web servers, an unhandled panic terminates the executing worker thread; in asynchronous runtimes or binaries compiled with panic = "abort" in Cargo.toml, the panic terminates the entire application process, causing a denial of service.

Root Cause Analysis

A valid bcrypt hash adheres to the modular crypt format $[version]$[cost]$[22-char salt][31-char checksum], such as $2b$12$R9h/cIPz0gi.URNNX3kh2OPST9/PgBkqquzi.Ss7KIUgO2t0jWMUW. Every character in a valid hash belongs to the standard base64-like bcrypt alphabet ([a-zA-Z0-9./]) plus the $ delimiter, meaning every character is a 1-byte ASCII value and the total string length is 60 bytes.

The vulnerability is a regression of a previously patched flaw originally reported in 2021 as Issue #62. In the original fix, the maintainer introduced explicit character boundary checks (is_char_boundary) prior to slicing the hash string. However, during a major refactoring of split_hash in Pull Request #95 (released in version 0.19.0), the parser was rewritten to use fixed byte-offset slicing after checking hash.len() != 60, and the is_char_boundary checks were inadvertently removed.

During the version 0.19.0 refactoring, two testing gaps prevented the regression from being detected by continuous integration:

  1. Obsolete Regression Test Prefix: The existing unit test does_no_error_on_char_boundary_splitting tested the string "2a$$$0$OOOOOOOOOOOOOOOOOOOOO£OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO". Because the refactored parser added an early prefix validation check (bytes[0] != b'$'), the test input—which lacked a leading $—returned an early InvalidHash error before reaching the string slicing operations.
  2. Misconfigured Fuzzing Harness: The repository's libFuzzer target in fuzz/fuzz_targets/verify.rs was calling bcrypt::hash(&data, 4) rather than bcrypt::verify(). Consequently, continuous fuzzing only exercised password hashing rather than hash string parsing.

When split_hash executes in versions 0.19.0 and 0.19.1, it verifies that the total byte length is 60 and checks that the delimiter bytes at indices 0, 3, and 6 are $. It then extracts the version (&hash[1..3]), the cost (&hash[4..6]), and the remaining 53-byte payload (let salt_and_hash = &hash[7..]). Finally, it splits the payload into the 22-byte salt (&salt_and_hash[..22]) and the 31-byte checksum (&salt_and_hash[22..]). If a 2-byte UTF-8 sequence (such as £, encoded as 0xC2 0xA3) occupies byte indices 21 and 22 of salt_and_hash (indices 28 and 29 of hash), slicing at index 22 attempts to split the code point in half, causing the Rust runtime to panic.

Code Analysis

The vulnerable code resides in src/lib.rs within the split_hash function, which is invoked by both HashParts::from_str and bcrypt::verify. In versions 0.19.0 and 0.19.1, split_hash checked only the byte length of the input string before proceeding to slice operations:

#[cfg(any(feature = "alloc", feature = "std"))]
fn split_hash(hash: &str) -> BcryptResult<HashParts> {
    // Vulnerable check: verifies byte count is 60, but does not verify ASCII encoding
    if hash.len() != 60 {
        return Err(BcryptError::InvalidHash(
            "the hash format is malformed; expected 60 bytes",
        ));
    }
 
    let bytes = hash.as_bytes();
    if bytes[0] != b'$' || bytes[3] != b'$' || bytes[6] != b'$' {
        return Err(BcryptError::InvalidHash(
            "the hash format is malformed; expected '$' delimiters",
        ));
    }
 
    // Slicing operations below assume every byte offset is a valid UTF-8 char boundary
    let version = &hash[1..3];
    let cost_str = &hash[4..6];
    let salt_and_hash = &hash[7..];
    let salt = &salt_and_hash[..22]; // Panics if offset 22 splits a multi-byte char
    let hash_part = &salt_and_hash[22..];
    // ...
}

In commit 084bedde0aa5501c6d6a0287f6d6857e793fde85 (Pull Request #103), the vulnerability was remediated by enforcing an .is_ascii() check alongside the length check at the entry point of split_hash. In Rust, str::is_ascii() inspects the underlying byte slice to verify that all bytes are in the range 0x00..=0x7F:

--- a/src/lib.rs
+++ b/src/lib.rs
@@ -190,10 +190,12 @@ fn _hash_password(
 /// cost, salt and hash
 #[cfg(any(feature = "alloc", feature = "std"))]
 fn split_hash(hash: &str) -> BcryptResult<HashParts> {
-    // A valid bcrypt hash is always exactly 60 bytes:
-    if hash.len() != 60 {
+    // A valid bcrypt hash is always exactly 60 ASCII bytes. Rejecting
+    // non-ASCII up front avoids panics from `&str` slicing through the
+    // middle of a multi-byte UTF-8 character (regression of #62).
+    if hash.len() != 60 || !hash.is_ascii() {
         return Err(BcryptError::InvalidHash(
-            "the hash format is malformed; expected 60 bytes",
+            "the hash format is malformed; expected 60 ASCII bytes",
         ));
     }

The patch also corrected the libFuzzer harness in fuzz/fuzz_targets/verify.rs to accept a tuple of (&[u8], &str) and invoke bcrypt::verify(data.0, data.1), ensuring that the hash string parser is continuously fuzzed against arbitrary UTF-8 inputs:

--- a/fuzz/fuzz_targets/verify.rs
+++ b/fuzz/fuzz_targets/verify.rs
@@ -1,6 +1,10 @@
 #![no_main]
 use libfuzzer_sys::fuzz_target;
 
-fuzz_target!(|data: &[u8]| {
-    let _ = bcrypt::hash(&data, 4);
+fuzz_target!(|data: (&[u8], &str)| {
+    // Exercise the hash-string parser by feeding both arbitrary
+    // password bytes and arbitrary &str inputs to verify().
+    // The &str input is what reaches split_hash; this is the
+    // surface that #62 (and its regression) lived in.
+    let _ = bcrypt::verify(data.0, data.1);
 });

This fix is complete and eliminates all variant character-boundary panics within split_hash. Because every ASCII byte is guaranteed by UTF-8 encoding rules to be a standalone 1-byte code point, verifying hash.is_ascii() guarantees that every byte index from 0..=60 is a valid character boundary, rendering all subsequent &str slice operations panic-free.

Exploitation

Exploiting GHSA-xj2x-f8qw-37mr requires an attacker to supply a 60-byte UTF-8 string to the hash parameter of bcrypt::verify(password, hash) or HashParts::from_str(hash). Note that in standard authentication workflows, the password parameter (which accepts AsRef<[u8]>) is provided by the end user during login, whereas the hash parameter is loaded from persistent storage or an external token. Passing multi-byte UTF-8 characters in the password argument does not trigger this vulnerability.

Consequently, exploitation occurs under two primary architectural scenarios:

  1. Database or Storage Poisoning: An attacker who achieves limited database write access, secondary SQL injection, or NoSQL attribute injection modifies a stored user password hash to the 60-byte payload. Alternatively, in systems that allow administrators or users to import pre-computed bcrypt hashes (such as user migration endpoints, htpasswd parsers, or configuration file imports), the attacker supplies the malformed hash directly.
  2. Direct Verification APIs: Microservices or CLI utilities that expose an endpoint accepting both a candidate plaintext and a reference bcrypt hash for validation allow an unauthenticated remote caller to trigger the panic directly.

To construct a proof-of-concept payload that bypasses the prefix and delimiter checks (bytes[0] == b'$', bytes[3] == b'$', bytes[6] == b'$') and panics at the salt boundary (offset 22 of salt_and_hash), the input string must satisfy the following byte layout:

  • Bytes 0..7 (7 bytes): A valid prefix such as $2b$04$.
  • Bytes 7..28 (21 bytes): 21 single-byte ASCII characters (aaaaaaaaaaaaaaaaaaaaa).
  • Bytes 28..30 (2 bytes): A 2-byte UTF-8 character such as £ (0xC2 0xA3), occupying byte index 21 and 22 of salt_and_hash.
  • Bytes 30..60 (30 bytes): 30 single-byte ASCII characters (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa).
use bcrypt::verify;
 
fn main() {
    // Total byte length: 7 + 21 + 2 + 30 = 60 bytes (59 UTF-8 characters)
    let crafted_hash = "$2b$04$aaaaaaaaaaaaaaaaaaaaa£aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
    assert_eq!(crafted_hash.len(), 60);
 
    // Triggers thread panic in bcrypt 0.19.0 and 0.19.1:
    // thread 'main' panicked at 'byte index 22 is not a char boundary;
    // it is inside '£' (bytes 21..23) of `aaaaaaaaaaaaaaaaaaaaa£...`'
    let _ = verify(b"password", crafted_hash);
}

> [!NOTE] > A panic can also be triggered earlier in split_hash without valid $2b$04$ version/cost digits by placing a 2-byte UTF-8 character across byte indices 1..3 or 4..6 (for example, placing £ at bytes 2 and 3 disables the bytes[3] == b'$' check only if a 3-byte or 4-byte sequence isn't needed, or placing £ at bytes 1 and 2 while keeping byte 3 as $ triggers a panic on &hash[1..3]).

Impact Assessment

The vulnerability is scored at CVSS v3.1 5.3 (Medium) with the vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L. There is no impact to confidentiality (C:N) or integrity (I:N) because the Rust runtime bounds and UTF-8 checks deterministically trap the invalid slice operation before any memory read or write takes place.

The availability impact (A:L) depends heavily on how the consuming Rust application handles thread panics and how its runtime is configured:

  • Unwinding Panics (Default): When compiled with the default panic = "unwind" profile, a panic in bcrypt::verify unwinds the stack of the current worker thread. In web frameworks that spawn an OS thread per connection or do not wrap blocking CPU-intensive cryptographic calls (tokio::task::spawn_blocking) in a panic handler that gracefully recovers, repeated requests can exhaust the worker pool or drop active client connections.
  • Abort on Panic: Many production Rust microservices and containerized binaries compile with panic = "abort" in Cargo.toml to reduce binary size and eliminate unwinding overhead. In these deployments, a single call to bcrypt::verify with the 60-byte multi-byte payload immediately aborts the entire OS process via SIGABRT, causing a full service outage.

Downstream ecosystem analysis confirmed that pyca/bcrypt (the Python Cryptographic Authority's bcrypt package, which wraps rust-bcrypt 0.19.1 via PyO3) is not affected by this vulnerability. The Python wrapper performs its own custom byte-level parsing and validation of the modular crypt hash string and salt in pyca/bcrypt before invoking bcrypt::hash_with_salt, thereby completely bypassing bcrypt::verify and the vulnerable split_hash code path.

Remediation

To remediate GHSA-xj2x-f8qw-37mr / RUSTSEC-2026-0199, upgrade the bcrypt dependency to version 0.19.2 or later. Version 0.19.2 is a drop-in replacement that restores strict ASCII validation in split_hash and returns a recoverable Err(BcryptError::InvalidHash) instead of panicking.

Update Cargo.toml to require at least version 0.19.2:

[dependencies]
bcrypt = ">= 0.19.2"

Then update the lockfile and verify the dependency tree using Cargo and cargo-audit:

cargo update -p bcrypt
cargo tree -i bcrypt
cargo audit

For environments where upgrading the crate dependencies is temporarily blocked by freeze policies, developers must implement an application-layer pre-validation guard prior to calling bcrypt::verify or HashParts::from_str. Checking that the input string length is 60 bytes and that .is_ascii() returns true completely neutralizes the vulnerability:

use bcrypt::{verify, BcryptError, BcryptResult};
 
pub fn safe_bcrypt_verify<P: AsRef<[u8]>>(password: P, hash: &str) -> BcryptResult<bool> {
    if hash.len() != 60 || !hash.is_ascii() {
        return Err(BcryptError::InvalidHash(
            "the hash format is malformed; expected 60 ASCII bytes",
        ));
    }
    verify(password, hash)
}

Official Patches

Keats (rust-bcrypt)Upstream patch commit adding !hash.is_ascii() validation to split_hash
Keats (rust-bcrypt)Release v0.19.2 containing the fix for GHSA-xj2x-f8qw-37mr / RUSTSEC-2026-0199

Fix Analysis (1)

Technical Appendix

CVSS Score
5.3/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Affected Systems

Rust bcrypt crate (crates.io/crates/bcrypt) versions >= 0.19.0, < 0.19.2

Affected Versions Detail

Product
Affected Versions
Fixed Version
bcrypt
Keats (rust-bcrypt)
>= 0.19.0, < 0.19.20.19.2
AttributeDetail
Advisory IDGHSA-xj2x-f8qw-37mr / RUSTSEC-2026-0199
CWE ClassificationCWE-248 (Uncaught Exception)
CVSS v3.1 Score5.3 Medium (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L)
Affected Componentbcrypt crate (split_hash, bcrypt::verify, HashParts::from_str)
Affected Versions>= 0.19.0, < 0.19.2
Patched Version0.19.2
Primary ImpactDenial of Service via unhandled Rust runtime panic (str::slice_error_fail)
Exploit StatusPublic PoC available in official regression test suite

MITRE ATT&CK Mapping

T1499.004Endpoint Denial of Service: Application or System Exploitation
Impact
CWE-248
Uncaught Exception

An exception or runtime panic is thrown by an application component or standard library runtime check and is not caught, resulting in unexpected thread termination or application crash.

Known Exploits & Detection

GitHubOfficial regression test containing the 60-byte multi-byte UTF-8 reproduction string ($2b$04$aaaaaaaaaaaaaaaaaaaaa£aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) that triggers str::slice_error_fail.

Vulnerability Timeline

Pull Request #103 submitted to Keats/rust-bcrypt to fix the UTF-8 slicing panic regression and correct the verify fuzzing target.
2026-06-11
Pull Request #103 merged into master via commit 084bedde0aa5501c6d6a0287f6d6857e793fde85.
2026-06-16
Vulnerability reported to RustSec and patched version bcrypt 0.19.2 published to crates.io.
2026-06-20
RustSec Advisory RUSTSEC-2026-0199 formally issued.
2026-07-04
GitHub Security Advisory GHSA-xj2x-f8qw-37mr published.
2026-12-03

References & Sources

  • [1]GitHub Security Advisory: GHSA-xj2x-f8qw-37mr
  • [2]RustSec Advisory Database: RUSTSEC-2026-0199
  • [3]GitHub Pull Request #103: Reject non-ASCII hashes in split_hash
  • [4]Fix Commit 084bedde0aa5501c6d6a0287f6d6857e793fde85
  • [5]rust-bcrypt Release v0.19.2
  • [6]Historical Issue #62: Character boundary panic in split_hash
  • [7]Historical PR #95: Refactoring of split_hash in v0.19.0

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 2 hours ago•CVE-2026-142591
5.3

CVE-2026-142591: Denial of Service via Regex Memory Amplification in Rack QueryParser

CVE-2026-142591 (GHSA-f7cc-57h7-qrcg) is an uncontrolled resource consumption vulnerability in the Rack Ruby web server interface library. The flaw resides in Rack::QueryParser, which uses quantified regular expressions to split query strings, parse application/x-www-form-urlencoded request bodies, and evaluate nested parameter names. In Ruby's Onigmo regular expression engine, greedy quantifiers allocate approximately 48 bytes of native backtracking state per matched character. An unauthenticated remote attacker can transmit crafted payloads containing long runs of spaces or bracket characters within Rack's default 4 MiB byte-size limit to trigger an approximate 48x transient memory amplification, allocating up to 200 MB per request and exhausting process or container memory under concurrent load.

Alon Barad
Alon Barad
5 views•10 min read
•about 3 hours ago•CVE-2026-142592
7.5

CVE-2026-142592: Denial of Service via Multipart Charset Encoding Resolution in Rack

CVE-2026-142592 is an uncontrolled resource consumption vulnerability (CWE-400) in Rack, the modular Ruby web server interface. In affected versions within the 3.1.x and 3.2.x branches, the multipart form-data parser directly passes untrusted charset parameters to Ruby's internal Encoding.find method without pre-validation or caching. Because Ruby's MRI runtime traverses the entire $LOAD_PATH searching for shared libraries whenever an unknown encoding is requested, an unauthenticated attacker can submit a multipart payload with thousands of invalid charset parameters to trigger millions of filesystem lookup operations, exhausting CPU and I/O resources and causing denial of service.

Alon Barad
Alon Barad
5 views•13 min read
•about 4 hours ago•CVE-2026-142596
7.5

CVE-2026-142596: Projection Sanitization Bypass and Schema-Level Exclusion Disclosure in Mongoose

A projection sanitization and schema path exclusion bypass vulnerability exists in Mongoose versions 8.5.0 through 8.24.9 and 9.0.0 through 9.12.1. Due to insufficient validation of MongoDB projection syntax in `sanitizeProjection` and `applyPaths`, attackers supplying untrusted projection inputs to queries can force the retrieval of sensitive schema fields configured with `select: false`, such as password hashes, reset tokens, and multi-factor authentication secrets.

Amit Schendel
Amit Schendel
7 views•10 min read
•about 5 hours ago•CVE-2026-142595
6.5

CVE-2026-142595: NoSQL Query Operator Injection via Incomplete Denylist in Automattic Mongoose sanitizeFilter

CVE-2026-142595 is a NoSQL query operator injection vulnerability in Automattic Mongoose caused by an incomplete denylist in the sanitizeFilter query sanitization utility. Prior to the patched versions, sanitizeFilter blocked only four specific top-level operators ($jsonSchema, $where, $expr, and $text), allowing unrecognized or internal MongoDB operators such as $_internalSchemaXor and $_internalSchemaCond to pass through unsanitized. Attackers capable of supplying top-level filter keys can inject arbitrary nested query selectors to bypass authentication, extract sensitive data via boolean inference, or modify database records.

Amit Schendel
Amit Schendel
5 views•12 min read
•about 5 hours ago•CVE-2026-142610
7.5

CVE-2026-142610: Resource Exhaustion Denial of Service via Arbitrary-Precision Math in Laravel Framework

CVE-2026-142610 (GHSA-c25c-x5r7-2v5m) is an allocation of resources without limits or throttling vulnerability (CWE-770) in the Laravel Framework (`laravel/framework`). The flaw exists in how Laravel passes user-supplied numeric strings to the `brick/math` arbitrary-precision arithmetic library during specific validation rules (`multiple_of`, `gt`, `gte`, `lt`, `lte`) and Eloquent model decimal casting (`decimal:X`). When an unauthenticated remote attacker supplies a numeric string formatted in scientific notation with a large positive or negative exponent (e.g., `1e-100000000`), `Brick\Math\BigDecimal` and `Brick\Math\BigNumber` attempt to expand the full numeric representation in memory. This operation immediately exhausts the PHP process memory limit and causes high CPU utilization, terminating worker threads and resulting in an application-layer Denial of Service (DoS). The vulnerability is remediated in Laravel versions 12.74.0 and 13.44.1.

Alon Barad
Alon Barad
8 views•11 min read
•about 7 hours ago•CVE-2026-137198
8.3

CVE-2026-137198: Argument Injection in Node.js cross-spawn via Improper Backslash Escaping on Windows

CVE-2026-137198 is a high-severity argument injection vulnerability (CWE-88) affecting the Node.js cross-spawn library in versions 6.0.6 and 7.0.4 through 7.0.6. On Windows systems, when commands are routed through cmd.exe (including batch files and npm cmd-shims in node_modules/.bin), cross-spawn fails to properly double contiguous sequences of two or more backslashes preceding a double quote or at the end of an argument. This parsing failure causes the argument's closing quotation mark to be escaped as a literal character, allowing attacker-controlled input to break out of quotation encapsulation and inject arbitrary command-line arguments or consume subsequent arguments.

Amit Schendel
Amit Schendel
11 views•13 min read