{"id":"GHSA-g433-pq76-6cmf","aliases":["GHSA-g433-pq76-6cmf","RUSTSEC-2026-0069","RUSTSEC-2026-0070","RUSTSEC-2026-0071","RUSTSEC-2026-0072"],"related":[],"kind":"vulnerability","state":"published","title":"Bug fixes in hpke-rs, hpke-rs-rust-crypto","summary":"We publish a GitHub security advisory for any releases whose CHANGELOG includes bug-fixes, and encourage our users to upgrade. The latest releases of the hpke-rs and hpke-rs-rust-crypto crates contain the following bug-fixes:\n\n## hpke-rs\n- [#127](https://github.com/cryspen/hpke-rs/pull/127): Fix `KemAlgorithm::TryFrom<u16>` mapping where `0x004D` incorrectly resolved to `XWingDraft06` instead of `XWingDraft06Obsolete`.\n- [#123](https://github.com/cryspen/hpke-rs/pull/123): Fix potential overflow in context counter and switch to use u64.\n- [#128](https://github.com/cryspen/hpke-rs/pull/128): Return errors when trying to use open/seal with export only ciphersuite and when using kdf export with an output that's too long (instead of truncating it)\n\nThe issue fixed in #123 was first reported by Nadim Kobeissi.\nThe issues fixed in #127 and #128 were first reported by Scott Arciszewski.\n\n## hpke-rs-rust-crypto\n- [#124](https://github.com/cryspen/hpke-rs/pull/124): Error out on x25519 0 keys\n\nThe issue fixed in #124 was first reported by Nadim Kobeissi.","summaryFormat":"markdown","summarySource":"ghsa","descriptions":[{"lang":"en","text":"We publish a GitHub security advisory for any releases whose CHANGELOG includes bug-fixes, and encourage our users to upgrade. The latest releases of the hpke-rs and hpke-rs-rust-crypto crates contain the following bug-fixes:\n\n## hpke-rs\n- [#127](https://github.com/cryspen/hpke-rs/pull/127): Fix `KemAlgorithm::TryFrom<u16>` mapping where `0x004D` incorrectly resolved to `XWingDraft06` instead of `XWingDraft06Obsolete`.\n- [#123](https://github.com/cryspen/hpke-rs/pull/123): Fix potential overflow in context counter and switch to use u64.\n- [#128](https://github.com/cryspen/hpke-rs/pull/128): Return errors when trying to use open/seal with export only ciphersuite and when using kdf export with an output that's too long (instead of truncating it)\n\nThe issue fixed in #123 was first reported by Nadim Kobeissi.\nThe issues fixed in #127 and #128 were first reported by Scott Arciszewski.\n\n## hpke-rs-rust-crypto\n- [#124](https://github.com/cryspen/hpke-rs/pull/124): Error out on x25519 0 keys\n\nThe issue fixed in #124 was first reported by Nadim Kobeissi.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Passing values `length > 65535` to `Context::export` produces output\nthat disagrees with the RFC 9180 label encoding. In particular the\nlength value is cast to `u16` truncating any value exceeding\n65535.\n\n## Impact\nApplications that use hpke-rs to export very large secrets would\nexperience interoperability issues with other applications that use a\ncorrect implementation to export very large secrets.\n\n## Mitigation\nStarting with version `0.6.0`, an error will be returned when\nattempting to call `Context::export` with an output length > 65535.","format":"markdown","source":"rustsec"},{"lang":"en","text":"Constructing an HPKE Context with the AEAD algorithm set to\n`HpkeExport` resulted in a panic when calling `Context::seal`, or\n`Context::open`. This was due to an underflowing integer subtraction\nwhen calculating the length of a vector allocation for the AEAD nonce,\nwhich would panic on its own in debug mode and cause out-of-memory\nabort on the allocation in release mode.\n\n## Impact\nApplications that could be made to use an HPKE context configured with\n`HpkeExport` as AEAD algorithm to open or seal a ciphertext would\ncrash. Other applications are unaffected.\n\n## Mitigation\nStarting with version `0.6.0`, an error will be returned when\nattempting to call `Context::seal` or `Context::open` on an HPKE\ncontext with `HpkeExport` as AEADAlgorithm.","format":"markdown","source":"rustsec"},{"lang":"en","text":"The sequence number that is used to compute the AEAD nonce when using\na re-usable HPKE context is incremented after each seal or open\noperation. This sequence number was stored as a `u32` and used regular\naddition on `u32` for the increment, meaning in release mode it would\nsilently wrap around to 0 after 2^32 seal or open operations.\n\n## Impact\nNonce reuse causes catastrophic breakage of AEAD ciphers, enabling\nplaintext recovery attacks and authentication tag forgeries, depending\non the concrete AEAD.\n\nThis bug impacts applications that use hpke-rs to encrypt a large\nnumber of messages using the same context. Applications using the\none-shot APIs are unaffected.\n\n## Mitigation\nStarting with version `0.6.0`, `checked_add` is used to increment the\nsequence number, which avoids a silent wraparound in release\nmode. Additionally, the sequence number is now stored as a `u64`,\nincreasing the maximally allowed number of seal and open operations on\na given HPKE context.","format":"markdown","source":"rustsec"},{"lang":"en","text":"Computing an X25519 shared secret with\n`x25519_dalek::StaticSecret::diffie_hellman` does not include the\ncheck that the key exchange was contributory, i.e. does not ensure on\nits own that the resulting shared secret is non-zero.\n\n## Impact\nRFC 9180 mandates that implementations of HPKE must check for all zero\nDiffie-Hellman shared secrets and abort if so.\n\nApplications using hpke-rs with the RustCryto provider would not\nperform this check allowing for non-contributive Diffie-Hellman shared\nsecrets. Applications using hpke-rs with the libcrux provider are not\naffected.\n\n## Mitigation\nStarting with version `0.6.0`, an error will be returned when\nthe computed Diffie-Hellman shared secret is all-zero.","format":"markdown","source":"rustsec"}],"published":"2026-02-04T12:00:00.000Z","modified":"2026-03-25T21:48:54.711Z","severity":{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","rating":"HIGH"},"severities":[{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","rating":"HIGH"},{"scorer":"RustSec Advisory Database","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"},{"scorer":"RustSec Advisory Database","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N"}],"cwes":["CWE-20","CWE-190","CWE-697"],"affected":[{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.6.0"}],"ecosystem":"crates.io","package":"hpke-rs","purl":"pkg:cargo/hpke-rs","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.6.0"}],"ecosystem":"crates.io","package":"hpke-rs-rust-crypto","purl":"pkg:cargo/hpke-rs-rust-crypto","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.6.0"}],"ecosystem":"crates.io","package":"hpke-rs","purl":"pkg:cargo/hpke-rs","source":"rustsec"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.6.0"}],"ecosystem":"crates.io","package":"hpke-rs","purl":"pkg:cargo/hpke-rs","source":"rustsec"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.6.0"}],"ecosystem":"crates.io","package":"hpke-rs","purl":"pkg:cargo/hpke-rs","source":"rustsec"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.6.0"}],"ecosystem":"crates.io","package":"hpke-rs-rust-crypto","purl":"pkg:cargo/hpke-rs-rust-crypto","source":"rustsec"}],"references":[{"url":"https://github.com/cryspen/hpke-rs/security/advisories/GHSA-g433-pq76-6cmf","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/cryspen/hpke-rs/pull/123","tags":["web"],"sources":["ghsa","rustsec"]},{"url":"https://github.com/cryspen/hpke-rs/pull/124","tags":["web"],"sources":["ghsa","rustsec"]},{"url":"https://github.com/cryspen/hpke-rs/pull/127","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/cryspen/hpke-rs/pull/128","tags":["web"],"sources":["ghsa","rustsec"]},{"url":"https://github.com/cryspen/hpke-rs/commit/1c247b5c9aeca602ad2971c9bd49817fe2c308e6","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/cryspen/hpke-rs/commit/25248bd624cc0325c98a05c169a0c9aa0aced632","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/cryspen/hpke-rs/commit/3a8254938f43bdc4e0c9c4f987f8071f19779066","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/cryspen/hpke-rs/commit/b54c8bb83906331bdf4f606cafa30cd7fd20b531","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/cryspen/hpke-rs","tags":["package"],"sources":["ghsa"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0070.html","tags":["advisory","web"],"sources":["ghsa","rustsec"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0072.html","tags":["advisory","web"],"sources":["ghsa","rustsec"]},{"url":"https://crates.io/crates/hpke-rs","tags":["package"],"sources":["rustsec"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0069.html","tags":["advisory"],"sources":["rustsec"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0071.html","tags":["advisory"],"sources":["rustsec"]},{"url":"https://crates.io/crates/hpke-rs-rust-crypto","tags":["package"],"sources":["rustsec"]}],"credits":[],"sources":[{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-g433-pq76-6cmf","url":"https://github.com/advisories/GHSA-g433-pq76-6cmf","licence":"CC-BY-4.0","modified":"2026-03-25T21:48:54.711Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0069","url":"https://rustsec.org/advisories/RUSTSEC-2026-0069.html","licence":"CC0-1.0","modified":"2026-03-24T08:41:23.142Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0070","url":"https://rustsec.org/advisories/RUSTSEC-2026-0070.html","licence":"CC0-1.0","modified":"2026-03-24T08:41:23.142Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0071","url":"https://rustsec.org/advisories/RUSTSEC-2026-0071.html","licence":"CC0-1.0","modified":"2026-03-24T08:41:23.142Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0072","url":"https://rustsec.org/advisories/RUSTSEC-2026-0072.html","licence":"CC0-1.0","modified":"2026-03-24T08:41:23.142Z"}],"updatedAt":"2026-11-25T22:56:43.326Z"}