Summary
Netty's OHTTP HPKE implementation can include complete private-key bytes in object representations or initialization exception messages. If an application logs those objects or exceptions, readers of the resulting logs or telemetry may recover usable keys and undermine message confidentiality or authenticity.
Affected context
The issue is in the BoringSSL-backed HPKE classes in netty-incubator-codec-ohttp. It becomes risky in applications that log affected key-pair objects or initialization exceptions, because their string representations may contain private-key material. Exposure depends on whether those messages are recorded and who can access the resulting logs or telemetry.
Exploit preconditions
- Attack surface: Application logs, telemetry, or other records containing affected object or exception text
- Required access: Ability to read records containing the private-key material
- Trigger point: Logging a key-pair object or an initialization exception that includes rejected private-key bytes
- Why exposure is possible: String representations and an exception message may include complete private-key bytes, and logging can persist them
Why this happens
Sensitive cryptographic material is rendered in string representations and exception messages. When applications log those values, private keys can be written to persistent records. This primarily maps to CWE-532: Insertion of Sensitive Information into Log File; disclosure also relates to CWE-200, while storing the key in logs relates to CWE-312.
Potential impact
- An individual with access to affected records may recover HPKE private-key material.
- While a recovered key remains usable, an attacker could compromise OHTTP message confidentiality or authenticity expectations.
- Persisted copies in logs or telemetry could extend exposure beyond the key's original storage location.
General mitigation guidance
Defensive patterns focus on keeping secrets out of diagnostic output and limiting the reach of any records that may contain sensitive data.
- Use secure-by-default string representations that omit or redact private-key material.
- Keep cryptographic secrets out of exception messages and routine logs; log non-sensitive error context instead.
- Reduce trust in and exposure of diagnostic inputs by avoiding unnecessary serialization of secret-bearing objects.
- Restrict access to logs and telemetry using least privilege, and apply retention and redaction controls.
- Review existing records for sensitive material and handle any exposed keys according to applicable key-management practices.
How teams detect issues like this
- Use static analysis or secret-scanning rules to flag private-key fields and byte arrays included in
toStringmethods, exception messages, or logging calls. - Review code paths that stringify cryptographic objects and error paths that report rejected key material.
- Enforce logging policies that prohibit secrets and require redaction of sensitive values.
- Inspect logs and telemetry for encoded or recognizable private-key material, while accounting for the possibility of incomplete or transformed records.
- Automated code-review tools can help identify secret-bearing values passed to logging APIs.

