REDHAT-BUG-2530243: Openidc cjose vulnerability
OpenIDC/cjose is a C library implementing the Javascript Object Signing and Encryption (JOSE). In versions 0.6.1 through 0.6.2.5, when cjose encrypts a JWE using an AES-CBC-HMAC content-encryption algorithm (A128CBC-HS256, A192CBC-HS384, or A256CBC-HS512) together with any key-management algorithm that generates a fresh content-encryption key (CEK), the CEK is all zero bytes instead of being randomly generated. The resulting JWE is therefore encrypted and authenticated under a fixed, publicly known key, so anyone who obtains the JWE can recover the plaintext and forge or modify the content. This is fixed in version 0.6.2.6 by cjosejwesetcekaescbc() generating the CEK from RANDbytes. A regression test asserts that the encryptedkey differs across two encryptions for each AES-CBC-HMAC variant. Until upgrading, for data encrypted with cjose, three options are available. Use an AES-GCM enc (A128GCM / A192GCM / A256GCM) instead of an AES-CBC-HMAC enc, use alg=dir with a caller-supplied CEK, or avoid using cjose for JWE encryption with the affected algorithm pair. These are mitigations for new ciphertexts only; data already encrypted under the zero key remains compromised and should be re-encrypted (and any secrets it contained rotated).
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
OpenIDC/cjoseto a version that resolves this vulnerability.Fixed in 0.6.2.6 - Configuration
Use an AES-GCM content-encryption algorithm instead of A128CBC-HS256, A192CBC-HS384, or A256CBC-HS512 for new ciphertexts.
cjose JWE enc = A128GCM, A192GCM, or A256GCM - Configuration
Until upgrading, use alg=dir with a caller-supplied content-encryption key for new ciphertexts.
cjose JWE alg = dir with caller-supplied CEK - Compensating control
Until upgrading, avoid using cjose for JWE encryption with the affected AES-CBC-HMAC algorithm pairs.
- Operational
Re-encrypt data already encrypted under the zero key and rotate any secrets contained in that data.
Event History
Frequently Asked Questions
Which JWE encryptions are affected?
JWE encryption is affected in cjose versions 0.6.1 through 0.6.2.5 when using A128CBC-HS256, A192CBC-HS384, or A256CBC-HS512 with a key-management algorithm that generates a fresh CEK. The issue does not describe the same condition for AES-GCM encryption or for alg=dir with a caller-supplied CEK.
What can an attacker do with an affected JWE?
Anyone who obtains an affected JWE can recover its plaintext. They can also forge or modify its content because encryption and authentication use a fixed, publicly known all-zero CEK.
How can teams mitigate the issue before upgrading?
For new ciphertexts, use an AES-GCM enc value such as A128GCM, A192GCM, or A256GCM; use alg=dir with a caller-supplied CEK; or avoid cjose JWE encryption for the affected algorithm combinations. These mitigations apply only to newly created ciphertexts.
What should be done about existing ciphertexts?
Ciphertexts created under the affected conditions were encrypted and authenticated with the zero key, so obtaining the JWE is sufficient to expose or alter its content. Upgrading to version 0.6.2.6 fixes CEK generation for subsequent affected AES-CBC-HMAC encryptions, but does not change previously produced JWE objects.