HIGH 7.4

CVE-2026-49440: Deno Prime Number Validation Flaw Allows Composite Numbers to Pass as Prime

Deno's prime number validation function contains a critical flaw that allows composite numbers to be incorrectly identified as prime. When developers use the default settings, the checkPrime() and checkPrimeSync() functions skip cryptographic validation rounds entirely, relying only on a basic divisibility check against small primes. This means a number that is actually the product of two larger primes can be falsely reported as prime, potentially compromising cryptographic operations that depend on genuine prime generation.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.4 HIGH · CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
Weaknesses (CWE)
CWE-325
Affected products
1 configuration(s)
Published / Modified
2026-06-23 / 2026-06-26

NVD description (verbatim)

Deno is a JavaScript, TypeScript, and WebAssembly runtime. Prior to 2.8.1, node:crypto.checkPrime(candidate[, options][, callback]) and crypto.checkPrimeSync(candidate[, options]) ran no Miller-Rabin rounds at all when the caller left options.checks at its default of 0. In that mode, the only test applied to the candidate was trial division by the primes up to 17,863. Any composite whose smallest prime factor exceeds that bound — for example the product of two primes just above it, such as 17,881 × 17,891 — was reported as true ("probably prime"). The same divergence affected the lower-level op_node_check_prime / op_node_check_prime_bytes paths that the polyfill calls into. This vulnerability is fixed in 2.8.1.

2 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

CVE-2026-49440 affects Deno's Node.js crypto polyfill implementation of primality testing. The checkPrime(candidate[, options][, callback]) and checkPrimeSync(candidate[, options]) functions default options.checks to 0, which causes them to bypass all Miller-Rabin probabilistic primality testing rounds. The only validation performed is trial division against primes up to 17,863. Composite numbers whose smallest prime factor exceeds 17,863—such as products of two primes just above that threshold (e.g., 17,881 × 17,891)—are incorrectly classified as probable primes. The same defect exists in the lower-level op_node_check_prime and op_node_check_prime_bytes operational paths. This vulnerability was resolved in Deno 2.8.1.

Business impact

Organizations relying on Deno for cryptographic operations face serious risk if they use the affected checkPrime() functions with default parameters. Weak or composite prime acceptance could lead to generation of cryptographically inadequate keys, potentially allowing attackers to compromise encryption schemes, digital signatures, and other security-critical protocols. The impact is particularly severe in applications performing key generation, TLS/SSL operations, or any cryptographic function that assumes true primality of its inputs.

Affected systems

Deno versions prior to 2.8.1 are affected. This includes all releases that shipped with the vulnerable prime-checking implementation in the node:crypto polyfill. Organizations should verify their exact Deno version and upgrade to 2.8.1 or later.

Exploitability

The vulnerability requires no special privileges or user interaction. An attacker who can influence the selection of prime candidates—or who observes keys generated by vulnerable code—can exploit this flaw remotely. However, successful exploitation requires the application to actually use checkPrime() with default settings; applications that explicitly configure options.checks to a non-zero value are unaffected. The network-accessible nature (AV:N) and lack of interaction requirements (UI:N) increase the attack surface for exposed services.

Remediation

Upgrade to Deno 2.8.1 or later immediately. This patch restores proper Miller-Rabin primality testing. After upgrading, regenerate any cryptographic keys that were generated or validated with affected versions. Verify that your application does not pass default options to checkPrime() or checkPrimeSync() without understanding the security implications; consider explicitly setting options.checks to an appropriate value (e.g., 64 for 2^-128 confidence) in all new code.

Patch guidance

Update Deno to version 2.8.1 or later using your standard dependency management process. Verify the upgrade by checking the runtime version: deno --version should report 2.8.1 or higher. Test your cryptographic operations in a staging environment to confirm no unexpected behavior. Coordinate the upgrade with any key rotation or re-generation of security-critical material, as keys generated under the vulnerable version should be considered suspect.

Detection guidance

Search application logs and source code for calls to checkPrime(), checkPrimeSync(), or any use of the node:crypto module for primality testing. Monitor for Deno version numbers in deployment manifests and container images. If your infrastructure includes cryptographic key generation, audit the generation timestamps against the Deno version deployed at those times. Consider implementing post-upgrade validation of newly generated keys against external primality verification if the keys are used in high-security contexts.

Why prioritize this

This vulnerability scores HIGH (CVSS 7.4) due to its direct impact on cryptographic integrity (High impact on Confidentiality and Integrity), remote exploitability, and the absence of authentication requirements. While the bug requires that an application actually use the affected function with default settings, the consequences of cryptographic compromise are severe. Organizations using Deno for any cryptographic purposes should prioritize this patch.

Risk score, explained

The CVSS 3.1 score of 7.4 reflects a network-accessible vector (AV:N), high complexity attack (AC:H, since exploitation requires influence over prime selection or discovery of weak keys), no privilege requirement (PR:N), and high impact on confidentiality and integrity (C:H, I:H). The absence of availability impact (A:N) prevents a higher score. The 'H' complexity accounts for the attacker's need to either control the prime candidate input or to detect and exploit weakly generated keys in the wild.

Frequently asked questions

If we upgrade to 2.8.1, do we need to regenerate all our existing cryptographic keys?

Yes, if those keys were generated or validated using the vulnerable checkPrime() function with default settings. Keys generated under versions prior to 2.8.1 may be cryptographically weak and should be considered compromised. Regenerate keys after the upgrade and replace them in active use. If you can confirm that your application never called checkPrime() with default options, key regeneration may not be necessary, but this should be verified carefully.

Does this vulnerability affect Deno applications that do not use the crypto module?

No. This vulnerability is specific to the checkPrime() and checkPrimeSync() functions in the node:crypto polyfill. Applications that do not call these functions are unaffected. However, if your application uses any dependency that performs primality testing via Deno's crypto module, you should audit that dependency.

Why did the default value for options.checks cause such a severe problem?

The default of 0 checks disabled the probabilistic Miller-Rabin rounds entirely, leaving only trial division as the primality test. Trial division is sufficient to reject numbers with small factors but cannot detect composites formed by large primes. This is a design flaw: the default should have enforced a minimum level of cryptographic rigor. Deno 2.8.1 addresses this by ensuring sufficient Miller-Rabin rounds are performed.

Is this vulnerability being exploited in the wild?

No active exploitation has been reported or added to the CISA KEV catalog. However, the vulnerability has been public since the CVE publication date, so proactive patching is essential to avoid exposure.

This analysis is provided for informational purposes to support vulnerability assessment and remediation planning. It is not a substitute for thorough testing in your own environment or consultation with the vendor advisory. Verify all patch versions, affected products, and technical details against official Deno release notes and security advisories before implementing changes. The information herein reflects the state of knowledge as of the publication date; later updates to the vulnerability or patches may supersede this guidance. Source: NVD (public-domain), retrieved 2026-07-29. Analysis generated by SEC.co (claude-haiku-4-5).