{"id":"GHSA-rpmj-rpgj-qmpm","revision":"99a4d00469df4b5f90e5d007a49752be","records":[{"revision":"99a4d00469df4b5f90e5d007a49752be","observedAt":"2026-10-24T13:19:54.901+00:00","statement":{"source":"osv","id":"GHSA-rpmj-rpgj-qmpm","aliases":["CVE-2025-24898","RUSTSEC-2025-0004"],"title":"rust-openssl ssl::select_next_proto use after free","description":"### Impact\n`ssl::select_next_proto` can return a slice pointing into the `server` argument's buffer but with a lifetime bound to the `client` argument. In situations where the `server` buffer's lifetime is shorter than the `client` buffer's, this can cause a use after free. This could cause the server to crash or to return arbitrary memory contents to the client.\n\n### Patches\n`openssl` 0.10.70 fixes the signature of `ssl::select_next_proto` to properly constrain the output buffer's lifetime to that of both input buffers.\n\n### Workarounds\nIn standard usage of `ssl::select_next_proto` in the callback passed to `SslContextBuilder::set_alpn_select_callback`, code is only affected if the `server` buffer is constructed *within* the callback. For example:\n\nNot vulnerable - the server buffer has a `'static` lifetime:\n```rust\nbuilder.set_alpn_select_callback(|_, client_protos| {\n    ssl::select_next_proto(b\"\\x02h2\", client_protos).ok_or_else(AlpnError::NOACK)\n});\n```\n\nNot vulnerable - the server buffer outlives the handshake:\n```rust\nlet server_protos = b\"\\x02h2\".to_vec();\nbuilder.set_alpn_select_callback(|_, client_protos| {\n    ssl::select_next_proto(&server_protos, client_protos).ok_or_else(AlpnError::NOACK)\n});\n```\n\nVulnerable - the server buffer is freed when the callback returns:\n```rust\nbuilder.set_alpn_select_callback(|_, client_protos| {\n    let server_protos = b\"\\x02h2\".to_vec();\n    ssl::select_next_proto(&server_protos, client_protos).ok_or_else(AlpnError::NOACK)\n});\n```\n\n### References\nhttps://github.com/sfackler/rust-openssl/pull/2360","state":0,"publishedAt":"2025-02-03T17:56:46+00:00","modifiedAt":"2026-09-10T03:50:06.1861802+00:00","affected":[{"ecosystem":"crates.io","name":"openssl","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0.10.0"},{"kind":"fixed","version":"0.10.70"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V4","vector":"CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"MODERATE"}],"references":["https://github.com/sfackler/rust-openssl/security/advisories/GHSA-rpmj-rpgj-qmpm","https://nvd.nist.gov/vuln/detail/CVE-2025-24898","https://github.com/sfackler/rust-openssl/pull/2360","https://github.com/sfackler/rust-openssl/commit/f014afb230de4d77bc79dea60e7e58c2f47b60f2","https://crates.io/crates/openssl","https://github.com/sfackler/rust-openssl","https://lists.debian.org/debian-lts-announce/2025/02/msg00009.html","https://rustsec.org/advisories/RUSTSEC-2025-0004.html"],"sourceUrl":"https://github.com/advisories/GHSA-rpmj-rpgj-qmpm","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-rpmj-rpgj-qmpm","identifiers":["GHSA-rpmj-rpgj-qmpm","CVE-2025-24898","RUSTSEC-2025-0004"]},"retained":false,"historicalAffected":[]}],"coverage":[]}