# RUSTSEC-2026-0308: Use-after-free in interned values and cached function results

> Use-after-free in Salsa library allows attackers to expose memory or execute code via stale cached values.

- **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:** 24 Sep 2026
- **Also known as:** GHSA-xc3w-55vh-cw3w

## What is RUSTSEC-2026-0308?

RUSTSEC-2026-0308 is an use after free vulnerability in salsa, published on 24 Sep 2026. 

### Official description

When an application reads an interned value's fields or uses that value as an input to a tracked function, Salsa must ensure that reusable storage has been validated for the current database revision. This prevents the value's fields and associated cached function results from being freed while in use. Affected versions checked this invariant only with `debug_assert!` when reading fields, and did not check it when using an interned value to access a tracked function's cached result.

Bugs in Salsa's dependency tracking, or an application-provided `Eq` implementation that incorrectly treats a changed query result as unchanged, can cause Salsa to reuse cached results containing stale interned values. If the application accesses these values and then interns additional values, Salsa can free the old fields or cached function results while references to them are still in use. This causes use-after-free through safe Rust APIs. Depending on the consuming application, attacker-controlled input may expose process memory or permit arbitrary code execution.

The fix asserts that an interned value's reusable storage has been validated for the current database revision before allowing an application to read its fields or access a tracked function's cached result using that value as input. If the assertion fails, Salsa panics before returning references to storage that could be freed while in use.

Salsa 0.28.5 and newer address this vulnerability. Dependent applications should update Salsa and rebuild.

Applications that disable garbage collection for all explicitly declared interned structs using `#[salsa::interned(revisions = usize::MAX)]` and do not use implicitly interned query arguments are not affected by this vulnerability.

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

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `salsa` | crates.io | From 0.23.0 | 0.28.5 |

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

Upgrade salsa to 0.28.5 or later.

## Is RUSTSEC-2026-0308 being exploited?

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

## Fix prompt for AI coding agents

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

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

Affected packages and fixed versions:
- salsa (crates.io): affected from 0.23.0; fixed in 0.28.5

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

## Sources

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

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