Executive brief
jsrsasign is a JavaScript cryptography library used to create digital signatures and validate cryptographic keys. A flaw in its random number generation for DSA signatures allows attackers to recover private keys by exploiting biased nonce generation. An attacker with the ability to collect signed messages could extract the secret key used for signing, compromising the confidentiality and integrity of any system relying on this library for cryptographic operations.
Technical details
The vulnerability exists in the getRandomBigIntegerZeroToMax and getRandomBigIntegerMinToMax functions in src/crypto-1.1.js due to incomplete compareTo checks that fail to properly validate the range of generated random values. This results in accepting out-of-range candidates during DSA nonce generation, biasing the nonces toward specific values. An attacker who can observe multiple DSA signatures produced by a vulnerable version can exploit this bias to recover the private key through lattice-based cryptanalysis or related techniques. The vulnerability affects jsrsasign versions 7.0.0 through 11.1.0 and requires no network interaction or authentication; exploitation requires only the ability to obtain signed data. A patch is available in version 11.1.1 and later.
Affected products
- kjur jsrsasign 7.0.0 to 11.1.0
Timeline
- 2026-02-17: disclosed
- 2026-03-23: advisory
- 2026-02-20: patched: Fix merged in PR #647
References
- https://github.com/kjur/jsrsasign/pull/647
- https://github.com/kjur/jsrsasign/commit/ee4b013478366cb16cea9a4bdfb218b6077f83b1
- https://security.snyk.io/vuln/SNYK-JS-JSRSASIGN-15370939
- https://security.snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-15812264
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-4599.json
- https://github.com/kjur/jsrsasign