fast-jwt@1.1.2

Fast JSON Web Token implementation

  • latest version

    6.2.4

  • latest non vulnerable version

  • first published

    5 years ago

  • latest version published

    1 months ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the fast-jwt package. This does not include vulnerabilities belonging to this package’s dependencies.

    Fix vulnerabilities automatically

    Snyk's AI Trust Platform automatically finds the best upgrade path and integrates with your development workflows. Secure your code at zero cost.

    Fix for free
    VulnerabilityVulnerable Version
    • C
    Improper Authentication

    fast-jwt is a Fast JSON Web Token implementation

    Affected versions of this package are vulnerable to Improper Authentication in the async key resolver when it returns an empty string or zero-length buffer. An attacker can gain unauthorized access and assume arbitrary identities by forging JWTs signed with an empty secret, which are then accepted as valid tokens.

    Note: This is only exploitable if the application uses an asynchronous callback for key resolution and the callback can return an empty string or zero-length buffer, while HMAC algorithms are allowed (default configuration).

    How to fix Improper Authentication?

    Upgrade fast-jwt to version 6.2.4 or higher.

    <6.2.4
    • L
    Incorrect Regular Expression

    fast-jwt is a Fast JSON Web Token implementation

    Affected versions of this package are vulnerable to Incorrect Regular Expression in the allowedAud, allowedIss, allowedSub, allowedJti, or allowedNonce options when used with RegExp objects and RegExp is configured with modifiers such as /y and /g. An attacker can cause intermittent authentication failures and potentially trigger retry storms or operational disruptions by repeatedly submitting valid tokens, leading to unpredictable acceptance or rejection outcomes.

    How to fix Incorrect Regular Expression?

    Upgrade fast-jwt to version 6.2.1 or higher.

    <6.2.1
    • H
    Not Failing Securely ('Failing Open')

    fast-jwt is a Fast JSON Web Token implementation

    Affected versions of this package are vulnerable to Not Failing Securely ('Failing Open') due to improper validation of the crit header parameter. An attacker can bypass intended authorization policies by crafting a signed token with unknown critical header parameters, which are improperly accepted and processed.

    How to fix Not Failing Securely ('Failing Open')?

    Upgrade fast-jwt to version 6.2.0 or higher.

    <6.2.0
    • H
    Use of a Broken or Risky Cryptographic Algorithm

    fast-jwt is a Fast JSON Web Token implementation

    Affected versions of this package are vulnerable to Use of a Broken or Risky Cryptographic Algorithm in the performDetectPublicKeyAlgorithms function due to improper handling of leading whitespace in PEM key strings. An attacker can gain unauthorized access and forge tokens by supplying a public key with leading whitespace, causing the key to be misclassified and allowing arbitrary payloads to be accepted as valid.

    Note:

    This vulnerability is caused by an incomplete fix for CVE-2023-48223.

    How to fix Use of a Broken or Risky Cryptographic Algorithm?

    Upgrade fast-jwt to version 6.2.0 or higher.

    <6.2.0
    • C
    Improper Validation of Unsafe Equivalence in Input

    fast-jwt is a Fast JSON Web Token implementation

    Affected versions of this package are vulnerable to Improper Validation of Unsafe Equivalence in Input in the cacheKeyBuilder function when custom implementations do not generate unique keys for different tokens, leading to cache collisions. An attacker can gain unauthorized access to another user's identity and permissions by submitting a token that results in a cache key collision.

    Note:

    This is only exploitable if caching is enabled and a custom cacheKeyBuilder function is used that can produce identical keys for different tokens.

    How to fix Improper Validation of Unsafe Equivalence in Input?

    Upgrade fast-jwt to version 6.1.0 or higher.

    <6.1.0
    • M
    Acceptance of Extraneous Untrusted Data With Trusted Data

    fast-jwt is a Fast JSON Web Token implementation

    Affected versions of this package are vulnerable to Acceptance of Extraneous Untrusted Data With Trusted Data when validating an issuer (iss) claim in validateClaimValues(). This function implicitly accepts an array of issuer URLs and accepts it if one member is verified. This behavior is not compliant with RFC 7519, which specifies that a token must be a string. An attacker can bypass the intended verification by sending a JWT whose iss claim includes a malicious domain as well as a legitimate one.

    How to fix Acceptance of Extraneous Untrusted Data With Trusted Data?

    Upgrade fast-jwt to version 5.0.6 or higher.

    <5.0.6
    • M
    Improper Input Validation

    fast-jwt is a Fast JSON Web Token implementation

    Affected versions of this package are vulnerable to Improper Input Validation due to improperly prevention of JWT algorithm confusion for all public key types. To exploit this vulnerability, an attacker needs to craft a malicious JWT token containing the HS256 algorithm, signed with the public RSA key of the victim application.

    Note: This attack will only work if the victim application utilizes a public key containing the BEGIN RSA PUBLIC KEY header.

    How to fix Improper Input Validation?

    Upgrade fast-jwt to version 3.3.2 or higher.

    <3.3.2