{"id":"CVE-2025-24898","aliases":["CVE-2025-24898","GHSA-rpmj-rpgj-qmpm","RUSTSEC-2025-0004"],"related":[],"kind":"vulnerability","state":"published","title":"rust openssl ssl::select_next_proto use after free","summary":"rust-openssl is a set of OpenSSL bindings for the Rust programming language. In affected versions `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 `sever` 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. The crate`openssl` version 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. Users are advised to upgrade. In 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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"rust-openssl is a set of OpenSSL bindings for the Rust programming language. In affected versions `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 `sever` 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. The crate`openssl` version 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. Users are advised to upgrade. In 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.","source":"cvelist"},{"lang":"en","text":"### 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","format":"markdown","source":"ghsa"},{"lang":"en","text":"In `openssl` versions before `0.10.70`, `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`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\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```","format":"markdown","source":"rustsec"},{"lang":"es","text":"rust-openssl es un conjunto de enlaces OpenSSL para el lenguaje de programación Rust. En las versiones afectadas, `ssl::select_next_proto` puede devolver un fragmento que apunta al búfer del argumento `server` pero con un tiempo de vida vinculado al argumento `client`. En situaciones en las que el tiempo de vida del búfer `sever` es más corto que el del `client`, esto puede provocar un use after free. Esto podría provocar que el servidor se bloquee o que devuelva contenido de memoria arbitrario al cliente. La versión 0.10.70 del paquete `openssl` corrige la firma de `ssl::select_next_proto` para restringir adecuadamente el tiempo de vida del búfer de salida al de ambos búferes de entrada. Se recomienda a los usuarios que actualicen. En el uso estándar de `ssl::select_next_proto` en la devolución de llamada pasada a `SslContextBuilder::set_alpn_select_callback`, el código solo se ve afectado si el búfer `servidor` se construye *dentro* de la devolución de llamada.","source":"nvd"}],"published":"2025-02-02T12:00:00.000Z","modified":"2026-10-12T18:00:12.406Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","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":6.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","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":6.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","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","rating":"MEDIUM"}],"cwes":["CWE-416"],"affected":[{"ranges":[{"version":">= 0.10.0, < 0.10.70","status":"affected"}],"vendor":"sfackler","product":"rust-openssl","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0.10.0","status":"affected","fixed":"0.10.70"}],"ecosystem":"crates.io","package":"openssl","purl":"pkg:cargo/openssl","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.10.70"}],"ecosystem":"crates.io","package":"openssl","purl":"pkg:cargo/openssl","source":"rustsec"}],"references":[{"url":"https://github.com/sfackler/rust-openssl/security/advisories/GHSA-rpmj-rpgj-qmpm","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/sfackler/rust-openssl/pull/2360","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://crates.io/crates/openssl","tags":["package","web","x-refsource-misc"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/02/msg00009.html","tags":["web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-24898","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/sfackler/rust-openssl/commit/f014afb230de4d77bc79dea60e7e58c2f47b60f2","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/sfackler/rust-openssl","tags":["package"],"sources":["ghsa"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2025-0004.html","tags":["advisory","web"],"sources":["ghsa","rustsec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2025-02-03T18:16:43.147Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-24898","url":"https://www.cve.org/CVERecord?id=CVE-2025-24898","licence":"CVE Terms of Use","modified":"2025-02-12T20:51:24.929Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-rpmj-rpgj-qmpm","url":"https://github.com/advisories/GHSA-rpmj-rpgj-qmpm","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:06.186Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2025-0004","url":"https://rustsec.org/advisories/RUSTSEC-2025-0004.html","licence":"CC0-1.0","modified":"2026-10-12T18:00:12.406Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-24898","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-24898","licence":"Public domain","modified":"2026-06-17T08:59:48.490Z"}],"updatedAt":"2026-11-25T22:58:53.753Z","epss":{"score":0.00676,"percentile":0.53496,"date":"2026-12-01T12:00:22.000Z"}}