Summary
CVE-2026-53938 is a heap buffer overflow vulnerability in cjose, a C library implementing the JOSE (JSON Object Signing and Encryption) standard, affecting its JWE (JSON Web Encryption) decryption logic for AES Key Wrap algorithms. The library fails to validate the length of an attacker-supplied encrypted key before unwrapping it into a fixed-size heap buffer, allowing a remote, unauthenticated attacker to trigger out-of-bounds heap writes by submitting a crafted JWE token. The flaw carries a CVSS v3.1 base score of 8.2 (High) and can result in denial of service and potential memory corruption.
Technical details
- Root cause: The
_cjose_jwe_decrypt_ek_aes_kw()function insrc/jwe.cdoes not verify that the encrypted key (enc_key) length matches the expected size (CEK length + 8 bytes, per RFC 3394) before passing it to OpenSSL’sAES_unwrap_key(). - Trigger conditions: An attacker crafts a JWE token with an encrypted key field longer than expected for the AES Key Wrap algorithm in use (A128KW, A192KW, or A256KW) and submits it to any application that decrypts JWEs using cjose.
- Attack vector: Network (AV:N) — no authentication or user interaction is required; any service that accepts and decrypts attacker-supplied JWE tokens is exposed.
- Impact:
AES_unwrap_key()writes attacker-controlled amounts of data into a fixed-size CEK (Content Encryption Key) buffer, corrupting heap memory. This can crash the decrypting process (denial of service) and, depending on heap layout and allocator behavior, may lead to further memory corruption. - Weakness classifications: CWE-122 (Heap-based Buffer Overflow), CWE-787 (Out-of-bounds Write).
Affected software
- OpenIDC/cjose versions up to and including 0.6.2.4
- Any application or service embedding an affected cjose version to perform JWE decryption using AES Key Wrap algorithms (A128KW, A192KW, A256KW)
Severity
- CVSS v3.1 Base Score: 8.2 (High)
- Vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H
Mitigation and recommended actions
- Immediate: Upgrade cjose to version 0.6.2.5 or later, which adds explicit validation that the encrypted key length equals the expected CEK length plus 8 bytes before invoking the AES unwrap routine.
- If no patch can be applied immediately:
- Restrict or disable JWE decryption paths that accept AES Key Wrap (A128KW/A192KW/A256KW) protected tokens from untrusted or external sources until patched.
- Deploy network-layer controls (WAF/API gateway rules) to filter malformed or abnormally large JWE payloads reaching services that use cjose.
- Monitor for crashes/segfaults in services using cjose as a potential indicator of exploitation attempts.
- Rebuild and redeploy any statically linked binaries or containers that bundle a vulnerable cjose version.

