ssl::select_next_proto use after free
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. `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. 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. For example: Not vulnerable - the server buffer has a `'static` lifetime: ```rust builder.set_alpn_select_callback(|_, client_protos| { ssl::select_next_proto(b"\x02h2", client_protos).ok_or_else(AlpnError::NOACK) }); ``` Not vulnerable - the server buffer outlives the handshake: ```rust let server_protos = b"\x02h2".to_vec(); builder.set_alpn_select_callback(|_, client_protos| { ssl::select_next_proto(&server_protos, client_protos).ok_or_else(AlpnError::NOACK) }); ``` Vulnerable - the server buffer is freed when the callback returns: ```rust builder.set_alpn_select_callback(|_, client_protos| { let server_protos = b"\x02h2".to_vec(); ssl::select_next_proto(&server_protos, client_protos).ok_or_else(AlpnError::NOACK) }); ```
- Products
- openssl
- Affected versions
- Not specified
- Fixed versions
- 0.10.70
- CVEs
- CVE-2025-24898
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 30 Oct 2026, 08:44 UTC · Revision 1
Source evidence
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. `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. 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. For example: Not vulnerable - the server buffer has a `'static` lifetime: ```rust builder.set_alpn_select_callback(|_, client_protos| { ssl::select_next_proto(b"\x02h2", client_protos).ok_or_else(AlpnError::NOACK) }); ``` Not vulnerable - the server buffer outlives the handshake: ```rust let server_protos = b"\x02h2".to_vec(); builder.set_alpn_select_callback(|_, client_protos| { ssl::select_next_proto(&server_protos, client_protos).ok_or_else(AlpnError::NOACK) }); ``` Vulnerable - the server buffer is freed when the callback returns: ```rust builder.set_alpn_select_callback(|_, client_protos| { let server_protos = b"\x02h2".to_vec(); ssl::select_next_proto(&server_protos, client_protos).ok_or_else(AlpnError::NOACK) }); ```
osv:RUSTSEC-2025-0004
openssl
Fixed versions: 0.10.70
Complete source record
{
"id": "7313123958d569714cba69b341e5f9f375d5fb7e05d7d432753ec98881d2454b",
"url": "https://osv.dev/vulnerability/RUSTSEC-2025-0004",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "ssl::select_next_proto use after free",
"summary": "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. `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. 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. For example: Not vulnerable - the server buffer has a `'static` lifetime: ```rust builder.set_alpn_select_callback(|_, client_protos| { ssl::select_next_proto(b\"\\x02h2\", client_protos).ok_or_else(AlpnError::NOACK) }); ``` Not vulnerable - the server buffer outlives the handshake: ```rust let server_protos = b\"\\x02h2\".to_vec(); builder.set_alpn_select_callback(|_, client_protos| { ssl::select_next_proto(&server_protos, client_protos).ok_or_else(AlpnError::NOACK) }); ``` Vulnerable - the server buffer is freed when the callback returns: ```rust builder.set_alpn_select_callback(|_, client_protos| { let server_protos = b\"\\x02h2\".to_vec(); ssl::select_next_proto(&server_protos, client_protos).ok_or_else(AlpnError::NOACK) }); ```",
"evidence": "osv:RUSTSEC-2025-0004",
"products": [
{
"name": {
"value": "openssl",
"evidence": "/affected/0/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "0.10.70",
"evidence": "/affected/0/ranges"
}
],
"affected_versions": []
}
],
"severity": "unknown",
"structured": {
"id": "RUSTSEC-2025-0004",
"aliases": [
"CVE-2025-24898",
"GHSA-rpmj-rpgj-qmpm",
"RUSTSEC-2025-0004"
],
"affected": [
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0.0.0-0"
},
{
"fixed": "0.10.70"
}
]
}
],
"package": {
"name": "openssl",
"purl": "pkg:cargo/openssl",
"ecosystem": "crates.io"
},
"database_specific": {
"cvss": null,
"source": "https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2025-0004.json",
"categories": [
"memory-exposure"
],
"informational": null
},
"ecosystem_specific": {
"affects": {
"os": [],
"arch": [],
"functions": [
"openssl::ssl::select_next_proto"
]
},
"affected_functions": null
}
}
],
"modified": "2026-10-12T18:00:12.406916247Z",
"provider": "osv",
"references": [
"https://crates.io/crates/openssl",
"https://rustsec.org/advisories/RUSTSEC-2025-0004.html",
"https://github.com/sfackler/rust-openssl/pull/2360"
],
"provider_metadata": {
"license": "CC0-1.0"
}
},
"related_cves": [
{
"value": "CVE-2025-24898",
"evidence": "/aliases"
}
],
"security_relevant": true,
"severity_evidence": null
},
"source_id": "core-osv",
"document_id": 306432,
"published_at": "2025-02-02T12:00:00+00:00"
}