The vulnerability stems from the way HPKE (Hybrid Public Key Encryption) context operations handled failures in netty-incubator-codec-ohttp. Specifically, functions like export and expand in the HPKEContext implementations (BoringSSLHPKEContext and BouncyCastleHPKEContext) would produce an empty or zero-filled byte array upon internal failure, rather than signaling an error to the caller. This behavior was particularly dangerous because the output of these functions is used as keying material for cryptographic operations.
The root cause is the lack of robust error handling between the Java code and the underlying cryptographic libraries (BoringSSL native and BouncyCastle). When a failure occurred, for instance in the native EVP_HPKE_CTX_export or HKDF_expand functions, the Java layer would receive a zeroed array but treat it as a valid secret.
The function io.netty.incubator.codec.ohttp.OHttpCrypto.createResponseAEAD directly consumed this potentially compromised secret from HPKEContext.export to derive an AEAD (Authenticated Encryption with Associated Data) key for encrypting HTTP responses. A silent failure in export would lead to a deterministic, all-zero key, allowing an attacker who can trigger such a failure to predict the encryption key and decrypt the response.
The patch addresses this by modifying the HPKEContext interface and its implementations to throw a CryptoException on failure. The native BoringSSL code was also updated to return NULL on failure, which the Java wrapper now checks for. This ensures that any failure during key derivation is properly propagated and handled, preventing the use of insecure, predictable keys.