# GHSA-p7mj-xvxg-grff: `out_reference::Out::from_raw` should be `unsafe`

> A soundness bug in the Rust out_reference crate allows writing to invalid memory without unsafe blocks, potentially causing crashes or 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:** 20 Jan 2021
- **Also known as:** RUSTSEC-2021-0152

## What is GHSA-p7mj-xvxg-grff?

GHSA-p7mj-xvxg-grff is a memory corruption vulnerability in out-reference, published on 20 Jan 2021. 

### Official description

`Out::from_raw` in affected versions allows writing a value to invalid memory address without requiring `unsafe`.

The soundness issue has been addressed by making `Out::from_raw` an unsafe function.

## Which versions are affected by GHSA-p7mj-xvxg-grff?

3 open source packages ship an affected version, including out-reference.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `out-reference` | crates.io | From 0.1.0 | 0.2.0 |
| `out-reference` | crates.io | From 0.1.0 | 0.2.0 |
| `out-reference` | crates.io | From 0.1.0 | 0.2.0 |

## How do I fix GHSA-p7mj-xvxg-grff?

Upgrade out-reference to 0.2.0 or later.

## Is GHSA-p7mj-xvxg-grff being exploited?

There is no known exploitation of GHSA-p7mj-xvxg-grff in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-p7mj-xvxg-grff and fix it if it is affected.

What it is: GHSA-p7mj-xvxg-grff is a memory corruption vulnerability in out-reference, published on 20 Jan 2021. 
Exploitation: There is no known exploitation of GHSA-p7mj-xvxg-grff in the wild and no public exploit code.

Affected packages and fixed versions:
- out-reference (crates.io): affected from 0.1.0; fixed in 0.2.0
- out-reference (crates.io): affected from 0.1.0; fixed in 0.2.0
- out-reference (crates.io): affected from 0.1.0; fixed in 0.2.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-p7mj-xvxg-grff/ (Markdown: https://insights.sbomify.com/GHSA-p7mj-xvxg-grff/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-p7mj-xvxg-grff

---
From sbomify Insights: https://insights.sbomify.com/GHSA-p7mj-xvxg-grff/
Summaries are generated and may contain mistakes; the official description above is the record.
