Repository navigation
v3.6.2
LibJWT 3.6.2 is a security release. It fixes three vulnerabilities in token verification, plus hardening found while fixing them. All 3.x users should upgrade. 3.6.0 and 3.6.1 are affected by all three; earlier 3.x releases are affected by GHSA-mhc9-xvg5-qg29.
This release is ABI-compatible with 3.6.1. An nm diff shows the same 155 exported symbols, so per the libtool rules only the SONAME revision advances (18:1:4 → 18:2: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-mhc9-xvg5-qg29 (Critical, 3.0.0–3.6.1): forged unsigned (
"alg":"none") tokens were accepted.- Affected: a checker given only a keyring (
jwt_checker_setkeyring(), includingjwt_checker_verify_detached()andjwt-verify -r), and a keyed checker whose verify callback leftconfig->keyNULL. - Fix: Compact tokens are now verified against the keyring, and a callback can no longer leave a keyed checker without a key (
Callback left no verification key).
- Affected: a checker given only a keyring (
- GHSA-6gm4-gxx5-93hq (High, 3.6.0–3.6.1): an RFC 7797
"b64":falseheader switched off claim validation.- Fix: every JWS JSON signature must now agree on
"b64". An unencoded payload is checked as an empty claim set, so claim pins,jwt_checker_require()and a jti callback reject it. - Reported by ducanhmit and forestnguyen952.
- Fix: every JWS JSON signature must now agree on
- GHSA-v7q9-pwfj-qmf5 (Medium, 3.6.0–3.6.1):
jwt_checker_verify_detached()verified an unencoded ("b64":false) payload only up to its first NUL byte.- Fix: such a payload is now rejected.
⚠️ Behavior changes
- Unencoded payloads
- Claim checks on a
"b64":falsepayload fail withClaims cannot be validated on an unencoded ("b64":false) payload (RFC 7797). - JWS JSON signatures must agree on
"b64", and"b64"and"crit"must be in the protected header. - The builder no longer produces such tokens:
"b64"is set only withjwt_builder_setb64().
- Claim checks on a
- Keyrings
- A keyring now verifies Compact tokens.
- Only keys meant for signatures are candidates:
"use"is"sig"or absent, and"key_ops", if present, names"verify"or"sign". - A
"kid"that is not a string is rejected.
- Verify callbacks
- A token fails if the callback leaves
config->keyNULL on a checker that has, or was given, a key, a keyring or embedded-JWK verification. jwt_checker_setkey()with no key, called from a callback, no longer leaves the checker without a key.- A checker never given a key whose callback supplies none still accepts only unsigned tokens, as documented.
- Verifying from a checker's own callback is refused with
Checker is already verifying a token; use a second checker.
- A token fails if the callback leaves
- Detached payloads: an unencoded detached payload must not contain NUL bytes. Pass
strlen()as the length, not the C string's size. - JWS JSON path: the pinned algorithm, from
jwt_checker_setkey()or the callback'sconfig->alg, now applies to each signature. - Builder
jwt_builder_generate()refuses a Compact token whose only signer came fromjwt_builder_add_signature().- It also validates each signature's own
"crit".
- json-c builds reject an escaped NUL (U+0000) in JSON strings and keys, and handle JSON null as Jansson builds do.
- CLI:
jwt-verifyrefuses--algorithmtogether with--keyring.
🔒 Hardening and fixes
- Verifying from a checker's own callback, a heap use-after-free since 3.6.0, is now refused.
- JWS JSON verification: the algorithm pin, a string
"kid", and signature keys only (#342). - json-c matches Jansson: no crash on a nameless array merge, and the same handling of escaped NUL and JSON null (#344).
- Builder: each signature's own
"crit"is validated and merged, and a Compact token keeps its signer (#346). - CLI and tests:
jwt-verify -aand the keyring output are fixed, thejwt-generateandjwe_gcmleaks are gone, andjwt_checkertests have longer timeouts (#348).
📚 Documentation
- Verify and jti callbacks see data that is not verified yet.
jwt_checker_sig_*()report the signature check, not whether the token was accepted.- Limits on opaque payloads.
- The cost of verifying large Compact tokens against a keyring (#350).
Full Changelog: v3.6.1...v3.6.2