You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JJWT version 0.9.1
When signature's last character is deliberately changed, that tampering with the signature is not registered. In DefaultJwsParser, check
validator.isValid(jwtWithoutSignature, base64UrlEncodedDigest)
passes, and SignatureException is not thrown. So, JWS is treated as valid though it's not.
Example:
public static final String SECRET = "SecretKeyToGenJWTs";
Token Jwts.builder()
.setSubject(((User) auth.getPrincipal()).getUsername())
.setExpiration(expiration)
.signWith(SignatureAlgorithm.HS512, SecurityConstants.SECRET.getBytes())
.compact();
produced was
eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ1c2VyMSIsImV4cCI6MTUzMzMxMzAxNH0.mXVGnMC5a7rDx15nlnMse4YjLYZ7sWV9ySjXfCvlKhUvkVuNd3LFQrW990ATwacMPsijGgj9d9kEK4VPidEWVQ
After changing it to
eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ1c2VyMSIsImV4cCI6MTUzMzMxMzAxNH0.mXVGnMC5a7rDx15nlnMse4YjLYZ7sWV9ySjXfCvlKhUvkVuNd3LFQrW990ATwacMPsijGgj9d9kEK4VPidEWVT
no problems are detected
The text was updated successfully, but these errors were encountered:
JJWT version 0.9.1
When signature's last character is deliberately changed, that tampering with the signature is not registered. In DefaultJwsParser, check
validator.isValid(jwtWithoutSignature, base64UrlEncodedDigest)
passes, and SignatureException is not thrown. So, JWS is treated as valid though it's not.
Example:
public static final String SECRET = "SecretKeyToGenJWTs";
Token Jwts.builder()
.setSubject(((User) auth.getPrincipal()).getUsername())
.setExpiration(expiration)
.signWith(SignatureAlgorithm.HS512, SecurityConstants.SECRET.getBytes())
.compact();
produced was
eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ1c2VyMSIsImV4cCI6MTUzMzMxMzAxNH0.mXVGnMC5a7rDx15nlnMse4YjLYZ7sWV9ySjXfCvlKhUvkVuNd3LFQrW990ATwacMPsijGgj9d9kEK4VPidEWVQ
After changing it to
eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ1c2VyMSIsImV4cCI6MTUzMzMxMzAxNH0.mXVGnMC5a7rDx15nlnMse4YjLYZ7sWV9ySjXfCvlKhUvkVuNd3LFQrW990ATwacMPsijGgj9d9kEK4VPidEWVT
no problems are detected
The text was updated successfully, but these errors were encountered: