Skip to content

Insecure 'none' algorithm in JWT

Description

The 'none' algorithm disables cryptographic integrity in JWT tokens, allowing attackers to forge them. Always use a secure algorithm like 'HS256'.

Examples

Insecure Code

java
Jwts.builder().signWith(SignatureAlgorithm.none);

Secure Code

java
Jwts.builder().signWith(SignatureAlgorithm.HS256);

Remediation

Replace the 'none' algorithm with a secure one, such as 'HS256', when creating or verifying JWT tokens.

Rule Details

FieldValue
IDCODE-0649
CategoryCrypto
SeverityCRITICAL
CWECWE-327
ConfidenceLOW
ImpactMEDIUM
LikelihoodLOW
ExploitabilityEASY
Tagsjwt, crypto, insecure algorithm
OWASPA02:2021-Cryptographic Failures, A3:2017-Sensitive Data Exposure

References