CVE-2026-107721: fast-jwt clockTolerance Infinity Silently Bypasses Both Exp Vulnerability
MODERATECVE-2026-107721 is a MODERATE (CVSS 5.9) infinity silently bypasses both exp vulnerability (CWE-682: Incorrect Calculation) affecting fast-jwt clockTolerance libraries in the npm ecosystem. The issue involves infinity silently bypasses both exp and nbf validation (and persists in the verifier cache). Remediation is available by upgrading affected packages to version 6.3.0.
CVE-2026-107721 at a Glance
Security Impact
CVSS: 5.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:N).
How to Fix CVE-2026-107721
To remediate this vulnerability, upgrade all affected fast-jwt clockTolerance dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install fast-jwt@6.3.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls fast-jwt
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-107721, inspect your project dependencies using npm:
npm ls fast-jwt
Analyze the terminal output to locate any version of fast-jwt clockTolerance in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.3.0), your application is affected.
Note: The npm ls fast-jwt command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-682: Incorrect Calculation, where the product performs a calculation that generates incorrect or unintended results that are later used in security-critical decisions or resource management. In fast-jwt clockTolerance, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-107721 Affected fast-jwt clockTolerance Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
fast-jwt
|
npm |
< 6.3.0
|
6.3.0
|
References
Frequently Asked Questions
What is CVE-2026-107721?
Which fast-jwt clockTolerance versions are affected?
What version fixes CVE-2026-107721?
Is fast-jwt affected?
What is the CVSS score of CVE-2026-107721?
What CWE is associated with CVE-2026-107721?
How can I check npm dependencies for CVE-2026-107721?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-687g-22h4-j4w4",
"modified" : "2026-10-08T22:02:03Z",
"published" : "2026-10-08T22:02:02Z",
"aliases" : [ "CVE-2026-107721" ],
"summary" : "fast-jwt clockTolerance: Infinity silently bypasses both exp and nbf validation (and persists in the verifier cache)",
"details" : "## Summary\n\n`createVerifier({ clockTolerance: Infinity })` silently bypasses both `exp` (expiry) AND `nbf` (not-before) validation. Any expired or not-yet-active token is accepted as valid. The same primitive also corrupts the verifier's internal cache so cached entries inherit infinite validity — they remain valid past a later developer-removed Infinity config until LRU eviction.\n\n## Vulnerable code\n\n`src/verifier.js:531-533` — option validation only rejects negative values, not Infinity:\n\n```js\nif (clockTolerance && (typeof clockTolerance !== 'number' || clockTolerance < 0)) {\n throw new TokenError(TokenError.codes.invalidOption, 'The clockTolerance option must be a positive number.')\n}\n```\n\n`Infinity` passes (it's a number, not less than 0, truthy).\n\n`src/verifier.js:583-602` — clockTolerance flows into the date-claim validators:\n\n```js\nif (!ignoreNotBefore) {\n validators.push({ ..., modifier: -clockTolerance }) // → -Infinity\n}\nif (!ignoreExpiration) {\n validators.push({ ..., modifier: +clockTolerance }) // → Infinity\n}\n```\n\n`src/verifier.js:198-205` — applies modifier additively, producing always-pass comparisons:\n\n```js\nfunction validateClaimDateValue(value, modifier, now, greater, errorCode, errorVerb) {\n const adjusted = value * 1000 + (modifier || 0) // → ±Infinity\n const valid = greater ? now >= adjusted : now <= adjusted // → always true\n ...\n}\n```\n\n## Empirical PoC\n\n```js\nconst { createSigner, createVerifier } = require('fast-jwt')\nconst secret = 'test-secret-with-enough-length-to-pass'\n\nconst sign = createSigner({ key: secret, algorithm: 'HS256' })\nconst expiredToken = sign({\n sub: 'alice',\n iat: Math.floor(Date.now()/1000) - 3600,\n exp: Math.floor(Date.now()/1000) - 1800, // expired 30 min ago\n})\n\nconst v1 = createVerifier({ key: secret })\ntry { v1(expiredToken) } catch (e) { console.log('baseline rejects:', e.message) }\n// → \"The token has expired at ...\"\n\nconst v2 = createVerifier({ key: secret, clockTolerance: Infinity })\nconsole.log('bypass:', v2(expiredToken))\n// → { sub: 'alice', iat: ..., exp: ... } ← expired token accepted as valid\n\n// Not-yet-active token (nbf in 1 day) — same bypass\nconst futureToken = sign({\n sub: 'bob',\n iat: Math.floor(Date.now()/1000),\n nbf: Math.floor(Date.now()/1000) + 86400,\n})\nconsole.log('bypass nbf:', v2(futureToken))\n// → { sub: 'bob', ... } ← not-yet-active token accepted as valid\n```\n\nVerified against `fast-jwt@HEAD` on 2026-06-03 (commit pulled today).\n\n## Cache side-effect\n\nThe verifier's LRU cache uses `clockTolerance` to compute the cache entry's expiry window:\n\n`src/verifier.js:121-134`:\n```js\ncacheValue[1] = ... payload.nbf * 1000 - clockTolerance : 0 // → -Infinity\ncacheValue[2] = payload.exp * 1000 + clockTolerance // → Infinity\nconst maxTTL = clockTimestamp + clockTolerance + cacheTTL // → Infinity\n```\n\nWith `clockTolerance: Infinity`, cache entries are stored with `[min=-Infinity, max=Infinity]`. The cache-hit check (`min === 0 || now < min || now <= max`) always passes for cached tokens.\n\n**Consequence**: a developer who briefly sets `clockTolerance: Infinity` (e.g., during debug) and then removes it will find that any verifications performed during the debug window remain cached as valid until LRU eviction (default 1000 entries).\n\n## Asymmetric hardening — the smoking-gun shape\n\n`src/signer.js:98, 104` CORRECTLY uses `Number.isFinite()` to reject Infinity for `expiresIn` and `notBefore`:\n\n```js\nexpiresIn != null && Number.isFinite(expiresIn)\n ? Math.floor((iat + expiresIn) / 1000)\n : ...\n```\n\nThe verifier's `clockTolerance` validation doesn't apply the same guard. The same `< 0` check pattern is also applied to `clockTimestamp` (line 527-529) and `cacheTTL` (line 535-537) — both also accept `Infinity`.\n\nThis is the kind of asymmetry that often indicates a missed hardening pass: the sign-side was hardened against Infinity but the verify-side wasn't.\n\n## Threat model\n\nThe bug requires the developer to (mis)configure `clockTolerance: Infinity`. Realistic ways this happens:\n\n1. **Developer using Infinity as a sentinel** for \"disable expiry\": common JS idiom; many libraries accept Infinity as \"no limit.\" fast-jwt's signer treats Infinity as invalid (Number.isFinite false) but the verifier silently accepts it.\n2. **JSON / env-var misconfig**: config file or env var sets `clockTolerance` to `\"Infinity\"` (string); `Number(\"Infinity\") === Infinity`. Surprising via JSON.parse + Number cast or even `JSON.parse('{\"clockTolerance\": null}')` if the codec accepts null → Infinity.\n3. **Test config bleed**: integration tests use Infinity to make tokens never expire during long-running tests; the config bleeds into production.\n\nFor a JWT library, silently disabling token expiry on a \"looks like a non-negative number\" input is a security boundary failure.\n\n## Suggested fix\n\nSingle-line addition: use `Number.isFinite()` consistent with signer.js:\n\n```js\nif (clockTolerance && (typeof clockTolerance !== 'number' || !Number.isFinite(clockTolerance) || clockTolerance < 0)) {\n throw new TokenError(TokenError.codes.invalidOption, 'The clockTolerance option must be a finite, non-negative number.')\n}\n```\n\nSame fix for `clockTimestamp` (line 527-529) and `cacheTTL` (line 535-537) for consistency.\n\nOptional defense-in-depth: cap `clockTolerance` to a reasonable upper bound (e.g., 5 minutes = 300000 ms) with a `process.emitWarning` above that. Most legitimate use cases need <60s tolerance.\n\n## Affected versions\n\nAll versions since clockTolerance was first introduced in PR #193 (v1.5.1). Current `main` HEAD on 2026-06-03 is affected.\n\n## Reporter\n\nAndrew Ridings (independent security researcher). Happy to coordinate disclosure timing and follow up with any clarifications. Email: ridingsa@gmail.com",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "fast-jwt"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "6.3.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 6.2.4"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/nearform/fast-jwt/security/advisories/GHSA-687g-22h4-j4w4"
}, {
"type" : "WEB",
"url" : "https://github.com/nearform/fast-jwt/commit/c0fb5b88b4c88ff2bdd194ca2c713599ad9e38b6"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/nearform/fast-jwt"
}, {
"type" : "WEB",
"url" : "https://github.com/nearform/fast-jwt/releases/tag/v6.3.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-613", "CWE-682" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-10-08T22:02:02Z",
"nvd_published_at" : null
}
}