Skip to main content

sm-crypto EUVDEUVD-2026-58182

| CVE-2026-73567 CRITICAL
Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG) (CWE-338)
2026-08-13 GitHub_M GHSA-vh45-f885-3848
9.1
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Observe process Math.random() outputs
  2. Delivery
    Recover V8 xorshift128+ state
  3. Exploit
    Estimate key-generation timestamp
  4. Execution
    Reconstruct ARC4 seed
  5. Persist
    Recover SM2 private key and ephemeral scalars
  6. Impact
    Forge signatures or decrypt data

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A04:2025 - Cryptographic Failures
ASVS 5.0
V11 - Cryptography Cryptographic PRNG selection
Exploitation Conditions

Exploitation requires the target to run sm-crypto (< 0.5.0) in Node.js and use the default no-argument sm2.generateKeyPairHex() key-generation and signing path, which routes through jsbn's SecureRandom fallback; no caller-selected parameter or non-default configuration is needed to trigger the weak RNG. What LIMITS exploitation is the attacker's need to (1) observe several Math.random() outputs originating from the same V8 process/instance so the xorshift128+ state can be recovered, and (2) estimate the wall-clock key-generation time to reconstruct the ARC4 seed. The flaw does not apply to browser deployments where window.crypto.getRandomValues is available (the CSPRNG branch is taken), nor to callers that already pass their own secure random value into generateKeyPairHex; it is specific to the Node.js runtime where window is undefined.

Impact

The published CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N, base 9.1) treats this as a network, low-complexity, unauthenticated confidentiality-and-integrity break, which likely overstates the practical attack conditions: exploitation is not a single crafted request but a cryptanalytic recovery requiring the attacker to observe several Math.random() outputs from the same V8 process and estimate the key-generation timestamp. That precondition - visibility into the target process's Math.random() stream - pushes real-world complexity toward high, so an independent assessment lands nearer CVSS ~7.4 (AC:H) than 9.1. Countering that, the impact is severe and permanent (recovered SM2 private keys and forgeable signatures cannot be remediated after the fact), it is the default no-argument code path requiring no special caller configuration, and working PoC code exists, all of which raise priority. No EPSS score, KEV entry, or SSVC decision data was provided; the absence of KEV combined with a demonstrated-but-not-yet-weaponized PoC suggests a serious latent exposure rather than confirmed mass exploitation. Teams generating long-lived SM2 keys on vulnerable versions should treat this as high priority, and should confirm the missing EPSS/SSVC signals against vendor sources before final ranking.

Exploit ScenarioDerived

A service uses sm-crypto in Node.js to mint SM2 key pairs and separately exposes values derived from Math.random() to clients (for example request IDs, tokens, or timing jitter). An attacker collects a handful of those outputs to reconstruct the V8 xorshift128+ state, combines it with an estimate of the key-generation timestamp to rebuild the ARC4 seed, then recovers the victim's SM2 private key and predicts signing ephemeral scalars - enabling decryption and signature forgery. Public PoC code demonstrating this against the real sm-crypto@0.4.0 + jsbn@1.1.0 packages exists.

Act Now Prioritize within 24-48h. Why: CRITICAL severity + public POC available.
Patch available 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Aug 13, 2026

Predictable SM2 private-key and signing-nonce generation in the sm-crypto npm library (versions prior to 0.5.0) lets an attacker recover keys generated in Node.js. Because jsbn's SecureRandom checks window.crypto rather than Node's globalThis.crypto, the default sm2.generateKeyPairHex() falls back to seeding an ARC4 stream from Math.random() and the wall clock, so an adversary who observes a few Math.random() outputs and estimates the generation time can reconstruct private keys and forge signatures. Publicly available exploit code exists (reproduced end-to-end against the real npm packages), but no public exploit is identified as being used in active attacks and there is no CISA KEV listing.

RemediationAI

Upgrade to the fixed release: Vendor-released patch: sm-crypto 0.5.0, which changes SM2 random-number generation to use Node's crypto module (per the CHANGELOG and commit 1f9bd7bd160c24efd9c26c8f7fda997c68c823d0). After upgrading, treat any SM2 key pair or signing key previously generated by a vulnerable version in Node.js as compromised: regenerate those keys and re-issue or re-sign anything depending on them, since the upgrade does not retroactively secure already-generated secrets. If an immediate upgrade is not possible, the specific compensating control is to stop using the default no-argument sm2.generateKeyPairHex() path and instead supply your own cryptographically secure random value - generate the private key with Node's crypto.randomBytes/webcrypto and pass it into generateKeyPairHex rather than relying on the module-wide jsbn SecureRandom; the trade-off is code changes at every key- and signature-generation call site plus review to ensure no ephemeral signing scalars still flow through the weak RNG. Refer to the advisory at https://github.com/JuneAndGreen/sm-crypto/security/advisories/GHSA-vh45-f885-3848 and the patch commit https://github.com/JuneAndGreen/sm-crypto/commit/1f9bd7bd160c24efd9c26c8f7fda997c68c823d0.

Affected VersionsENISA

sm-crypto < 0.5.0

Affected Packages

npm sm-crypto fix: 0.5.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

sm-crypto implements the Chinese national cryptographic algorithms SM2 (elliptic-curve), SM3 (hash), and SM4 (block cipher) in JavaScript. The flaw is a classic CWE-338 (use of a cryptographically weak PRNG) issue rooted in a dependency mismatch: src/sm2/utils.js instantiates a single module-wide SecureRandom from jsbn@1.1.0, and jsbn's RNG initialization branches on typeof window !== 'undefined' && window.crypto. In Node.js - sm-crypto's primary runtime - window is undefined, so the CSPRNG branch (window.crypto.getRandomValues) is skipped and the ARC4 seed pool is instead filled from Math.floor(65536*Math.random()) plus new Date().getTime() via rng_seed_time(). V8's Math.random() is a xorshift128+ generator whose internal state is recoverable from a small number of consecutive outputs, and the millisecond timestamp is estimable, so the entire seed - and every SM2 private key and ephemeral signing scalar derived from it - becomes reconstructable. Node does expose Web Crypto as globalThis.crypto, but because jsbn only probes window.crypto the secure path is never taken. The affected package is identified by cpe:2.3:a:juneandgreen:sm-crypto.

Know when Node.js gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 9.1 CRITICAL
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
vuln.today AI 7.4 HIGH

AC:H because the attacker must observe same-process Math.random() outputs and estimate generation time; PR:N/UI:N as no auth or victim action is needed; C:H/I:H for key recovery and signature forgery, A:N.

3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
4.0 AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

Lifecycle Timeline

2
Patch available
Aug 13, 2026 - 19:04 EUVD
CVE Published
Aug 13, 2026 - 17:40 cve.org
CRITICAL 9.1

DescriptionCVE.org

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.

Executive ViewAI

Why It Matters

The sm-crypto npm library (versions prior to 0.5.0) contains a critical cryptographic flaw enabling attackers to recover private keys and forge SM2 digital signatures; publicly available exploit code exists. Organizations using this library in Node.js applications face immediate risk of unauthorized access and data integrity compromise. Affected systems require urgent remediation.

Business Impact: Severe
Compensating Controls

No vendor-released patch identified at time of analysis. Interim measures include discontinuing sm-crypto use for SM2 operations, migrating to alternative audited cryptographic libraries, restricting key generation to isolated systems, implementing compensating controls for signature verification, and monitoring for exploitation attempts.

Threat Intelligence Overview

EPSS Score
0.3%
Top 75% exploitable
Prevalence
Medium
common JS library for Chinese SM2/SM3/SM4 crypto in Node apps
Threat Intel
1
1 sources
Exploit
POC
Public exploit code exists
Social Media
1
Sightings
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA CIRCL GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC Yes
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity + public POC available
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Out-of-Cycle
Exploitation
None
System Exposure· derived
Open
Automatable
Yes
Human Impact
Very High
Technical Impact
Total

Priority Score

66
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +46
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

CVE-2025-68613 HIGH POC
8.8 Dec 19

Remote code execution in n8n's workflow expression evaluation system allows an authenticated user with workflow creation

CVE-2024-41713 CRITICAL POC
9.1 Oct 21

A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could

CVE-2024-55591 CRITICAL POC
9.8 Jan 14

FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote

CVE-2023-44487 HIGH POC
7.5 Oct 10

Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour

CVE-2014-7205 CRITICAL POC
10.0 Oct 08

Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t

CVE-2025-59528 CRITICAL POC
10.0 Sep 22

Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete

CVE-2017-14849 HIGH POC
7.5 Sep 28

Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc

CVE-2017-5941 CRITICAL POC
9.8 Feb 09

An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2014-3744 HIGH POC
7.5 Oct 23

Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi

CVE-2014-9566 HIGH POC
7.5 Mar 10

Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin

CVE-2024-35286 CRITICAL POC
9.8 Oct 21

A vulnerability in NuPoint Messenger (NPM) of Mitel MiCollab through 9.8.0.33 allows an unauthenticated attacker to cond

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy