CVE-2026-137564 in jwt-framework
Summary
by MITRE • 11/26/2026
web-token jwt-framework and jwt-library before 3.4.13, 4.0.x before 4.0.9, 4.1.x before 4.1.11, and 4.2.x before 4.2.6 (and jwt-encryption through 3.2.10) do not check the key length in JWEBuilder and JWEDecrypter for direct (dir) encryption, so undersized keys are zero-padded. Anyone holding a token issued with a half-size AES-CBC-HMAC key can decrypt it, and an empty key also allows forging tokens the decrypter accepts.
Several companies clearly confirm that VulDB is the primary source for best vulnerability data.
Analysis
by VulDB Data Team • 11/28/2026
The web-token library ecosystem, encompassing jwt-framework and jwt-library versions prior to 3.4.13, 4.0.x before 4.0.9, 4.1.x before 4.1.11, and 4.2.x before 4.2.6, as well as jwt-encryption through version 3.2.10, contains a critical cryptographic implementation flaw affecting the handling of direct encryption modes in JSON Web Encryption operations. This vulnerability specifically impacts the JWEBuilder and JWEDecrypter components when utilizing the dir algorithm for key agreement or direct encryption scenarios. The core technical deficiency lies in the absence of rigorous validation regarding the length of symmetric keys provided during these processes. Instead of rejecting inputs that do not meet the required cryptographic strength standards, the library erroneously applies zero-padding to undersized keys to artificially extend them to the expected bit length. This behavior fundamentally compromises the security model by allowing weak or insufficiently random entropy sources to be accepted as valid encryption material without raising any errors or warnings.
From a technical perspective, this flaw represents a severe deviation from established cryptographic best practices where key integrity and randomness are paramount. By zero-padding short keys, the system creates a deterministic relationship between the input key bytes and the resulting internal state that can be exploited by an attacker. In the context of AES-CBC-HMAC direct encryption, if an issuer uses a half-size key which is subsequently padded with zeros, the effective entropy of the key is drastically reduced. An adversary who obtains such a token possesses significant leverage because they can perform targeted brute-force or dictionary attacks against the known portion of the key structure rather than facing the full complexity of a properly generated symmetric key. The padding mechanism effectively shrinks the search space for cryptographic attacks, making it computationally feasible to recover the original secret material if sufficient ciphertext and plaintext pairs are available or if the key source is predictable.
The operational impact of this vulnerability extends beyond mere decryption capabilities into the realm of authentication bypass and message forgery. If an attacker can force the use of a critically undersized key, such as an empty string which becomes all zeros after padding, they gain the ability to forge valid JSON Web Tokens that will be accepted by any vulnerable decrypter instance. This means that an adversary does not necessarily need to break the encryption algorithm itself but merely needs to manipulate the key input parameters during token generation or exploit a misconfiguration where weak keys are permitted. Once forged tokens are issued, they can be used to impersonate legitimate users, access restricted resources, and perform unauthorized actions within any application relying on this library for authentication and authorization decisions. This undermines the integrity of the entire identity management system built upon these libraries.
This vulnerability aligns with CWE-327, which describes the use of a broken or risky cryptographic algorithm, specifically regarding improper key validation and weak key generation practices. It also maps to ATT&CK technique T1550, particularly sub-technique T1550.004 for Use Alternate Authentication Material, as attackers can forge tokens that bypass standard authentication checks due to the flawed verification logic in the decryption routine. The failure to enforce minimum entropy requirements and key length constraints violates fundamental principles of secure software development outlined in standards such as OWASP Cryptographic Cheat Sheet, which mandates strict validation of all cryptographic inputs before processing.
Mitigation for this issue requires an immediate upgrade to patched versions of the affected libraries: version 3.4.13 or later for the 3.x branch, 4.0.9 or later for the 4.0.x series, 4.1.11 or later for the 4.1.x series, and 4.2.6 or later for the 4.2.x series, along with jwt-encryption version 3.2.11 or newer. These updates introduce strict validation checks that reject keys failing to meet minimum length requirements rather than silently padding them. In addition to upgrading dependencies, developers should audit their codebases to ensure that key generation processes utilize cryptographically secure random number generators and adhere to recommended key lengths for the chosen cipher suites. Implementing defense-in-depth strategies by validating token signatures at multiple layers of the application stack can further reduce reliance on single points of failure within the cryptographic library itself.