CVE-2026-35042: fast-jwt accepts unknown `crit` header extensions (RFC 7515 violation)
Summary fast-jwt does not validate the crit (Critical) Header Parameter defined in RFC 7515 §4.1.11. When a JWS token contains a crit array listing extensions that fast-jwt does not understand, the library accepts the token instead of rejecting it. This violates the MUST requirement in the RFC.
Published Apr 3, 2026 · Updated Apr 6, 2026
Affected packages
fast-jwt
- Ecosystem
- npm
- Affected
- <= 6.1.0
- Fixed in
- No patched version yet
- Check
npm ls fast-jwt
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
fast-jwt does not validate the crit (Critical) Header Parameter defined in RFC 7515 §4.1.11. When a JWS token contains a crit array listing extensions that fast-jwt does not understand, the library accepts the token instead of rejecting it. This violates the MUST requirement in the RFC.
---
RFC Requirement
RFC 7515 §4.1.11:
If any of the listed extension Header Parameters are not understood > and supported by the recipient, then the JWS is invalid.
---
Proof of Concept
const { createSigner, createVerifier } = require("fast-jwt"); // v3.3.3
const signer = createSigner({ key: "secret", algorithm: "HS256" });
const token = signer({
sub: "attacker",
role: "admin",
header: { crit: ["x-custom-policy"], "x-custom-policy": "require-mfa" },
});
// Should REJECT — x-custom-policy is not understood
const verifier = createVerifier({ key: "secret", algorithms: ["HS256"] });
try {
const result = verifier(token);
console.log("ACCEPTED:", result);
// Output: ACCEPTED: { sub: 'attacker', role: 'admin' }
} catch (e) {
console.log("REJECTED:", e.message);
}Expected: Error — unsupported critical extension Actual: Token accepted.
Comparison
// jose (panva) v4+ — correctly rejects
const jose = require("jose");
await jose.jwtVerify(token, new TextEncoder().encode("secret"));
// throws: Extension Header Parameter "x-custom-policy" is not recognized---
Impact
- Split-brain verification in mixed-library environments
- Security policy bypass when
critcarries enforcement semantics - Token binding bypass (RFC 7800
cnfconfirmation) - See CVE-2025-59420 for full impact analysis
---
Suggested Fix
In src/verifier.js, add crit validation after header decoding:
const SUPPORTED_CRIT = new Set(["b64"]);
function validateCrit(header) {
if (!header.crit) return;
if (!Array.isArray(header.crit) || header.crit.length === 0)
throw new Error("crit must be a non-empty array");
for (const ext of header.crit) {
if (!SUPPORTED_CRIT.has(ext))
throw new Error(`Unsupported critical extension: ${ext}`);
if (!(ext in header))
throw new Error(`Critical extension ${ext} not present in header`);
}
}Credited to dmbs335.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More npm vulnerabilities
All npm entriesCVE-2026-107719
fast-jwt: Verifier cache accepts expired JWTs without iat.
medium4.2Oct 8, 2026CVE-2026-107720
fast-jwt: createVerifier accepts unsigned JWTs when key is '' or null and algorithms is explicitly set
high7.4Oct 8, 2026CVE-2026-107721
fast-jwt clockTolerance: Infinity silently bypasses both exp and nbf validation (and persists in the verifier cache)
medium5.9Oct 8, 2026CVE-2026-107722
fast-jwt: Incomplete patch of CVE-2026-34950: Non-whitespace key-prefix re-enables RSA→HS256 algorithm confusion
critical9.8Oct 8, 2026CVE-2026-107723
fast-jwt : Silent claim-validator bypass when JWT payload is a JSON array
high8.1Oct 8, 2026CVE-2026-107724
fast-jwt treats raw public JWK JSON as an HMAC secret, enabling HS256 token forgery
high7.4Oct 8, 2026
