RUSTSEC-2026-0528: UB can be reached from safe code
Published 2026-11-12 · Updated 2026-11-13
Summary
The ref-swap crate contains unsound variance and missing null checks that can lead to use-after-free and undefined behavior reachable from safe code. All developers using vulnerable versions of the crate should update immediately.
Who is affected
Projects using `ref-swap` are affected due to incorrect variance in `RefSwap` and `OptionRefSwap` alongside unchecked null pointers in `OptionRefSwap::into_inner`. These issues can be triggered from safe code and may potentially result in use-after-free vulnerabilities under specific conditions.
Exploitability
The CVSS vector, base score, and EPSS are not documented. CISA KEV indicates active exploitation is not known.
Remediation
- Update the crates.io ref-swap dependency to version 0.1.3 or later.
How to check your project
- Check Cargo.toml or Cargo.lock for the ref-swap crate within the affected version range (introduced 0.0.0-0, fixed 0.1.3).
Automated analysis of the published advisory data, generated 2026-11-19. Not human-reviewed; verify against the official advisory. How this works.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | Upgrade |
|---|---|---|---|---|
| crates.io | ref-swap |
>= 0.0.0-0, < 0.1.3 | 0.1.3 | cargo update -p ref-swap --precise 0.1.3 |
FAQ
What packages are affected?
The crates.io package ref-swap is affected in versions introduced from 0.0.0-0 up to, but not including, 0.1.3.
How is the vulnerability fixed?
The fix makes `RefSwap` and `OptionRefSwap` invariant and changes `OptionRefSwap::into_inner` to return an option, available in version 0.1.3.
Is my project affected if it compiles with version 0.1.3?
No, if your project still compiles with version 0.1.3, then it is not affected by the unsoundness present in version 0.1.2.
Original advisory description
References
- PACKAGE https://crates.io/crates/ref-swap
- ADVISORY https://rustsec.org/advisories/RUSTSEC-2026-0528.html
- WEB https://github.com/Nitrokey/ref-swap/releases/tag/v0.1.3
Source records: RUSTSEC-2026-0528 (OSV.dev).