# CVE-2026-22698: RustCrypto SM2-PKE has 32-bit Biased Nonce Vulnerability

> A nonce generation flaw in RustCrypto's SM2 encryption allows attackers to recover private keys and decrypt data due to insufficient entropy.

- **Severity:** High 8.7 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 10 Jan 2026
- **Updated:** 12 Jan 2026
- **Also known as:** GHSA-w3g8-fp6j-wvqw

## What is CVE-2026-22698?

CVE-2026-22698 is a high-severity vulnerability in RustCrypto elliptic-curves, published on 10 Jan 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

RustCrypto: Elliptic Curves is general purpose Elliptic Curve Cryptography (ECC) support, including types and traits for representing various elliptic curve forms, scalars, points, and public/secret keys composed thereof. In versions 0.14.0-pre.0 and 0.14.0-rc.0, a  critical vulnerability exists in the SM2 Public Key Encryption (PKE) implementation where the ephemeral nonce k is generated with severely reduced entropy. A unit mismatch error causes the nonce generation function to request only 32 bits of randomness instead of the expected 256 bits. This reduces the security of the encryption from a 128-bit level to a trivial 16-bit level, allowing a practical attack to recover the nonce k and decrypt any ciphertext given only the public key and ciphertext. This issue has been patched via commit e4f7778.

Weakness: CWE-331 (Insufficient Entropy)

## Which versions are affected by CVE-2026-22698?

2 open source packages ship an affected version, including sm2. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `sm2` | crates.io | From 0.14.0-pre.0 to 0.14.0-rc.4 | None |
| `sm2` | crates.io | From 0.14.0-pre.0 to 0.14.0-rc.4 | None |

Products: Rustcrypto Sm2 Elliptic Curve.

## How do I fix CVE-2026-22698?

No fix has been published for CVE-2026-22698 yet. Limit exposure of the affected software until one is available.

## Is CVE-2026-22698 being exploited?

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

## Other vulnerabilities in RustCrypto elliptic-curves

- [CVE-2026-22699](https://insights.sbomify.com/CVE-2026-22699/): RustCrypto SM2-PKE has Unchecked AffinePoint Decoding (unwrap) in decrypt() (high 7.5)
- [CVE-2026-22700](https://insights.sbomify.com/CVE-2026-22700/): RustCrypto Has Insufficient Length Validation in decrypt() in SM2-PKE (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-22698 and fix it if it is affected.

What it is: CVE-2026-22698 is a high-severity vulnerability in RustCrypto elliptic-curves, published on 10 Jan 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-22698 in the wild and no public exploit code.

Affected packages and fixed versions:
- sm2 (crates.io): affected from 0.14.0-pre.0 up to 0.14.0-rc.4; no fix listed
- sm2 (crates.io): affected from 0.14.0-pre.0 up to 0.14.0-rc.4; 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/CVE-2026-22698/ (Markdown: https://insights.sbomify.com/CVE-2026-22698/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-22698
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-22698
- OSV: https://osv.dev/vulnerability/CVE-2026-22698

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