Update Rust crate jsonwebtoken to v10 [SECURITY]#40
Open
renovate[bot] wants to merge 1 commit intomasterfrom
Open
Update Rust crate jsonwebtoken to v10 [SECURITY]#40renovate[bot] wants to merge 1 commit intomasterfrom
renovate[bot] wants to merge 1 commit intomasterfrom
Conversation
7f8e053 to
185b826
Compare
185b826 to
b496ba5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR contains the following updates:
^5.0.1→^10.3.0GitHub Vulnerability Alerts
CVE-2026-25537
Summary:
It has been discovered that there is a Type Confusion vulnerability in jsonwebtoken, specifically, in its claim validation logic.
When a standard claim (such as nbf or exp) is provided with an incorrect JSON type (Like a String instead of a Number), the library’s internal parsing mechanism marks the claim as “FailedToParse”. Crucially, the validation logic treats this “FailedToParse” state identically to “NotPresent”.
This means that if a check is enabled (like: validate_nbf = true), but the claim is not explicitly marked as required in required_spec_claims, the library will skip the validation check entirely for the malformed claim, treating it as if it were not there. This allows attackers to bypass critical time-based security restrictions (like “Not Before” checks) and commit potential authentication and authorization bypasses.
Details:
The vulnerability stems from the interaction between the TryParse enum and the validate function in src/validation.rs.
If a user sends {“nbf”: “99999999999”} (legacy/string format), serde fails to parse it as u64, and it results in TryParse::FailedToParse.
like this:
This matches! macro explicitly looks for TryParse::Parsed(nbf).
• If claims.nbf is FailedToParse, the match returns false.
• The if block is skipped.
• No error is returned.
If “nbf” IS in required_spec_claims, FailedToParse will fail the matches!(..., Parsed(_)) check, causing the present to be false, and correctly returning an error.
However, widely accepted usage patterns often enable validation flags (validate_nbf = true) without adding the claim to the required list, assuming that enabling validation implicitly requires the claim’s validity if it appears in the token. jsonwebtoken seems to violate this assumption.
Environment:
• Version: jsonwebtoken 10.2.0
• Rust Version: rustc 1.90.0
• Cargo Version: cargo 1.90.0
• OS: MacOS Tahoe 26.2
POC:
For demonstrating, Here is this simple rust code that demonstrates the bypass. It attempts to validate a token with a string nbf claiming to be valid only in the far future.
create a new project:
add required dependencies:
replace the code in src/main.rs with this:
run cargo run
expected behaviour:
Token was accepted despite malformed far-future 'nbf'!
Impact:
If an application uses jsonwebtoken nbf (Not Before) to schedule access for the future (like “Access granted starting tomorrow”).
By sending nbf as a string, an attacker can bypass this restriction and access the resource immediately.
and for the exp claim (this is unlikely but still adding), If a developer sets validate_exp = true but manually handles claim presence (removing exp from required_spec_claims), an attacker can send a string exp (e.g., “never”) and bypass expiration checks entirely. The token becomes valid forever.
Release Notes
Keats/jsonwebtoken (jsonwebtoken)
v10.3.0Compare Source
v10.2.0Compare Source
Clonebound from decode functionsv10.1.0Compare Source
dangerous::insecure_decodev10.0.0Compare Source
aws_lc_rsandrust_cryptoClonebound todecodev9.3.1Compare Source
v9.3.0Compare Source
Validation.reject_tokens_expiring_in_less_than, the opposite of leewayv9.2.0Compare Source
audin the Validation structv9.1.0Compare Source
v9.0.0Compare Source
v8.3.0Compare Source
v8.2.0Compare Source
use_pemfeature enabledv8.1.1Compare Source
v8.1.0Compare Source
HashforHeaderv8.0.1Compare Source
v8.0.0Compare Source
sign/verifynow takes a&[u8]instead of&strto be more flexibleDecodingKeynow own its datadangerous_unsafe_decodeValidation::issis now aHashSetinstead of a single valuedecodewill now error ifValidation::algorithmsis emptyexamples/auth0.rsfor an exampledecode_*functions in favour of using theValidationstructexpandnbf, yes it's in the spec... floats will be rounded and converted to u64Validation::require_spec_claimsto validate presence of the spec claimsuse_pemthat can be disabled to avoid 2 dependenciesv7.2.0Compare Source
dangerous_insecure_decodeto replacedangerous_unsafe_decode, which is now deprecateddangerous_insecure_decode_with_validationv7.1.2Compare Source
HashforHeaderandAlgorithmv7.1.1v7.1.0into_statictoDecodingKeyfor easier re-usev7.0.0Option<HashSet<String>>. Audiencevalidation now tests for "any-of-these" audience membership.
6.0.1 (2019-05-10)
6.0.0 (2019-04-21)
iatcheck to match the JWT spec5.0.1 (2018-09-10)
5.0.0 (2018-08-13)
iatandnbfanymore4.0.1 (2018-03-19)
4.0.0 (2017-11-22)
Breaking changes
decode3.0.0 (2017-09-08)
Breaking changes
validate_signaturefromValidation, usedecode_headerinstead if you don't know the alg usedtypoptional in header, some providers apparently don't use itOthers
leewaybeing in seconds and not millisecondsdecode_headerto only decode the header: replaces the use case ofvalidate_signature2.0.3 (2017-07-18)
TokenDatapublic2.0.2 (2017-06-24)
2.0.1 (2017-05-09)
2.0.0 (2017-04-23)
Previous
v6.0.1v6.0.0iatcheck to match the JWT specConfiguration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.