# GHSA-48m6-wm5p-rr6h: Insufficient covariance check makes self_cell unsound

> Insufficient covariance checks in the self_cell library allow safe code to trigger undefined behavior, potentially leading to memory corruption and code execution.

- **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:** 10 Nov 2023
- **Also known as:** RUSTSEC-2023-0070

## What is GHSA-48m6-wm5p-rr6h?

GHSA-48m6-wm5p-rr6h is a memory corruption vulnerability in self_cell, published on 10 Nov 2023. 

### Official description

All public versions prior to `1.02` used an insufficient check to ensure that
users correctly marked the dependent type as either `covariant` or
`not_covariant`. This allowed users to mark a dependent as covariant even though
its type was not covariant but invariant, for certain invariant types involving
trait object lifetimes. One example for such a dependent type is `type
Dependent<'a> = RefCell<Box<dyn fmt::Display + 'a>>`. Such a type allowed
unsound usage in purely safe user code that leads to undefined behavior. The
patched versions now produce a compile time error if such a type is marked as
`covariant`.

## Which versions are affected by GHSA-48m6-wm5p-rr6h?

5 open source packages ship an affected version, including self_cell.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `self_cell` | crates.io | All versions | 0.10.3 |
| `self_cell` | crates.io | All versions | 0.10.3 |
| `self_cell` | crates.io | From 0.0.0-0 | 0.10.3, 1.0.2 |
| `self_cell` | crates.io | From 1.0.0 | 1.0.2 |
| `self_cell` | crates.io | From 1.0.0 | 1.0.2 |

## How do I fix GHSA-48m6-wm5p-rr6h?

Upgrade self_cell to a fixed version for your release line: 0.10.3 or 1.0.2.

## Is GHSA-48m6-wm5p-rr6h being exploited?

There is no known exploitation of GHSA-48m6-wm5p-rr6h in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-48m6-wm5p-rr6h and fix it if it is affected.

What it is: GHSA-48m6-wm5p-rr6h is a memory corruption vulnerability in self_cell, published on 10 Nov 2023. 
Exploitation: There is no known exploitation of GHSA-48m6-wm5p-rr6h in the wild and no public exploit code.

Affected packages and fixed versions:
- self_cell (crates.io): affected all versions; fixed in 0.10.3
- self_cell (crates.io): affected all versions; fixed in 0.10.3
- self_cell (crates.io): affected from 0.0.0-0; fixed in 0.10.3, 1.0.2
- self_cell (crates.io): affected from 1.0.0; fixed in 1.0.2
- self_cell (crates.io): affected from 1.0.0; fixed in 1.0.2

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-48m6-wm5p-rr6h/ (Markdown: https://insights.sbomify.com/GHSA-48m6-wm5p-rr6h/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-48m6-wm5p-rr6h

---
From sbomify Insights: https://insights.sbomify.com/GHSA-48m6-wm5p-rr6h/
Summaries are generated and may contain mistakes; the official description above is the record.
