Infinite loop Affecting node-jose package, versions <2.2.0



    Attack Complexity Low
    Availability High

    Threat Intelligence

    EPSS 0.05% (20th percentile)
Expand this section
7.5 high

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JS-NODEJOSE-3323847
  • published 17 Feb 2023
  • disclosed 17 Feb 2023
  • credit BlackBerry

How to fix?

Upgrade node-jose to version 2.2.0 or higher.


node-jose is a JavaScript implementation of the JSON Object Signing and Encryption (JOSE) for current web browsers and node.js-based servers.

Affected versions of this package are vulnerable to Infinite loop such that when using the non-default "fallback" crypto back-end, ECC operations in node-jose can trigger a Denial-of-Service (DoS) condition, due to a possible infinite loop in an internal calculation. For some ECC operations, this condition is triggered randomly; for others, it can be triggered by malicious input.

Impact: This issue is only present in situations where the "fallback" cryptographic implementation is being used, i.e., situations where neither WebCrypto nor the Node crypto module is available.

The following elliptic curve algorithms are impacted by this issue (all in lib/deps/ecc/index.js):

  1. Elliptic curve key generation (exports.generateKeyPair)

  2. Converting an elliptic curve private key to a public key (ECPrivateKey.prototype.toPublicKey)

  3. ECDSA signing (ECPrivateKey.prototype.sign)

  4. ECDSA verification (ECPublicKey.prototype.verify)

  5. ECDH key agreement (ECPrivateKey.prototype.computeSecret)


Since this issue is only present in the "fallback" crypto implementation, it can be avoided by ensuring that either WebCrypto or the Node crypto module is available in the JS environment where node-jose is being run.