Email me

Rust advisories / openssl

Vulnerability MediumRUSTSEC-2025-0004 · openssl

RUSTSEC-2025-0004: ssl::select_next_proto use after free

Short answerA security vulnerability in the openssl crate: ssl::select_next_proto use after free. GitHub rates it Medium. Fixed in 0.10.70: update to a fixed version.

Crateopenssl
TypeVulnerability (memory-exposure)
Affected versionsBefore 0.10.70.
Fixed in0.10.70
SeverityMedium (GitHub rating)
Published2025-02-02
Last changed2026-10-12
Also known asCVE-2025-24898, GHSA-rpmj-rpgj-qmpm
Affected functionsopenssl::ssl::select_next_proto

What to do

  1. See which version you have: cargo tree -i openssl (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p openssl. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example openssl = "0.10.70") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

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:

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:

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:

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)
});

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Other advisories for openssl

Full security history of openssl

Up next

Same crateopenssl: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ