CyberRota Analysis
AI-GeneratedThe vulnerability affects the sm-crypto library in JavaScript, specifically prior to version 0.5.0, where the sm2.generateKeyPairHex() function relies on a weak random number generator, making it susceptible to key recovery attacks. An attacker could exploit this weakness to reconstruct private keys and forge signatures, posing a critical risk to applications using this library for cryptographic operations. Organizations utilizing sm-crypto for cryptography should prioritize upgrading to version 0.5.0 to mitigate this severe security risk.
Public Exploit Signal
A public exploit, PoC, GitHub repository or Metasploit reference was detected for this CVE.
Note: these links are listed for security research and verification purposes only.
Original NVD Description
sm-crypto provides JavaScript implementations of the Chinese cryptographic algorithms SM2, SM3, and SM4. Prior to 0.5.0, the default no-argument sm2.generateKeyPairHex() path in Node.js uses the module-wide SecureRandom instance in src/sm2/utils.js, supplied by jsbn@1.1.0, which seeds an ARC4 stream from Math.random() and new Date().getTime() because window.crypto.getRandomValues is unavailable even though globalThis.crypto exists. An attacker who can observe the process's Math.random() outputs and estimate the key-generation time can reconstruct the seed, recover generated SM2 private keys, and predict signing ephemeral scalars used to forge signatures. This issue is fixed in version 0.5.0.