# RUSTSEC-2026-0143: Double-free in `vmem` storage reachable from safe Rust

> A double-free vulnerability in the vmem feature allows attackers to cause crashes or potentially execute code via memory corruption when using safe Rust constructors.

- **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:** 14 May 2026

## What is RUSTSEC-2026-0143?

RUSTSEC-2026-0143 is an use after free vulnerability in oneringbuf, published on 14 May 2026. 

### Official description

When the `vmem` feature is enabled, `VmemStorage<T>::new(Box<[UnsafeSyncCell<T>]>)` (and every public constructor that funnels through it — `ConcurrentHeapRB::default(cap)`, `ConcurrentHeapRB::from(Vec<T>)`, `From<Box<[T]>>`, etc.) bit-copies the input buffer into a freshly `mmap`'d region with `ptr::copy_nonoverlapping`, then lets the source `Box<[UnsafeSyncCell<T>]>` drop normally.

Because `UnsafeSyncCell<T>` has a `Drop` impl that runs `assume_init_drop` on its inner `MaybeUninit<T>`, the source-side `T` values are dropped at the end of `new`, while bitwise duplicates (carrying the same heap pointers for `String`, `Box`, `Vec`, `Arc`, …) remain inside the mmap region. When the ring buffer is later destructed, the destructor's `drop_in_place` over the slice runs `UnsafeSyncCell::drop` a second time on every cell — a deterministic double-free of every heap-owning element. Reachable from 100% safe Rust.

## Trigger

```rust
let v: Vec<Vec<u32>> = (0..1024).map(|i| vec![i, i+1, i+2]).collect();
let rb: oneringbuf::SharedVmemRB<Vec<u32>> = oneringbuf::SharedVmemRB::from(v);
drop(rb);
// glibc: free(): double free detected in tcache 2 -> abort
// ASan: AddressSanitizer: attempting double-free
```

Any `T` with a non-trivial `Drop` reproduces deterministically.

## Fix

Fixed in `0.7.1` via upstream PR [skilvingr/rust-oneringbuf#3](https://github.com/skilvingr/rust-oneringbuf/pull/3), which deallocates the source `Box<[UnsafeSyncCell<T>]>` without running per-element `Drop` after the bytes have been copied into the mmap region. Vulnerable versions (`< 0.7.1`) have been yanked from crates.io.

## Which versions are affected by RUSTSEC-2026-0143?

1 open source package ship an affected version, including oneringbuf.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `oneringbuf` | crates.io | From 0.0.0-0 | 0.7.1 |

## How do I fix RUSTSEC-2026-0143?

Upgrade oneringbuf to 0.7.1 or later.

## Is RUSTSEC-2026-0143 being exploited?

There is no known exploitation of RUSTSEC-2026-0143 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for RUSTSEC-2026-0143 and fix it if it is affected.

What it is: RUSTSEC-2026-0143 is an use after free vulnerability in oneringbuf, published on 14 May 2026. 
Exploitation: There is no known exploitation of RUSTSEC-2026-0143 in the wild and no public exploit code.

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

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/RUSTSEC-2026-0143/ (Markdown: https://insights.sbomify.com/RUSTSEC-2026-0143/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/RUSTSEC-2026-0143

---
From sbomify Insights: https://insights.sbomify.com/RUSTSEC-2026-0143/
Summaries are generated and may contain mistakes; the official description above is the record.
