chore(deps): update dependency node-jose to v2.2.0 [security]#57
Open
renovate[bot] wants to merge 1 commit intomasterfrom
Open
chore(deps): update dependency node-jose to v2.2.0 [security]#57renovate[bot] wants to merge 1 commit intomasterfrom
renovate[bot] wants to merge 1 commit intomasterfrom
Conversation
282a665 to
2ed4a24
Compare
2ed4a24 to
548c663
Compare
548c663 to
6ead862
Compare
6ead862 to
1572a33
Compare
1572a33 to
52c51d5
Compare
52c51d5 to
c0c880a
Compare
c0c880a to
f9e3224
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
2.0.0->2.2.0GitHub Vulnerability Alerts
CVE-2023-25653
Description
When using the non-default "fallback" crypto back-end, ECC operations in
node-josecan 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-joseusually relies on an external cryptographic library for the underlying cryptographic primitives that JOSE operations require. When WebCrypto or the Nodecryptomodule are available, they are used. When neither of these libraries is available,node-joseincludes its own "fallback" implementations of some algorithms based onnode-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 alias of the functionpointFpGetX()inlib/deps/ecc/math.js.Computing the X coordinate from the form in which the point is stored requires computing the modular inverse of the Z coordinate, using the
modInversefunction from thejsbnlibrary (e.g.,this.z.modInverse(this.curve.p)). The output of this function call is multiplied by another value before being reduced with thebarrettReduce()function.The root cause of this issue is that the
jsbnmodInversefunction sometimes returns negative results. These results are correct in that they are equivalent mod the relevant modulus, but can be problematic for functions that expect modular operations to always return positive results (in the range[0, p), wherepis the modulus).In particular, while the Barrett reduction algorithm in general can handle negative inputs, the implementation in
node-joseexplicitly does not. Therefore, while the negative value that is returned bymodInverse()is mathematically correct, it leads to an error inbarrettReduce()causing an infinite loop which may result in a Denial of Service condition.For a given prime modulus, we estimate that roughly one in every
2^20inputs produce a negativemodInverse(). This estimate was validated with exhaustive testing on small primes (<30 bits) and randomized testing with regard to the P-256 prime.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
cryptomodule is available.The following elliptic curve algorithms are impacted by this issue (all in
lib/deps/ecc/index.js):exports.generateKeyPair)ECPrivateKey.prototype.toPublicKey)ECPrivateKey.prototype.sign)ECPublicKey.prototype.verify)ECPrivateKey.prototype.computeSecret)In the first three cases, the points being evaluated are generated randomly, so an attack could only arise due to a bad value being randomly selected (as noted above, with probability roughly
2^{-20}). In the latter two cases, the points being evaluated are provided from outside the library, and thus potentially by attackers.Patches
Has the problem been patched? What versions should users upgrade to?
Workarounds
Since this issue is only present in the "fallback" crypto implementation, it can be avoided by ensuring that either WebCrypto or the Node
cryptomodule is available in the JS environment wherenode-joseis being run.References
For more information
If you have any questions or comments about this advisory:
Credits
Release Notes
cisco/node-jose (node-jose)
v2.2.0Compare Source
v2.1.1Compare Source
v2.1.0Compare Source
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.