# GHSA-vgmh-mqm4-8j88: pared Vulnerable to Use After Free in `Parc` and `Prc` Due to Missing Lifetime Constraints

> A use-after-free vulnerability in the pared crate allows attackers to execute arbitrary code or cause denial of service via improper lifetime handling in Arc and Rc projections.

- **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:** 13 Mar 2025
- **Also known as:** RUSTSEC-2025-0016

## What is GHSA-vgmh-mqm4-8j88?

GHSA-vgmh-mqm4-8j88 is an use after free vulnerability in pared, published on 13 Mar 2025. 

### Official description

Affected versions of this crate didn't provide sufficient lifetime constraints to conversion functions from `alloc::sync::Arc` and `alloc::rc::Rc`, which made it possible to create projections of these reference counted pointers. Unlike the original reference counted pointers, these projections could outlive original data's lifetimes.

This projected pointer could cause the original `Arc`'s or `Rc`'s `Drop::drop` to get called at a point where the original data was no longer valid, leading to a potential use after free.

The affected functions were
- `pared::prc::Prc::from_rc`
- `pared::prc::Prc::project`
- `pared::prc::Prc::try_from_rc`
- `pared::sync::Parc::from_arc`
- `pared::sync::Parc::project`
- `pared::sync::Parc::try_from_arc`

This flaw was fixed in [108f540ea8acb6073751a1aa386085c1cdc4fd1e](https://github.com/radekvit/pared/commit/108f540ea8acb6073751a1aa386085c1cdc4fd1e) by requiring that the type stored in the `Arc`s and `Rc`s passed to these functions contain `T: 'static`.

## Which versions are affected by GHSA-vgmh-mqm4-8j88?

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


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

## How do I fix GHSA-vgmh-mqm4-8j88?

Upgrade pared to 0.4.0 or later.

## Is GHSA-vgmh-mqm4-8j88 being exploited?

There is no known exploitation of GHSA-vgmh-mqm4-8j88 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-vgmh-mqm4-8j88 and fix it if it is affected.

What it is: GHSA-vgmh-mqm4-8j88 is an use after free vulnerability in pared, published on 13 Mar 2025. 
Exploitation: There is no known exploitation of GHSA-vgmh-mqm4-8j88 in the wild and no public exploit code.

Affected packages and fixed versions:
- pared (crates.io): affected all versions; fixed in 0.4.0
- pared (crates.io): affected all versions; fixed in 0.4.0
- pared (crates.io): affected from 0.0.0-0; fixed in 0.4.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-vgmh-mqm4-8j88/ (Markdown: https://insights.sbomify.com/GHSA-vgmh-mqm4-8j88/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-vgmh-mqm4-8j88

---
From sbomify Insights: https://insights.sbomify.com/GHSA-vgmh-mqm4-8j88/
Summaries are generated and may contain mistakes; the official description above is the record.
