Repository navigation
v3.6.3
LibJWT 3.6.3 is a security release. It fixes three vulnerabilities, plus hardening found while fixing them. All 3.x users should upgrade. 3.6.0 to 3.6.2 are affected by all three; 3.4.x and 3.5.x by GHSA-4jp4-6w6j-ff4q and GHSA-g7xw-4cjw-2247; earlier 3.x releases by GHSA-g7xw-4cjw-2247, which affects only the jwt-verify tool.
This release is ABI-compatible with 3.6.2. An nm diff shows the same 155 exported symbols, so per the libtool rules only the SONAME revision advances (18:2:4 → 18:3:4). The SONAME stays libjwt.so.14 and existing binaries keep working. Some of the behavior changes below may still need application changes.
🛡️ Security fixes
- GHSA-vmf4-mvgm-7vpv (Critical, 3.6.0–3.6.2): embedded-JWK verification accepted tokens forged against a pinned or allowlisted OKP (Ed25519, Ed448) or AKP (ML-DSA) public key, with the OpenSSL and GnuTLS backends.
- Affected:
jwt_checker_enable_embedded_jwk()andjwt_checker_enable_embedded_jwk_keyring(). A header"jwk"could carry a trusted party's public member with the attacker's own private member; the thumbprint matched the first and the signature was checked with the second. - Fix: a private OKP or AKP JWK whose public member is not the public key of its private member is put in error, and a header
"jwk"that has any private member or a"keys"member is refused before it is loaded.
- Affected:
- GHSA-4jp4-6w6j-ff4q (High, 3.4.0–3.6.2): JWKs that failed to load were still used,
x5cwas not bound to the key, and the public export could leak private members.- Affected: a key in error could crash a build with both OpenSSL and MbedTLS after a backend switch (a NULL dereference), and from 3.6.0 keys flagged in error after loading still verified tokens. From 3.6.0 a JWK could also pair one party's key with another party's
x5ccertificate. From 3.4.0 the public export kept the private members of a key whosektythe build does not recognise, members private to another key type, and the RSAothmember. - Fix: a key in error is never used, a JWK whose
x5cleaf does not hold its key is put in error, and the public form drops every private member.
- Affected: a key in error could crash a build with both OpenSSL and MbedTLS after a backend switch (a NULL dereference), and from 3.6.0 keys flagged in error after loading still verified tokens. From 3.6.0 a JWK could also pair one party's key with another party's
- GHSA-g7xw-4cjw-2247 (High, 3.0.0–3.6.2): the exit status of the
jwt-verifytool was the number of failed tokens, so 256 failures exited0, and a long stdin line was verified as several tokens. A script that trusted the exit status could accept a forged token. The library API is not affected.- Fix:
jwt-verifyexits0only when every token verified, and a stdin line is never split.
- Fix:
⚠️ Behavior changes
- Keys in error (
jwks_item_error())jwt_builder_setkey(),jwt_checker_setkey(),jwt_builder_add_signature()and verify or generate callbacks refuse them withKey is in error and cannot be used; with a JWS JSON or keyring token, a callback's key in error simply does not verify.jwe_builder_setkey(),jwe_builder_add_recipient()andjwe_checker_setkey()refuse them withKey is in error and cannot be used for JWE, andjwt_builder_setcnf_jwk()returns an error. Keyrings skip them, so a key set keeps working with its good keys.- A refused setkey keeps the key set before it. A checker or builder left with no key rejects every token, or generates none, instead of going unsigned.
- Keys flagged after loading (a malformed or mismatched
x5c, anx5t#S256mismatch, a non-stringalg) no longer sign or verify. jwks_item_key_bits()andjwks_item_is_private()return 0 for a key that failed to load, and the X.509 accessors read as absent for a key in error.
x5c: a JWK whosex5cleaf certificate does not hold the JWK's key is now in error. That includes a chain in the wrong order, a certificate kept after its key was rotated, an EC leaf with a compressed point or explicit parameters, andx5con anoctkey. An emptyx5carray is unchanged.- OKP and AKP keys: with OpenSSL and GnuTLS, a private key whose
xorpubcannot be read or does not match itsdorprivno longer loads. - Embedded JWK: a header
"jwk"with a"keys"member or any private member (d,p,q,dp,dq,qi,oth,k,priv) is refused, whatever its value. - Public export: every private member name is dropped whatever the
kty, and a key of a type the build does not know has no public form. The public form of a key in error also dropsx5c,x5t,x5t#S256andx5u.AKPis recognised in every build, so public ML-DSA keys are exported even without ML-DSA support. jwt-verify- The exit status is
0or1, not a count. Empty or unreadable stdin exits1, and so do- token ..., and-hor-lunless it is the only argument. - A stdin line of 1 MiB or more, or with a NUL byte, is one failed token. Tokens of up to 1048575 bytes now verify from stdin; before, a newline-terminated token over
BUFSIZ - 2bytes (8190 with glibc, 1022 on macOS) was read in pieces and failed. --printwithout--verboseis a usage error.- Control bytes (0x00–0x1f and 0x7f) in a printed token or error message are shown as
\xNN. - On Windows, stdin is read in binary mode, so a 0x1A byte no longer ends the input early, and a CRLF line keeps its CR and fails, as it already did on other systems.
- The exit status is
jwt-verifyandjwt-generate- A
--printcommand ended by a signal fails the token or the generated output. On Windows the command's exit status is now checked too; it used to be ignored. -kwith a key set that holds no keys exits1instead of crashing.
- A
🔒 Hardening and fixes
- JSON null
"x5c"and"alg"members read the same under Jansson and json-c. - A remote JWKS refresh whose keys are all in error no longer replaces a good cached key set.
- The
x5cleaf is read by a strict, bounds-checked DER parser in common code, so the binding check is the same on every backend.
📚 Documentation
jwt-verify(1)has a new EXIT STATUS section, no longer says-qreturns the number of failures, and says to pass an untrusted token on stdin as one line, or to reject it if it starts with-. Both man pages say a--printcommand ended by a signal fails.- The setkey functions document that a refused key leaves the previous key in place.
jwks_item_x5c()documents that only the public members are compared with the leaf certificate.
Full Changelog: v3.6.2...v3.6.3