# RUSTSEC-2026-0291: Double free in `OwnedAlloc::drop_in_place` when the contained value's `Drop` panics

> A double free and use-after-free vulnerability in OwnedAlloc allows attackers to cause memory corruption or crashes if a contained value's Drop implementation panics.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Not stated
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 9 Sep 2026

## What is RUSTSEC-2026-0291?

RUSTSEC-2026-0291 is an use after free vulnerability in owned-alloc, published on 9 Sep 2026. 

### Official description

`OwnedAlloc::drop_in_place` destroys the contained value by hand, then commits
the ownership transfer with `mem::forget(self)` — which lives inside `into_raw`
and so runs only after the destruction. `T::drop` is user code and may panic. If
it does, the forget is skipped and the still-live `OwnedAlloc` unwinds, whose
destructor drops the same `T` a second time and then deallocates. For a `T` that
owns an allocation, the same block is freed twice — a double free (CWE-415).
That destructor also reads the already-destroyed value through
`Layout::for_value` before deallocating, a use-after-free (CWE-416).

`MaybeUninitAlloc::drop_in_place` delegates to the same function, so both public
entry points are affected. Storing a value whose `Drop` can panic and calling
either is enough — no `unsafe` on the caller's side.

## Fix

No fixed release is available. The crate has had no release since 2018 and the
maintainer has not responded to the report, nor to the one on `lockfree`, which
is published from the same account. `forget_inner` leaks the value instead of
destroying it, which is safe.

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

1 open source package ship an affected version, including owned-alloc.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `owned-alloc` | crates.io | From 0.0.0-0 | None |

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

No fix has been published for RUSTSEC-2026-0291 yet. Limit exposure of the affected software until one is available.

## Is RUSTSEC-2026-0291 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: RUSTSEC-2026-0291 is an use after free vulnerability in owned-alloc, published on 9 Sep 2026. 
Exploitation: There is no known exploitation of RUSTSEC-2026-0291 in the wild and no public exploit code.

Affected packages and fixed versions:
- owned-alloc (crates.io): affected from 0.0.0-0; no fix listed

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

## Sources

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

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