CVE-2026-4598
Received Received - Intake
Infinite Loop Vulnerability in jsrsasign bnModInverse Function

Publication date: 2026-03-23

Last updated on: 2026-03-23

Assigner: Snyk

Description
Versions of the package jsrsasign before 11.1.1 are vulnerable to Infinite loop via the bnModInverse function in ext/jsbn2.js when the BigInteger.modInverse implementation receives zero or negative inputs, allowing an attacker to hang the process permanently by supplying such crafted values (e.g., modInverse(0, m) or modInverse(-1, m)).
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-03-23
Last Modified
2026-03-23
Generated
2026-05-27
AI Q&A
2026-03-23
EPSS Evaluated
2026-05-25
NVD
EUVD
Affected Vendors & Products
Showing 1 associated CPE
Vendor Product Version / Range
jsrsasign_project jsrsasign to 11.1.1 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-835 The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

CVE-2026-4598 is an infinite loop vulnerability in the jsrsasign JavaScript cryptographic library, specifically in the bnModInverse function within ext/jsbn2.js. The issue occurs when the BigInteger.modInverse implementation receives zero or negative inputs, such as modInverse(0, m) or modInverse(-1, m). Under these conditions, the function enters an infinite loop, causing the process to hang indefinitely.

The root cause is that the bnModInverse method assumes its input is a positive integer coprime to the modulus, without validating or normalizing the input. Zero input prevents the loop exit condition from being met, while negative inputs are not reduced modulo the modulus, causing oscillation and non-termination in the binary extended Euclidean algorithm.

This vulnerability is classified under CWE-835 (Loop with Unreachable Exit Condition) and has a high severity rating with a CVSS 3.1 base score of 8.7.


How can this vulnerability impact me? :

This vulnerability allows an attacker to cause a denial-of-service (DoS) condition by supplying crafted zero or negative inputs to the modInverse function, which causes the process to hang indefinitely.

Any application using jsrsasign where untrusted input can reach the modInverse function is vulnerable to permanent process hangs, significantly impacting system availability.

  • RSA blinding operations that use random blinding factors potentially reduced to zero.
  • Elliptic Curve (EC) point operations where zero z-coordinates can trigger modInverse calls.
  • DSA/ECDSA signature verification when the signature component s equals zero.

While confidentiality and integrity are not affected, the availability of the affected system is severely impacted, making it vulnerable to network-based attacks without requiring privileges or user interaction.


How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

I don't know


How can this vulnerability be detected on my network or system? Can you suggest some commands?

[{'type': 'paragraph', 'content': "This vulnerability can be detected by testing if the jsrsasign library's BigInteger.modInverse function hangs or enters an infinite loop when called with zero or negative inputs."}, {'type': 'paragraph', 'content': 'A practical detection method is to run test scripts that invoke modInverse with crafted inputs such as modInverse(0, m) or modInverse(-1, m) and observe if the process hangs indefinitely.'}, {'type': 'paragraph', 'content': 'For example, a Node.js script can be used to spawn child processes that call modInverse with these crafted inputs and check if they hang beyond a timeout (e.g., 3000ms), indicating the vulnerability.'}, {'type': 'paragraph', 'content': 'No specific network commands are provided, but monitoring for processes that hang or become unresponsive when handling cryptographic operations involving jsrsasign may help detect exploitation attempts.'}] [2]


What immediate steps should I take to mitigate this vulnerability?

The immediate and recommended mitigation is to upgrade the jsrsasign library to version 11.1.1 or later, where the vulnerability has been fixed.

The fix includes input normalization and validation in the bnModInverse function to prevent infinite loops caused by zero or negative inputs.

If upgrading is not immediately possible, as a partial mitigation, ensure that inputs to modInverse are validated to reject zero or negative values before calling the function.

Additionally, review and update any cryptographic code paths that might pass untrusted or unchecked inputs to modInverse, such as RSA blinding, EC point operations, or DSA/ECDSA signature verification.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart