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
- 1Use jwt.verify() (with an explicit secret/key and algorithms list) for any claims that affect authorization or identity.
- 2Reserve jwt.decode() for display-only purposes, such as reading exp for a client-side countdown, never for access control.
- 3Centralize verification in a single middleware so decode-only usage cannot bypass it.
Code examples
Verify the signature before trusting claims
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.
More code checks
- CriticalForm Submits Data Over Insecure HTTP
- MediumPotential Prototype Pollution Sinks Detected
- HighPotential Command Injection Vectors
- HighPotential Path Traversal Vulnerability
- HighInsecure Authentication Mechanisms Detected
- HighPotential Insecure Deserialization
- Mediumeval() Usage in Inline Scripts
- MediuminnerHTML DOM XSS Sink
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.