PortGate

Advisories · Node.js & Next.js

CVE-2022-23529 High CVSS 7.6

jsonwebtoken secret type confusion

Disclosed 2022 · Last reviewed 2 Dec 2026

A secret that was an object rather than a string could change how a token was verified.

What happened

The verify function accepted a secret type it then used unsafely.

Affected and patched versions

Affected
jsonwebtoken before 9.0.0.
Patched
jsonwebtoken 9.0.0 and later.

How to check your server

Check

npm ls jsonwebtoken

How to fix and harden

  1. Upgrade jsonwebtoken to 9.0.0 or later.
  2. Pass a string or a buffer you control. Never pass a request field as the secret.

Fix

npm ls jsonwebtoken

Sources

Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON