# GHSA-x5j2-g63m-f8g4: KyberSlash: division timings depending on secrets

> Timing side-channel in Kyber libraries leaks secret keys via variable division times, allowing attackers to recover private keys.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 1 Dec 2023
- **Also known as:** RUSTSEC-2023-0079

## What is GHSA-x5j2-g63m-f8g4?

GHSA-x5j2-g63m-f8g4 is a vulnerability in pqc_kyber, published on 1 Dec 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Various Kyber software libraries in various environments leak secret information into timing, specifically because

 * these libraries include a line of code that divides a secret numerator by a public denominator,
 * the number of CPU cycles for division in various environments varies depending on the inputs to the division, and
 * this variation appears within the range of numerators used in these libraries.

The KyberSlash pages track which Kyber [libraries](https://kyberslash.cr.yp.to/libraries.html) have this issue, and include a [FAQ](https://kyberslash.cr.yp.to/faq.html) about the issue.

## Author

The KyberSlash pages were written by Daniel J. Bernstein. The FAQ originally said "I", but some people seemed to have trouble finding this authorship statement, so the FAQ now says "Bernstein" instead.

## URL

The permanent link for the KyberSlash pages is [https://kyberslash.cr.yp.to](https://kyberslash.cr.yp.to).

## Mitigation status in `pqc_kyber` crate

The issue has not been resolved in the upstream `pqc_kyber` crate.

A third-party fork that mitigates this attack vector has been published as [`safe_pqc_kyber`](https://crates.io/crates/safe_pqc_kyber).

## Alternatives

The [`ml-kem`](https://crates.io/crates/ml-kem) crate is a maintained
alternative pure Rust implementation of ML-KEM / Kyber.

## Which versions are affected by GHSA-x5j2-g63m-f8g4?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `pqc_kyber` | crates.io | All versions to 0.7.1 | None |
| `pqc_kyber` | crates.io | All versions to 0.7.1 | None |
| `pqc_kyber` | crates.io | From 0.0.0-0 | None |

## How do I fix GHSA-x5j2-g63m-f8g4?

No fix has been published for GHSA-x5j2-g63m-f8g4 yet. Limit exposure of the affected software until one is available.

## Is GHSA-x5j2-g63m-f8g4 being exploited?

There is no known exploitation of GHSA-x5j2-g63m-f8g4 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-x5j2-g63m-f8g4 and fix it if it is affected.

What it is: GHSA-x5j2-g63m-f8g4 is a vulnerability in pqc_kyber, published on 1 Dec 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-x5j2-g63m-f8g4 in the wild and no public exploit code.

Affected packages and fixed versions:
- pqc_kyber (crates.io): affected all versions up to 0.7.1; no fix listed
- pqc_kyber (crates.io): affected all versions up to 0.7.1; no fix listed
- pqc_kyber (crates.io): affected from 0.0.0-0; no fix listed

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-x5j2-g63m-f8g4/ (Markdown: https://insights.sbomify.com/GHSA-x5j2-g63m-f8g4/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-x5j2-g63m-f8g4

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