CVE-2026-21895
Unknown Unknown - Not Provided

Panic Vulnerability in rsa Crate Private Key Construction

Vulnerability report for CVE-2026-21895, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-01-08

Last updated on: 2026-03-12

Assigner: GitHub, Inc.

Description

The `rsa` crate is an RSA implementation written in rust. Prior to version 0.9.10, when creating a RSA private key from its components, the construction panics instead of returning an error when one of the primes is `1`. Version 0.9.10 fixes the issue.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-01-08
Last Modified
2026-03-12
Generated
2026-07-06
AI Q&A
2026-01-08
EPSS Evaluated
2026-07-05
NVD
EUVD

Affected Vendors & Products

Showing 1 associated CPE
Vendor Product Version / Range
rustcrypto rsa to 0.9.10 (exc)

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-703 The product does not properly anticipate or handle exceptional conditions that rarely occur during normal operation of the product.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

This vulnerability occurs in the RustCrypto rsa crate versions up to 0.9.9, where constructing an RSA private key with a prime factor equal to 1 causes the code to panic (crash) instead of returning an error. The issue arises because the code only checked if primes were less than 1, not equal to 1, leading to divide-by-zero panics during computations. Version 0.9.10 fixes this by rejecting primes less than or equal to 1 and returning an error instead of panicking. [1, 2]

Impact Analysis

This vulnerability can cause unexpected termination (panic) of any program using the rsa crate when an RSA private key is constructed with an invalid prime equal to 1. This can lead to denial of service or instability in applications relying on this library for cryptographic operations. [2, 1]

Detection Guidance

This vulnerability is related to the rsa crate in Rust when constructing an RSA private key with a prime equal to 1, causing a panic. Detection involves checking if your system or application uses rsa crate versions up to 0.9.9. There are no specific network detection commands provided. To detect vulnerable versions, you can check your Rust project's dependencies with commands like `cargo tree | grep rsa` to see the rsa crate version. Additionally, reviewing logs for unexpected panics related to RSA key construction may help identify exploitation attempts. [2]

Mitigation Strategies

The immediate mitigation step is to upgrade the rsa crate to version 0.9.10 or later, where the issue is fixed by proper validation rejecting primes less than or equal to 1 and returning an error instead of panicking. Avoid using vulnerable versions (up to 0.9.9) in your projects. Additionally, review your RSA key generation and loading code to ensure it handles errors correctly and does not use invalid prime values. [1, 2]

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-21895. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart