Skip to main content
HighCodeOWASP A02:2021CWE-347

How to fix: JWT Decoded Without Signature Verification

jwt.decode() is called to read a token's claims, but jwt.verify() is never called anywhere in the same source. jwt.decode() does not check the signature, so any attacker-forged token decodes just as successfully as a legitimately signed one.

Why it matters

If the decoded claims are used for any authorization or identity decision, an attacker can forge a token with arbitrary claims and have it accepted without ever proving a valid signature.

jwt.decode() only base64-decodes the token payload; it performs no cryptographic check. Authorization or identity decisions must be based on the result of jwt.verify(), never jwt.decode() alone.

How to fix it

  1. 1Use jwt.verify() (with an explicit secret/key and algorithms list) for any claims that affect authorization or identity.
  2. 2Reserve jwt.decode() for display-only purposes, such as reading exp for a client-side countdown, never for access control.
  3. 3Centralize verification in a single middleware so decode-only usage cannot bypass it.

Code examples

Verify the signature before trusting claims

TypeScript
import jwt from "jsonwebtoken";

// BAD: claims are trusted without checking the signature
const claims = jwt.decode(token) as { sub: string; role: string };
if (claims.role === "admin") grantAccess();

// GOOD: verify the signature before trusting any claim
const payload = jwt.verify(token, process.env.JWT_SECRET!, {
  algorithms: ["HS256"],
}) as { sub: string; role: string };
if (payload.role === "admin") grantAccess();

References

Detected automatically by VulnRadar. The check id is code-jwt-decode-only, stable across every scan so you can filter or diff on it.

See every code check

Questions

How severe is JWT Decoded Without Signature Verification?
VulnRadar rates this high severity in the code category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id code-jwt-decode-only, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does JWT Decoded Without Signature Verification map to?
It maps to CWE-347. In the OWASP Top 10 it falls under A02:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for jwt decoded without signature verification

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

JWT Decoded Without Signature Verification fix | VulnRadar