NPM · JULY 2026 · EARLY WARNING

sm-crypto npm Package: Predictable SM2 Key Generation Vulnerability

EARLY WARNING · UNCONFIRMED. This page describes a developing threat that 0Day surfaced from early signals and has not yet independently confirmed. Details may change. Always verify against the primary sources before acting.
GHSA-VH45-F885-3848Severity: HIGH

An early warning has been issued regarding the sm-crypto npm package, which appears to generate SM2 private keys and signing ephemeral scalars using a predictable random number generator (RNG) in Node.js. This makes the keys vulnerable to prediction attacks.

What happened

The sm-crypto npm package version 0.4.0 is under investigation for using a predictable RNG for SM2 key generation. The default RNG implementation reportedly combines Math.random with the wall clock, which can lead to predictable outputs. This vulnerability could allow attackers to potentially predict SM2 private keys and ephemeral scalars generated by the package.

Professional software engineers are advised to avoid using the sm-crypto package for generating SM2 keys until a fix is released. For more detailed information, consult the primary source at [GHSA-vh45-f885-3848](https://github.com/advisories/GHSA-vh45-f885-3848).

As this is an early warning, the full extent of the vulnerability and any potential exploits are still under investigation. Engineers should stay updated with the latest advisories and security patches.

How 0Day mitigates this

MATCHED TO YOUR ACTUAL DEPENDENCY GRAPH0Day matches every incoming threat signal against your GitHub organization’s full dependency graph, including transitive dependencies. If sm-crypto is anywhere in your dependency tree, the engineers who own the affected repositories get a push alert the moment it is flagged — no manual audit to remember to run.

Read how this differs from waiting on a scanner to catch a known advisory, or see the exact, read-only access 0Day needs to do this for an organization.

Join the 0Day waitlist →

← Back to all threats