Live › vulnerability › GHSA-qwgh-2vcv-g2f7
The Rust crate block_buffer can leave its internal cursor position in an invalid state if a panic occurs during block processing and is caught by the calling code. The corrupted cursor can then lead to out-of-bounds reads and writes.
Summary written from the sources below. Check the originals before acting.
First seen by InfraStack 2026-10-30 15:32 UTC. All times on this page are UTC.
Only Rust projects that pull in block_buffer at versions from 0.11.0 up to but not including 0.12.1, usually indirectly through hashing or cipher crates. Exposure additionally requires that a panic can be triggered during digest processing and that the surrounding code catches it and keeps using the buffer, which the advisory says should be uncommon. Projects not using block_buffer below 0.12.1 can skip it.
| Product | Ecosystem | Affected | Fixed in |
|---|---|---|---|
| block_buffer | cargo | >= 0.11.0, < 0.12.1 | 0.12.1 |
block_buffer at versions >= 0.11.0 and < 0.12.1 with cargo tree -i block_bufferCargo.lockblock_buffer0.12.1block_buffer to 0.12.1Each row is the first time that source carried this signal. The analyst’s rows are its own findings.
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.
The following two tests fail miri:
#[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.
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.
The issue was discovered by GPT-5.5
This page as .md · .json · in your agent: get_signal("GHSA-qwgh-2vcv-g2f7")
GitHub Advisory Database, CC-BY 4.0. Posts quoted belong to their authors.