[🐸 Frogbot] Upgrade jsonwebtoken to 9.0.0 #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📦 Vulnerable Dependencies
✍️ Summary
High
express-jwt:5.3.3
🔬 Research Details
Description:
jsonwebtoken is a JSON Web Token (JWT) implementation for Node.js.
It allows verifying/signing JWTs, which are mainly used for authorization and authentication purposes.
JSON Web Token is an open industry standard used to share information between two entities, usually a client (like your app’s frontend) and a server (your app’s backend).
Each JWT is also signed using cryptography (hashing) to ensure that the JSON contents (also known as JWT claims) cannot be altered by the client or a malicious party.
It was discovered that the
jwt.verify()
function in jsonwebtoken defaults to an empty signature validation, which leads to a JWT's signature bypass.The issue occurs when not specifying any validation algorithm in the options parameter for the
jwt.verify()
function and in addition thesecretOrPublicKey
argument is falsy (null
,false
, orundefined
). In this case, a malicious attacker can send an unsigned JSON Web Token using thenone
validation algorithm, essentially bypassing the signature check altogether.Remediation:
Development mitigations
To mitigate this issue, specify the allowed algorithms to the
jwt.verify()
function, and make sure not to use thenone
algorithm (that will allow unsigned tokens and hence this vulnerability).An example for a secure call to
jwt.verify()
:🐸 JFrog Frogbot