CVE-2026-40942: Java Rsa Key Length Unchecked

Constructing an RSA public key spec without verifying the key length allows the use of weakly-sized RSA keys, which can be trivially factored by attackers to forge signatures or decrypt sensitive data. Ensure the modulus bit length is checked (e.g., >= 2048) before key creation.

Provally CuratedPublic repositoryMediumMedium confidenceVerifiedApache-2.0Java
greprules fetch cve-2026-40942-java-rsa-key-length-unchecked --engine opengrep

Description

Constructing an RSA public key spec without verifying the key length allows the use of weakly-sized RSA keys, which can be trivially factored by attackers to forge signatures or decrypt sensitive data. Ensure the modulus bit length is checked (e.g., >= 2048) before key creation.