GHSA-qwgh-2vcv-g2f7: block_buffer Panic Corrupts Inline Buffer Position Vulnerability

MODERATE
CWE-119
Published
Advisory Summary

GHSA-qwgh-2vcv-g2f7 is a MODERATE panic corrupts inline buffer position vulnerability (CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer) affecting block_buffer libraries in the crates.io ecosystem. The issue involves panic corrupts inline buffer position. Remediation is available by upgrading affected packages to version 0.12.1.

GHSA-qwgh-2vcv-g2f7 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-qwgh-2vcv-g2f7
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer
Affected Product block_buffer
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-qwgh-2vcv-g2f7

To remediate this vulnerability, upgrade all affected block_buffer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

block_buffer fixed: 0.12.1
Upgrade block_buffer to 0.12.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for block_buffer

How to Check if You Are Affected

To determine whether your application is affected by GHSA-qwgh-2vcv-g2f7, inspect your project dependencies for block_buffer:

inspect dependencies for block_buffer

Analyze the terminal output to locate any version of block_buffer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.12.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer, where the product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. this may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data. In block_buffer, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A caught panic may leave the cursor position of `EagerBuffer` or `ReadBuffer` in a corrupted state; this in turn allows out-of-bounds reads/writes. ### Details & PoC The following two tests fail miri: ```rust #[cfg(miri)] #[test] fn eager_digest_blocks_panic_corrupts_inline_position() { // `EagerBuffer` stores its cursor in the last byte of the internal block. // When `digest_blocks` completes a previously partial block, it overwrites // that byte with input data before invoking the caller-provided `compress` // callback. If the callback panics, safe code can catch the panic and keep // using the buffer while its cursor byte no longer satisfies the internal // `pos < block_size` invariant. Under Miri this `get_pos` call reaches the // `unreachable_unchecked` used for the assumed-valid cursor. let mut buf = EagerBuffer::<U4>::new(&[1, 2]); let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { buf.digest_blocks(&[3, 0xff], |_| panic!("simulated compression failure")); })); let _ = buf.get_pos(); } #[cfg(miri)] #[test] fn read_buffer_generator_panic_corrupts_inline_position() { // `ReadBuffer` stores its cursor in `buffer[0]`, but `write_block` gives // `gen_block` mutable access to the whole internal block before restoring // `buffer[0]` to a valid cursor. If `gen_block` writes an arbitrary first // byte and panics, safe code can catch the panic and later observe an // invalid cursor. Under Miri this `get_pos` call reaches the // `unreachable_unchecked` used for the assumed-valid cursor. let mut buf = ReadBuffer::<U4>::default(); let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { buf.write_block( 1, |block| { block[0] = 0xff; panic!("simulated block generation failure"); }, |_| {}, ); })); let _ = buf.get_pos(); } ``` They fail on an `unreachable_unchecked!()` under the invariant for the `pos` to always be within bounds of the block. ### Impact While the byte that overwrites `pos` may come from untrusted input and is therefore attacker-controlled, this still relies on the surrounding code catching the panic and carrying on, which should be uncommon in practice. For this to be exploitable, the attacker also needs a way to trigger a panic here; I have not investigated how feasible that is. ### Credits The issue was discovered by GPT-5.5

GHSA-qwgh-2vcv-g2f7 Affected block_buffer Versions

1 component(s)
Fixed Versions:
0.12.1
Product / Package Ecosystem Affected Versions Fixed Version
block_buffer
crates.io
< 0.12.1
0.12.1

References

Frequently Asked Questions

What is GHSA-qwgh-2vcv-g2f7?
GHSA-qwgh-2vcv-g2f7 is a security vulnerability in block_buffer involving panic corrupts inline buffer position under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer.
Which block_buffer versions are affected?
Affected versions include releases prior to 0.12.1 across affected packages: block_buffer.
What version fixes GHSA-qwgh-2vcv-g2f7?
Upgrading to 0.12.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is block_buffer affected?
Yes, block_buffer is affected in releases prior to 0.12.1. Upgrade your dependency to 0.12.1 or later.
What CWE is associated with GHSA-qwgh-2vcv-g2f7?
GHSA-qwgh-2vcv-g2f7 is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer (The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.).
How can I check crates.io dependencies for GHSA-qwgh-2vcv-g2f7?
Run the dependency tree command: 'inspect dependencies for block_buffer'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qwgh-2vcv-g2f7",
  "modified" : "2026-08-19T19:15:34Z",
  "published" : "2026-08-19T19:15:34Z",
  "aliases" : [ ],
  "summary" : "block_buffer: panic corrupts inline buffer position",
  "details" : "### Summary\n\nA caught panic may leave the cursor position of `EagerBuffer` or `ReadBuffer` in a corrupted state; this in turn allows out-of-bounds reads/writes.\n\n### Details & PoC\n\nThe following two tests fail miri:\n\n```rust\n#[cfg(miri)]\n#[test]\nfn eager_digest_blocks_panic_corrupts_inline_position() {\n    // `EagerBuffer` stores its cursor in the last byte of the internal block.\n    // When `digest_blocks` completes a previously partial block, it overwrites\n    // that byte with input data before invoking the caller-provided `compress`\n    // callback. If the callback panics, safe code can catch the panic and keep\n    // using the buffer while its cursor byte no longer satisfies the internal\n    // `pos < block_size` invariant. Under Miri this `get_pos` call reaches the\n    // `unreachable_unchecked` used for the assumed-valid cursor.\n    let mut buf = EagerBuffer::<U4>::new(&[1, 2]);\n\n    let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {\n        buf.digest_blocks(&[3, 0xff], |_| panic!(\"simulated compression failure\"));\n    }));\n\n    let _ = buf.get_pos();\n}\n\n#[cfg(miri)]\n#[test]\nfn read_buffer_generator_panic_corrupts_inline_position() {\n    // `ReadBuffer` stores its cursor in `buffer[0]`, but `write_block` gives\n    // `gen_block` mutable access to the whole internal block before restoring\n    // `buffer[0]` to a valid cursor. If `gen_block` writes an arbitrary first\n    // byte and panics, safe code can catch the panic and later observe an\n    // invalid cursor. Under Miri this `get_pos` call reaches the\n    // `unreachable_unchecked` used for the assumed-valid cursor.\n    let mut buf = ReadBuffer::<U4>::default();\n\n    let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {\n        buf.write_block(\n            1,\n            |block| {\n                block[0] = 0xff;\n                panic!(\"simulated block generation failure\");\n            },\n            |_| {},\n        );\n    }));\n\n    let _ = buf.get_pos();\n}\n```\n\nThey fail on an `unreachable_unchecked!()` under the invariant for the `pos` to always be within bounds of the block.\n\n### Impact\n\nWhile the byte that overwrites `pos` may come from untrusted input and is therefore attacker-controlled, this still relies on the surrounding code catching the panic and carrying on, which should be uncommon in practice.\n\nFor this to be exploitable, the attacker also needs a way to trigger a panic here; I have not investigated how feasible that is.\n\n### Credits\n\nThe issue was discovered by GPT-5.5",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "block_buffer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.12.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/RustCrypto/utils/security/advisories/GHSA-qwgh-2vcv-g2f7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/RustCrypto/utils"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/RustCrypto/utils/releases/tag/block-buffer-v0.12.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-119" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-19T19:15:34Z",
    "nvd_published_at" : null
  }
}