# GHSA-q95x-7g78-rccv: Use-after-free

> A use-after-free vulnerability in the oneringbuf Rust library allows attackers to execute arbitrary code or cause denial of service via unsafe cloning of ring buffer references.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Not stated
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 27 May 2026
- **Also known as:** RUSTSEC-2026-0152

## What is GHSA-q95x-7g78-rccv?

GHSA-q95x-7g78-rccv is an use after free vulnerability in oneringbuf, published on 27 May 2026. 

### Official description

Affected versions of `oneringbuf` exposed the obsolete `IntoRef::into_ref` method through the public `IntoRef` trait. For heap-backed ring buffers, this method returned a `DroppableRef` handle.

`DroppableRef` stored an owning raw pointer created from `Box::into_raw`. Its `Clone` implementation copied this raw pointer without incrementing the internal `alive_iters` counter. Internally, this clone pattern appears to rely on a fixed number of handles being created to match the initial `alive_iters` value. However, exposing `DroppableRef` through the public `IntoRef::TargetRef` associated type allows safe external code to create additional clones beyond that fixed count, breaking the lifetime protocol. `Drop` later dereferenced the pointer and could free the backing allocation with `Box::from_raw`.

Safe code could call `IntoRef::into_ref` to obtain a `DroppableRef` and then clone it. Each clone pointed to the same allocation, but the internal `alive_iters` counter was not increased. As a result, one clone could free the allocation while another clone still existed. Dropping the remaining clone then accessed freed memory, causing a heap-use-after-free.

The issue was fixed in version 0.8.0 by removing the obsolete `into_ref` method.

## Trigger

```rust
use oneringbuf::{IntoRef, LocalHeapRB};

fn main() {
    let rb = LocalHeapRB::<usize>::from(vec![1, 2, 3]);

    let r = <LocalHeapRB<usize> as IntoRef>::into_ref(rb);
    let r2 = r.clone();
    let r3 = r.clone();

    drop(r);
    drop(r2);
    drop(r3); // AddressSanitizer: heap-use-after-free
}
```

## Which versions are affected by GHSA-q95x-7g78-rccv?

3 open source packages ship an affected version, including oneringbuf.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `oneringbuf` | crates.io | All versions | 0.8.0 |
| `oneringbuf` | crates.io | All versions | 0.8.0 |
| `oneringbuf` | crates.io | From 0.0.0-0 | 0.8.0 |

## How do I fix GHSA-q95x-7g78-rccv?

Upgrade oneringbuf to 0.8.0 or later.

## Is GHSA-q95x-7g78-rccv being exploited?

There is no known exploitation of GHSA-q95x-7g78-rccv in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-q95x-7g78-rccv and fix it if it is affected.

What it is: GHSA-q95x-7g78-rccv is an use after free vulnerability in oneringbuf, published on 27 May 2026. 
Exploitation: There is no known exploitation of GHSA-q95x-7g78-rccv in the wild and no public exploit code.

Affected packages and fixed versions:
- oneringbuf (crates.io): affected all versions; fixed in 0.8.0
- oneringbuf (crates.io): affected all versions; fixed in 0.8.0
- oneringbuf (crates.io): affected from 0.0.0-0; fixed in 0.8.0

Task:
1. 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.
2. 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.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-q95x-7g78-rccv/ (Markdown: https://insights.sbomify.com/GHSA-q95x-7g78-rccv/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-q95x-7g78-rccv

---
From sbomify Insights: https://insights.sbomify.com/GHSA-q95x-7g78-rccv/
Summaries are generated and may contain mistakes; the official description above is the record.
