Headline
CVE-2023-25653: Merge pull request from GHSA-5h4j-qrvg-9xhw · cisco/node-jose@901d915
node-jose is a JavaScript implementation of the JSON Object Signing and Encryption (JOSE) for web browsers and node.js-based servers. Prior to version 2.2.0, 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. The issue has been patched in version 2.2.0. 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.
@@ -0,0 +1,29 @@
/*!
*
* Copyright © 2015 Cisco Systems, Inc. See LICENSE file.
*/
"use strict";
var assert = require(“chai”).assert;
const CURVES = require(‘…/…/lib/deps/ecc/curves.js’);
const BigInteger = require(‘…/…/lib/deps/forge’).jsbn.BigInteger;
describe("ecc/positive", function() {
const negativeModInverseCases = [
'101067240514044546216936289506154965497874315269115226505131909313278720169941’,
'47260992668897782856940293132731814279826643476197468731642996160637470667669’,
]
const p = CURVES[“P-256”].curve.p;
const runner = () => {
for (const kStr of negativeModInverseCases) {
const k = new BigInteger(kStr);
const kinv = k.modInverse§;
assert.isAtLeast(kinv.s, 0, “Negative mod inverse”);
}
};
it('normalizes negative modular inverses’, runner);
})
Related news
### Description 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. #### Technical summary The JOSE logic implemented by `node-jose` usually relies on an external cryptographic library for the underlying cryptographic primitives that JOSE operations require. When WebCrypto or the Node `crypto` module are available, they are used. When neither of these libraries is available, `node-jose` includes its own "fallback" implementations of some algorithms based on `node-forge`, in particular implementations of ECDH and ECDSA. A various points, these algorithm implementations need to compute to the X coordinate of an elliptic curve point. This is done by calling the `getX()` method of the object representing the point, which is an a...