jsonwebtoken@4.0.0

Vulnerabilities

3 via 4 paths

Dependencies

24

Source

npm

Find, fix and prevent vulnerabilities in your code.

Severity
  • 3
Status
  • 3
  • 0
  • 0

high severity

Uninitialized Memory Exposure

  • Vulnerable module: base64url
  • Introduced through: jws@2.0.0

Detailed paths

  • Introduced through: jsonwebtoken@4.0.0 jws@2.0.0 base64url@1.0.6
    Remediation: Upgrade to jsonwebtoken@5.0.0.
  • Introduced through: jsonwebtoken@4.0.0 jws@2.0.0 jwa@1.0.2 base64url@0.0.6
    Remediation: Upgrade to jsonwebtoken@5.0.0.

Overview

base64url Converting to, and from, base64url.

Affected versions of this package are vulnerable to Uninitialized Memory Exposure. An attacker could extract sensitive data from uninitialized memory or may cause a Denial of Service (DoS) by passing in a large number, in setups where typed user input can be passed (e.g. from JSON).

Details

The Buffer class on Node.js is a mutable array of binary data, and can be initialized with a string, array or number.

const buf1 = new Buffer([1,2,3]);
// creates a buffer containing [01, 02, 03]
const buf2 = new Buffer('test');
// creates a buffer containing ASCII bytes [74, 65, 73, 74]
const buf3 = new Buffer(10);
// creates a buffer of length 10

The first two variants simply create a binary representation of the value it received. The last one, however, pre-allocates a buffer of the specified size, making it a useful buffer, especially when reading data from a stream. When using the number constructor of Buffer, it will allocate the memory, but will not fill it with zeros. Instead, the allocated buffer will hold whatever was in memory at the time. If the buffer is not zeroed by using buf.fill(0), it may leak sensitive information like keys, source code, and system info.

Remediation

Upgrade base64url to version 3.0.0 or higher. Note This is vulnerable only for Node <=4

References

high severity

Authentication Bypass

  • Vulnerable module: jsonwebtoken
  • Introduced through: jsonwebtoken@4.0.0

Detailed paths

  • Introduced through: jsonwebtoken@4.0.0
    Remediation: Upgrade to jsonwebtoken@4.2.2.

Overview

jsonwebtoken is a JSON Web token implementation for symmetric and asymmetric keys. Affected versions of this package are vulnerable to an Authentication Bypass attack, due to the "algorithm" not being enforced. Attackers are given the opportunity to choose the algorithm sent to the server and generate signatures with arbitrary contents. The server expects an asymmetric key (RSA) but is sent a symmetric key (HMAC-SHA) with RSA's public key, so instead of going through a key validation process, the server will think the public key is actually an HMAC private key.

Remediation

Upgrade jsonwebtoken to version 4.2.2 or greater.

References

high severity

Forgeable Public/Private Tokens

  • Vulnerable module: jws
  • Introduced through: jws@2.0.0

Detailed paths

  • Introduced through: jsonwebtoken@4.0.0 jws@2.0.0
    Remediation: Upgrade to jsonwebtoken@5.0.0.

Overview

jws is an implementation of JSON Web Signatures. Affected versions of this package are vulnerable to an Authentication Bypass attack, due to the "algorithm" not being enforced in jws.verify(). Attackers are given the opportunity to choose the algorithm sent to the server and generate signatures with arbitrary contents. The server expects an asymmetric key (RSA) but is sent a symmetric key (HMAC-SHA) with RSA's public key, so instead of going through a key validation process, the server will think the public key is actually an HMAC private key.

Remediation

Upgrade jws to version 3.0.0 or later.

References