# RUSTSEC-2026-0212: Potentially Incorrect Output of Constant-Time Swap/Select on Aarch64

> Incorrect constant-time swap/select results on Aarch64 due to register bit leakage, potentially compromising cryptographic security.

- **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:** 26 May 2026

## What is RUSTSEC-2026-0212?

RUSTSEC-2026-0212 is a vulnerability in libcrux-secrets, published on 26 May 2026. 

### Official description

The implementation of constant-time swap and select on aarch64
platforms used a `cmp` instruction in inline assembly to check whether
an 8-bit wide selector was 0. The `cmp` instruction works on 32-bit
registers, which included the unspecified high 24 bits of the `cmp` operand.
Depending on the execution environment the `cmp`
could thus potentially return an incorrect result because its
operand's high bits in the inline assembly were set when Rust expected them to be unset.
This could lead to incorrect results for the constant-time swap and select
operations built from this comparison.

## Impact
In certain circumstances the swap and select instructions on aarch64
platforms returned incorrect results.

## Mitigation
Starting from version `0.0.6`, the selector is compared using a `tst`
instruction with a mask, which only compares the first 8 bits of the
selector.

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

1 open source package ship an affected version, including libcrux-secrets.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `libcrux-secrets` | crates.io | From 0.0.0-0 | 0.0.6 |

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

Upgrade libcrux-secrets to 0.0.6 or later.

## Is RUSTSEC-2026-0212 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: RUSTSEC-2026-0212 is a vulnerability in libcrux-secrets, published on 26 May 2026. 
Exploitation: There is no known exploitation of RUSTSEC-2026-0212 in the wild and no public exploit code.

Affected packages and fixed versions:
- libcrux-secrets (crates.io): affected from 0.0.0-0; fixed in 0.0.6

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

## Sources

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

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