# GHSA-rhfx-m35p-ff5j: `IterMut` violates Stacked Borrows by invalidating internal pointer

> A soundness bug in the Rust HashMap iterator allows memory corruption via Stacked Borrows violations, potentially leading to crashes or arbitrary 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:** 7 Jan 2026
- **Also known as:** RUSTSEC-2026-0002

## What is GHSA-rhfx-m35p-ff5j?

GHSA-rhfx-m35p-ff5j is a memory corruption vulnerability in lru, published on 7 Jan 2026. 

### Official description

Affected versions of this crate contain a soundness issue in the `IterMut` iterator implementation. The `IterMut::next` and `IterMut::next_back` methods temporarily create an exclusive reference to the key when dereferencing the internal node pointer.

This invalidates the shared pointer held by the internal `HashMap`, violating Stacked Borrows rules.

## Which versions are affected by GHSA-rhfx-m35p-ff5j?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `lru` | crates.io | From 0.9.0 | 0.16.3 |
| `lru` | crates.io | From 0.9.0 | 0.16.3 |
| `lru` | crates.io | From 0.9.0 | 0.16.3 |

## How do I fix GHSA-rhfx-m35p-ff5j?

Upgrade lru to 0.16.3 or later.

## Is GHSA-rhfx-m35p-ff5j being exploited?

There is no known exploitation of GHSA-rhfx-m35p-ff5j in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-rhfx-m35p-ff5j and fix it if it is affected.

What it is: GHSA-rhfx-m35p-ff5j is a memory corruption vulnerability in lru, published on 7 Jan 2026. 
Exploitation: There is no known exploitation of GHSA-rhfx-m35p-ff5j in the wild and no public exploit code.

Affected packages and fixed versions:
- lru (crates.io): affected from 0.9.0; fixed in 0.16.3
- lru (crates.io): affected from 0.9.0; fixed in 0.16.3
- lru (crates.io): affected from 0.9.0; fixed in 0.16.3

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-rhfx-m35p-ff5j/ (Markdown: https://insights.sbomify.com/GHSA-rhfx-m35p-ff5j/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-rhfx-m35p-ff5j

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