Junglewise Threat Intelligence

block_buffer panic corrupts buffer cursor position

Severity: medium · CVSS 6.3 · Published 2026-08-19

Executive brief

The block_buffer Rust library used for cryptographic operations stores a cursor position tracking where data is in an internal buffer. If a callback function panics during buffer operations and the panic is caught by surrounding code, the cursor position can become corrupted, potentially allowing out-of-bounds memory access in subsequent buffer operations.

Technical details

The block_buffer library stores cursor positions inline within buffer metadata (in EagerBuffer, the last byte of the block; in ReadBuffer, the first byte). When operations like digest_blocks() or write_block() invoke caller-provided callbacks before restoring the cursor to a valid state, a panic in that callback leaves the cursor corrupted. If safe code catches the panic with catch_unwind() and continues using the buffer, subsequent operations like get_pos() access invalid cursor values, triggering undefined behavior assumptions (unreachable_unchecked!). The attacker-controlled byte that overwrites the cursor comes from untrusted input, but exploitation requires both catching the panic (uncommon) and triggering it. The vulnerability was fixed in block_buffer 0.12.1 via improved exception safety.

Affected products

  • RustCrypto block_buffer < 0.12.1

Timeline

  • 2026-06-11: disclosed: GHSA published
  • 2026-06-11: patched: block_buffer 0.12.1 released with fix
  • 2026-08-19: advisory: Advisory updated on GitHub

References