CVE-2021-41117

HIGHNVD 8.78.7
EchelonGraph scoreMEDIUM confidence

This high-severity CVE scores 8.7 under NVD CVSS v3. EPSS exploit probability: 0.4%, top 37% of all CVEs by exploit prediction. GitHub Security Advisory data not yet ingested — confidence will rise once GHSA publishes (typical lag: hours to days for open-source ecosystem CVEs; never for infrastructure-only CVEs).

Triggered by: NVD CVSS baseline
Sources: epss, nvd
Elevated
8.7
EchelonGraph verdictPlan a fixSerious severity, but no confirmed exploitation yet.
  • High severity, but no confirmed exploitation yet
CISA-KEV: Not listedEPSS: 3%CVSS: 8.7Exploit: NoneExposed: 0

No vendor fix yet — apply a workaround or compensating control (WAF / firewall / segmentation) and watch for a patch.

keypair is a a RSA PEM key generator written in javascript. keypair implements a lot of cryptographic primitives on its own or by borrowing from other libraries where possible, including node-forge. An issue was discovered where this library was generating identical RSA keys used in SSH. This would mean that the library is generating identical P, Q (and thus N) values which, in practical terms, is impossible with RSA-2048 keys. Generating identical values, repeatedly, usually indicates an issue with poor random number generation, or, poor handling of CSPRNG output. Issue 1: Poor random number generation (GHSL-2021-1012). The library does not rely entirely on a platform provided CSPRNG, rather, it uses it's own counter-based CMAC approach. Where things go wrong is seeding the CMAC implementation with "true" random data in the function defaultSeedFile. In order to seed the AES-CMAC generator, the library will take two different approaches depending on the JavaScript execution environment. In a browser, the library will use window.crypto.getRandomValues(). However, in a nodeJS execution environment, the window object is not defined, so it goes down a much less secure solution, also of which has a bug in it. It does look like the library tries to use node's CSPRNG when possible unfortunately, it looks like the crypto object is null because a variable was declared with the same name, and set to null. So the node CSPRNG path is never taken. However, when window.crypto.getRandomValues() is not available, a Lehmer LCG random number generator is used to seed the CMAC counter, and the LCG is seeded with Math.random. While this is poor and would likely qualify in a security bug in itself, it does not explain the extreme frequency in which duplicate keys occur. The main flaw: The output from the Lehmer LCG is encoded incorrectly. The specific [line][https://github.com/juliangruber/keypair/blob/87c62f255baa12c1ec4f98a91600f82af80be6db/index.js#L1008] with the flaw is: b.putByte(String.fromCharCode(next & 0xFF)) The definition of putByte is util.ByteBuffer.prototype.putByte = function(b) {this.data += String.fromCharCode(b);};. Simplified, this is String.fromCharCode(String.fromCharCode(next & 0xFF)). The double String.fromCharCode is almost certainly unintentional and the source of weak seeding. Unfortunately, this does not result in an error. Rather, it results most of the buffer containing zeros. Since we are masking with 0xFF, we can determine that 97% of the output from the LCG are converted to zeros. The only outputs that result in meaningful values are outputs 48 through 57, inclusive. The impact is that each byte in the RNG seed has a 97% chance of being 0 due to incorrect conversion. When it is not, the bytes are 0 through 9. In summary, there are three immediate concerns: 1. The library has an insecure random number fallback path. Ideally the library would require a strong CSPRNG instead of attempting to use a LCG and Math.random. 2. The library does not correctly use a strong random number generator when run in NodeJS, even though a strong CSPRNG is available. 3. The fallback path has an issue in the implementation where a majority of the seed data is going to effectively be zero. Due to the poor random number generation, keypair generates RSA keys that are relatively easy to guess. This could enable an attacker to decrypt confidential messages or gain authorized access to an account belonging to the victim.

CVSS v3
8.7
EG Score
8.7(medium)
EPSS
85.8%
KEV
Not listed

Published

October 11, 2021

Last Modified

November 21, 2024

Affected Packages

(1 across 1 ecosystem)
npm(1)
PackageVulnerable rangeFixed inDependents
keypair1.0.4

Weakness Classification(1)

MITRE Common Weakness Enumeration — the root-cause categories this CVE belongs to.

Data Freshness Timeline

(refreshed 10× in last 7d / 48× in last 30d)

Each row is a source pipeline that fetched or updated this CVE on that date, with what changed. For example, "NVD update" means NVD published or revised its analysis for this CVE; "MITRE cvelistV5" means we ingested or refreshed it from the CNA feed. Most recent first.

  1. 2026-07-12 05:44 UTCEPSS rescore
  2. 2026-07-11 08:25 UTCEPSS rescore
  3. 2026-07-11 08:25 UTCEPSS rescore
  4. 2026-07-09 19:07 UTCEPSS rescore
  5. 2026-07-08 15:12 UTCEPSS rescore
  6. 2026-07-07 13:43 UTCEPSS rescore
  7. 2026-07-06 16:25 UTCEPSS rescore
  8. 2026-07-06 16:25 UTCEPSS rescore
  9. 2026-07-06 02:21 UTCEPSS rescore
  10. 2026-07-06 02:21 UTCEPSS rescore
  11. 2026-07-05 02:28 UTCEPSS rescore
  12. 2026-07-05 02:28 UTCEPSS rescore
  13. 2026-07-04 06:29 UTCEPSS rescore
  14. 2026-07-04 06:29 UTCEPSS rescore
  15. 2026-07-02 16:57 UTCEPSS rescore
  16. 2026-07-01 15:04 UTCEPSS rescore
  17. 2026-06-30 23:20 UTCEPSS rescore
  18. 2026-06-30 23:20 UTCEPSS rescore
  19. 2026-06-30 11:00 UTCOSV refresh
  20. 2026-06-28 04:54 UTCEPSS rescore
  21. 2026-06-28 04:54 UTCEPSS rescore
  22. 2026-06-27 03:06 UTCEPSS rescore
  23. 2026-06-27 03:06 UTCEPSS rescore
  24. 2026-06-25 13:48 UTCEPSS rescore
  25. 2026-06-25 13:48 UTCEPSS rescore
Show 58 more
  1. 2026-06-24 14:03 UTCEPSS rescore
  2. 2026-06-24 14:03 UTCEPSS rescore
  3. 2026-06-23 21:31 UTCEPSS rescore
  4. 2026-06-23 21:31 UTCEPSS rescore
  5. 2026-06-22 14:24 UTCEPSS rescore
  6. 2026-06-21 01:58 UTCEPSS rescore
  7. 2026-06-21 01:58 UTCEPSS rescore
  8. 2026-06-19 19:24 UTCEPSS rescore
  9. 2026-06-19 19:24 UTCEPSS rescore
  10. 2026-06-18 17:51 UTCEPSS rescore
  11. 2026-06-18 17:51 UTCEPSS rescore
  12. 2026-06-17 17:51 UTCEPSS rescore
  13. 2026-06-17 17:51 UTCEPSS rescore
  14. 2026-06-17 17:51 UTCEPSS rescore
  15. 2026-06-16 17:51 UTCEPSS rescore
  16. 2026-06-16 17:51 UTCEPSS rescore
  17. 2026-06-15 17:46 UTCEPSS rescore
  18. 2026-06-14 23:15 UTCEPSS rescore
  19. 2026-06-14 23:15 UTCEPSS rescore
  20. 2026-06-13 22:58 UTCEPSS rescore
  21. 2026-06-13 22:58 UTCEPSS rescore
  22. 2026-06-12 23:10 UTCEPSS rescore
  23. 2026-06-12 19:40 UTCOSV refresh
  24. 2026-06-11 13:58 UTCEPSS rescore
  25. 2026-06-11 13:58 UTCEPSS rescore
  26. 2026-06-10 22:16 UTCEPSS rescore
  27. 2026-06-10 22:16 UTCEPSS rescore
  28. 2026-06-10 13:20 UTCEPSS rescore
  29. 2026-06-08 14:15 UTCEPSS rescore
  30. 2026-06-08 14:15 UTCEPSS rescore
  31. 2026-06-07 15:23 UTCEPSS rescore
  32. 2026-06-07 15:23 UTCEPSS rescore
  33. 2026-06-06 13:46 UTCEPSS rescore
  34. 2026-06-06 13:46 UTCEPSS rescore
  35. 2026-06-05 22:45 UTCEPSS rescore
  36. 2026-06-05 06:09 UTCEPSS rescore
  37. 2026-06-05 06:09 UTCEPSS rescore
  38. 2026-06-04 13:10 UTCEPSS rescore
  39. 2026-06-04 13:10 UTCEPSS rescore
  40. 2026-06-02 20:11 UTCEPSS rescore
  41. 2026-06-02 20:11 UTCEPSS rescore
  42. 2026-06-01 13:50 UTCEPSS rescore
  43. 2026-06-01 13:50 UTCEPSS rescore
  44. 2026-05-31 22:29 UTCEPSS rescore
  45. 2026-05-31 22:29 UTCEPSS rescore
  46. 2026-05-31 00:15 UTCEPSS rescore
  47. 2026-05-31 00:15 UTCEPSS rescore
  48. 2026-05-29 13:42 UTCEPSS rescore
  49. 2026-05-28 13:43 UTCEPSS rescore
  50. 2026-05-28 13:43 UTCEPSS rescore
  51. 2026-05-27 13:39 UTCEPSS rescore
  52. 2026-05-27 13:39 UTCEPSS rescore
  53. 2026-05-26 13:42 UTCEPSS rescore
  54. 2026-05-26 13:42 UTCEPSS rescore
  55. 2026-05-26 09:13 UTCEG score recompute
  56. 2026-05-26 07:17 UTCEPSS rescore
  57. 2026-05-26 07:17 UTCEPSS rescore
  58. 2026-05-26 07:17 UTCEPSS rescore

Publicly available exploits

(1 reference)

Working exploit code is in the public domain (1 GitHub PoC). Defenders should treat patch urgency accordingly — public PoCs typically lead to mass-exploitation within 24-72 hours.

  • GitHub PoCbadkeys/keypairvuln
    First seen May 15, 2022

    Private keys generated with vulnerable keypair versions (CVE-2021-41117)

    Open source ↗

Frequently asked(5)

What is CVE-2021-41117?
CVE-2021-41117 is a high vulnerability published on October 11, 2021. keypair is a a RSA PEM key generator written in javascript. keypair implements a lot of cryptographic primitives on its own or by borrowing from other libraries where possible, including node-forge. An issue was discovered where this library was generating identical RSA keys used in SSH. This would…
When was CVE-2021-41117 disclosed?
CVE-2021-41117 was first published in the National Vulnerability Database on October 11, 2021, with the most recent update on November 21, 2024. EchelonGraph re-ingests CVE updates from NVD on a 2-hour cycle, so this page reflects the latest published state.
Is CVE-2021-41117 actively exploited?
CVE-2021-41117 is not currently on CISA's Known Exploited Vulnerabilities catalog. FIRST EPSS estimates a 85.8% percentile likelihood of exploitation in the next 30 days — higher percentiles indicate greater predicted risk.
What is the CVSS score of CVE-2021-41117?
CVE-2021-41117 has a CVSS v3 base score of 8.7 (NVD).
How do I remediate CVE-2021-41117?
Patch to the fixed version published by the affected vendor. Where vendor advisories exist for CVE-2021-41117, EchelonGraph cross-links them in the Vendor Advisories panel below — those typically contain the canonical remediation steps, fixed version numbers, and any vendor-specific mitigations.

Dependency Blast Radius

See which npm, PyPI, Go, and Maven packages are affected by CVE-2021-41117

Explore →

Is Your Infrastructure Affected by CVE-2021-41117?

EchelonGraph automatically scans your cloud infrastructure and maps CVE exposure using blast radius analysis.