All node-jose versions

node-jose @1.1.4

rejected
This version was rejected. It did not pass GreenFlagged's security review and is not served by the registry. The findings and risk dispositions below explain why.
84
Risk Score
Apache-2.0
License
No
Install Scripts
10
Dependencies
33
Dev Dependencies
77.6 KB
Package Size
Published

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

Maintainers

linuxwolfpanva

Keywords

cryptojosejwajwejwkjws

Dependencies (10)

PackageConstraintRegistry Status
long ^4.0.0 auto_approved
uuid ^3.3.3 auto_approved
buffer ^5.5.0 auto_approved
lodash ^4.17.15 auto_approved
process ^0.11.10 auto_approved
base64url ^3.0.1 auto_approved
node-forge ^0.8.5 No greenflagged match
es6-promise ^4.2.8 auto_approved
react-zlib-js ^1.0.4 auto_approved
browserify-zlib ^0.2.0 auto_approved

Dev Dependencies (33)

PackageConstraintRegistry Status
del ^3.0.0 auto_approved
chai ^4.0.1 auto_approved
gulp ^4.0.2 No greenflagged match
karma ^2.0.0 auto_approved
mocha ^5.0.0 auto_approved
yargs ^11.1.0 auto_approved
bowser ^1.9.3 No greenflagged match
webpack ^4.39.3 auto_approved
istanbul ^0.4.0 auto_approved
watchify ^3.11.1 No greenflagged match
gulp-util ^3.0.7 auto_approved
is-safari ^1.0.0 Not imported
gulp-mocha ^5.0.0 No greenflagged match
gulp-eslint ^4.0.1 No greenflagged match
gulp-rename ^1.2.0 auto_approved
gulp-uglify ^3.0.2 No greenflagged match
json-loader ^0.5.4 auto_approved
karma-mocha ^1.3.0 auto_approved
run-sequence ^2.0.0 No greenflagged match
gulp-istanbul ^1.1.1 Not imported
jose-cookbook git+https://github.com/ietf-jose/cookbook.git Not imported
karma-webpack ^3.0.0 auto_approved
karma-coverage ^1.1.1 auto_approved
webpack-stream ^4.0.0 No greenflagged match
karma-ie-launcher ^1.0.0 auto_approved
browserify-istanbul ^3.0.0 Not imported
karma-mocha-reporter ^2.0.0 auto_approved
karma-sauce-launcher ^1.1.0 auto_approved
karma-chrome-launcher ^2.0.0 auto_approved
karma-safari-launcher ^1.0.0 auto_approved
karma-firefox-launcher ^1.2.0 auto_approved
karma-sourcemap-loader ^0.3.7 auto_approved
eslint-plugin-mocha-no-only 0.0.6 No greenflagged match

Transitive Dependency Tree

13 transitive deps max depth 2
  ├─ base64url ^3.0.1 → 3.0.1
  ├─ browserify-zlib ^0.2.0 → 0.2.0
  ├─ buffer ^5.5.0 → 5.7.1
  ├─ es6-promise ^4.2.8 → 4.2.8
  ├─ lodash ^4.17.15 → 4.18.1
  ├─ long ^4.0.0 → 4.0.0
  ├─ node-forge ^0.8.5
  ├─ process ^0.11.10 → 0.11.10
  ├─ react-zlib-js ^1.0.4 → 1.0.5
├─ uuid ^3.3.3 → 3.4.0
  ├─ base64-js ^1.3.1 → 1.5.1
  ├─ ieee754 ^1.1.13 → 1.2.1
  ├─ pako ~1.0.5 → 1.0.11

Risk Dispositions (1 applicable to this version, 0 other)

Accepted rules are downgraded to INFO on future analyses; rejected rules escalate to CRITICAL.

Rule Source Disposition Author Reason
osv:GHSA-5h4j-qrvg-9xhw osv reject AI AI (osv): DoS vulnerability in ECC fallback implementation affects all versions < 2.2.0; fix is available in 2.2.0. Reject generalizes to all versions in the affected range.

SAST Findings (3)

CRITICAL GHSA-5h4j-qrvg-9xhw: Improper calculations in ECC implementation can trigger a Denial-of-Service (DoS) osv

[Always reject] CVSS 7.5 (HIGH) — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H ### 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 alias of the function `pointFpGetX()` in `lib/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 `modInverse` function from the `jsbn` library (e.g., `this.z.modInverse(this.curve.p)`). The output of this function call is multiplied by another value before being reduced with the `barrettReduce()` function. The root cause of this issue is that the `jsbn` `modInverse` function 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)`, where `p` is the modulus). In particular, while the Barrett reduction algorithm in general can handle negative inputs, the implementation in `node-jose` explicitly does not. Therefore, while the negative value that is returned by `modInverse()` is mathematically correct, it leads to an error in `barrettReduce()` 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^20` inputs produce a negative `modInverse()`. 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 `crypto` module is available. The following elliptic curve algorithms are impacted by this issue (all in `lib/deps/ecc/index.js`): - Elliptic curve key generation (`exports.generateKeyPair`) - Converting an elliptic curve private key to a public key (`ECPrivateKey.prototype.toPublicKey`) - ECDSA signing (`ECPrivateKey.prototype.sign`) - ECDSA verification (`ECPublicKey.prototype.verify`) - ECDH key agreement (`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 `crypto` module is available in the JS environment where `node-jose` is being run. ### References - [Barrett reduction on Wikipedia](https://en.wikipedia.org/wiki/Barrett_reduction) ### For more information If you have any questions or comments about this advisory: * Open an issue in [cisco/node-jose](https://github.com/cisco/node-jose/issues) * Email [Cisco open source security](mailto:[email protected]) ### Credits - Research and disclosure: BlackBerry - Fix implementation: [Richard Barnes (@bifurcation)](https://github.com/bifurcation) - Release engineering: [Stephen Augustus (@justaugustus)](https://github.com/justaugustus)

HIGH Publisher changed: panva → linuxwolf (on 2020-03-26) provenance

This version was published by a different npm account than previous versions on 2020-03-26. This could indicate a legitimate maintainer transition or an account compromise.

LOW No provenance attestation provenance

Package was published without Sigstore provenance. Consider requesting the maintainer enable provenance via CI/CD.

Review Summary

Risk score: 84. Findings: 1 critical (+40), 1 high (+25), 1 medium (+10), 3 low (+9), 6 info (+0).

Commit: 2aef93e742ab Browse source

Published to npm: