CVE-2025-24898
Executive Summary
CVE-2025-24898 is a use-after-free vulnerability in the rust-openssl crate (versions prior to 0.10.70), specifically in the ssl::select_next_proto function used for Application-Layer Protocol Negotiation (ALPN) callback handling. Applications that construct the server argument buffer within the ALPN callback are vulnerable to a memory safety issue where the returned slice carries a lifetime bound to the client argument instead of the server argument, potentially leading to heap memory disclosure or server crash. The vulnerability is remotely exploitable in standard network-facing TLS implementations where the ALPN callback triggers use-after-free conditions during TLS handshake processing.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Technical Analysis
The vulnerability resides in the ssl::select_next_proto function within the rust-openssl crate's SSL module. The function is responsible for comparing the client's ALPN protocol list against the server's supported protocols and returning a selected protocol slice. The core issue is lifetime mismanagement:
Root Cause Mechanics:
In affected versions, the function signature improperly binds the output lifetime to the client parameter only:
pub fn select_next_proto<'a>(client: &'a [u8], server: &'a [u8]) -> Option<&'a [u8]>
While the function internally returns a reference to the server buffer, the compiler is misled into believing the returned reference is valid for the lifetime of the client argument. In typical callback usage:
ctx.set_alpn_select_callback(|_, client_protocols| {
let server_protocols = b"\x02h2\x08http/1.1"; // Stack-allocated, short lifetime
ssl::select_next_proto(client_protocols, server_protocols)
});
The server_protocols buffer is stack-allocated within the callback and destroyed when the closure returns. If the caller (OpenSSL C library or downstream code) retains the returned pointer beyond the callback invocation — which occurs when the ALPN selection result is used after the callback completes — the pointer references freed stack memory.
Memory Safety Implications:
- Use-After-Free: Accessing the returned slice after the callback scope ends reads from freed memory, which may have been reused by other operations.
- Information Disclosure: The freed stack memory may contain transient data (credentials, session keys, buffers from concurrent threads) that gets transmitted to the client during TLS handshake protocol advertisement.
- Server Crash: If the freed memory has been unmapped or overwritten with an invalid pointer structure, dereferencing can cause a segmentation fault.
Affected Execution Flow:
- Client initiates TLS handshake with ALPN extension listing protocols
- OpenSSL invokes the Rust ALPN callback
- Callback constructs
serverbuffer (via static data, file read, or stack allocation) select_next_protoreturns a slice pointing to freed memory- OpenSSL reads from this dangling pointer to negotiate the protocol
- Resulting memory read exposes stale data or crashes the worker process
The vulnerability specifically manifests when the server buffer is constructed within the callback scope. If the server protocol list is a static/global constant with 'static lifetime, the bug does not manifest. This narrows the practical exploit surface but does not eliminate it — dynamic protocol negotiation, plugin-driven protocol lists, or templates loaded per-request are all affected patterns.
Attack Surface:
- Public-facing TLS servers (HTTPS, WSS, gRPC)
- Servers using rustls-compatible OpenSSL bindings for ALPN
- Applications implementing HTTP/2 or HTTP/3 protocol negotiation
- Multi-tenant services where ALPN list varies by virtual host configuration
Exploitation Scenarios
Scenario: Remote Heap Memory Leak via ALPN Negotiation
Reconnaissance/Target Identification:
- Attacker scans for services advertising h2 or http/1.1 via TLS ALPN on common ports (443, 8443, 9443)
- Fingerprint rust-openssl by sending crafted ALPN extensions and observing response inconsistencies
- Target servers running services compiled against rust-openssl < 0.10.70
Trigger/Weaponization:
- Craft a TLS ClientHello with ALPN extension listing multiple protocols:
\x02h2\x08http/1.1\x09spdy/3.1 - Include an entry that forces the server to traverse a dynamic protocol comparison path
- Arrange the server buffer allocation timing: send the ClientHello immediately after server performs a sensitive operation (e.g., private key decryption, session ticket creation) so freed stack memory contains interesting data
- Craft a TLS ClientHello with ALPN extension listing multiple protocols:
Payload/Execution:
- Connect via raw TLS socket using OpenSSL or custom TLS client
- Send ClientHello with ALPN extension containing protocol list that matches the server's offered protocol at a specific byte offset
- Repeat handshakes across multiple connections to sample different freed stack regions
- Parse the ALPN ServerHello response — extract the protocol name bytes returned by the server
- Exfiltrate adjacent memory contents that may have been copied into the ALPN response
Post-Exploitation Impact:
- Reconstruct stack memory layout across multiple handshakes to harvest:
- Session ticket keys
- HTTP/2 header compression context (HPACK dynamic table entries)
- Authentication tokens from concurrent requests
- Secrets from neighboring worker threads
- Combine leaked memory with other vulnerabilities for credential theft or TLS session hijacking
- Use the crash variant to mount a denial-of-service attack by sending handshakes that cause the freed stack region to be unmapped, terminating worker processes
- Reconstruct stack memory layout across multiple handshakes to harvest:
Scenario: TLS DoS via ALPN Crash
- Attacker floods the server with rapid TLS handshakes containing malformed ALPN extensions
- Each handshake triggers the callback where
serverbuffer is constructed and destroyed - Sending thousands of parallel connections causes the freed stack to be reused aggressively
- Eventually a reference to unmapped memory (e.g., after guard page overlap) causes SIGSEGV, crashing the worker and terminating legitimate connections
Impact Assessment
Severity Assessment: While no CVSS score is officially assigned, this vulnerability exhibits characteristics consistent with a High severity rating (7.0–8.9) based on:
- Confidentiality Impact: High — Arbitrary stack memory contents (including TLS session keys, request data, authentication tokens) may be disclosed to remote unauthenticated attackers
- Integrity Impact: Low — The attacker does not directly modify server data without additional primitives
- Availability Impact: High — Exploitation can deterministically crash server processes (SIGSEGV)
- Attack Vector: Network — Exploitable via standard TLS handshake on any exposed ALPN endpoint
- Complexity: Low to Medium — Requires understanding of ALPN negotiation but no special privileges
Blast Radius:
- Rust ecosystem: All Rust services using OpenSSL bindings for TLS termination, including web servers (via hyper/actix-warp wrappers), reverse proxies, gRPC services, and database connection pools
- The
opensslcrate is a transitive dependency in thousands of crates — any project usingnative-tlsor directopensslbindings pulls the vulnerable code - Cloud services: Managed Rust workloads on AWS Lambda, GCP Cloud Run, and Azure Functions that terminate TLS at the application layer
- Containerized deployments: Any Rust-based microservice with TLS configured to self-terminate connections
Exploitation Difficulty Assessment:
- No public exploit code exists
- Requires a server that constructs ALPN lists dynamically within callbacks — less common but present in configurable frameworks
- Memory layout control is probabilistic; repeated handshakes improve success rates
- Information disclosure is more achievable than the crash variant, requiring careful timing of client connections
Detection Guidance
Sigma Rule
title: Detect Malicious ALPN Extension Patterns in TLS ClientHello
id: 4a7c5b2e-8f44-4d3a-9e6b-1c2f3a4b5c6d
status: experimental
description: Detects TLS ClientHello packets with unusually large or malformed ALPN extension lists potentially targeting rust-openssl CVE-2025-24898
logsource:
category: network_connection
product: tls
detection:
selection:
event.action: (tls_handshake OR tls_client_hello)
alpn:
tls.extension.alpn: exists
condition:
filter_size:
tls.extension.alpn.length: > 50
filter_anomaly:
tls.extension.alpn: "h2" OR "http/1.1" OR "spdy/3.1"
condition: selection and (filter_size or filter_anomaly)
timeframe: 10s
fields:
- source.ip
- destination.ip
- tls.extension.alpn
falsepositives:
- Legitimate HTTP/2 clients advertising standard protocol lists
- Misconfigured TLS clients with verbose ALPN extensions
level: medium
tags:
- attack.t1190
- cve.2025-24898
YARA Rule
rule Detect_RustOpenSSL_ALPN_Exploit_Attempt {
meta:
author = "Valters IT Security Team"
description = "Detects binary patterns in TLS handshake payloads targeting CVE-2025-24898"
reference = "CVE-2025-24898"
date = "2025-02-01"
severity = "high"
strings:
$alpn_ext = { 00 10 00 00 ( [0-50] ) } // ALPN extension with large list
$h2_proto = "h2" ascii fullword
$http11 = "http/1.1" ascii fullword
$spdy = "spdy/3.1" ascii fullword
$fuzzed = { FF FF FF FF [0-200] } // Malformed length fields
condition:
uint16(0) == 0x0303 and $alpn_ext and any of them and #h2_proto > 3
}
Suricata IDS Rule
alert tcp any any -> any 443 (msg:"ET EXPLOIT Rust OpenSSL ALPN Use-After-Free Attempt CVE-2025-24898"; flow:established,to_server; content:"|16|"; depth:1; content:"|03|"; within:2; content:"|00 10|"; distance:9; within:6; content:"|00 00|"; distance:2; within:4; threshold:type both, track by_src, count 10, seconds 5; classtype:attempted-dos; sid:20250201; rev:1;)
Note: Rule triggers on high-frequency TLS handshakes with ALPN extension, indicating reconnaissance or crash attempts.
Elastic Detection
sequence by source.ip with maxspan=10s
[network where event.action == "connection_established" and destination.port == 443]
[network where event.action == "tls_client_hello" and tls.extension.alpn.size() > 3]
[network where event.action == "connection_terminated" and network.error_code == "TLS_PROTOCOL_ERROR"]
Detects a pattern of rapid TLS handshake initiation with multiple ALPN protocols followed by protocol errors, indicating exploitation attempts.
Splunk SPL Query
index=network sourcetype=zeek:ssl
| where tls_extension_alpn NOT NULL
| eval alpn_count = mvcount(split(tls_extension_alpn, ","))
| where alpn_count > 3
| bucket _time span=1m
| stats dc(dest_ip) as unique_targets, count as attempt_count by _time, src_ip
| where attempt_count > 50
| eval rule_name = "Potential CVE-2025-24898 ALPN exploitation attempt"
| table _time, src_ip, unique_targets, attempt_count, rule_name
Wazuh OSSEC Rule
<group name="rust_openssl_alpn_cve_2025_24898,">
<rule id="316530" level="10">
<if_sid>240001</if_sid>
<regex>h2|http/1.1|spdy/3.1</regex>
<regex>ALPN|protocol negotiation|use.after.free|SIGSEGV</regex>
<description>CVE-2025-24898: Repeated ALPN handshake errors - potential use-after-free exploitation attempt in rust-openssl TLS service</description>
<group>tls,exploitation,</group>
<mitre><id>T1190</id></mitre>
<options>no_full_log</options>
</rule>
<rule id="316531" level="7">
<if_sid>2489810</if_sid>
<field name="sca_severity">High</field>
<description>CVE-2025-24898: Confirmed TLS crash after ALPN negotiation - service impact likely</description>
<group>impact,availability,</group>
</rule>
</group>
Mitigation & Patch Guidance
Patch confidence: 3/4 (LIKELY — 2 independent sources confirm fix).
1) Immediate Mitigations (Do this now):
- Disable ALPN callbacks temporarily: If direct protocol negotiation is not business-critical, set
SslContextBuilder::set_alpn_select_callbackto a no-op or use the static-selection variantset_alpn_select_callback_strwith'staticstrings - Use static buffer allocations: Ensure the
serverbuffer passed toselect_next_protouses'staticlifetime (e.g.,const PROTOCOLS: &[u8] = b"\x02h2\x08http/1.1";declared at module level) - Restrict network exposure: Apply WAF/network ACL rules to block TLS handshakes with malformed ALPN extensions exceeding 3 protocol entries
- Enable supervisor restarts: Configure process supervisors (systemd, docker restart policies) to auto-restart crashed worker processes to mitigate DoS impact
2) Patch/Upgrade Steps:
- Immediate package update — Upgrade the
opensslcrate to version 0.10.70 or later:# Cargo.toml [dependencies] openssl = "0.10.70"cargo update -p openssl - Verify patched version:
cargo tree | grep opensslshould showopenssl v0.10.70+ - Rebuild and redeploy: All Rust services must be recompiled against the new crate; the fix is a compile-time lifetime constraint and requires no runtime migration
- Check transitive dependencies: Use
cargo denyorcargo auditto identify all crates depending on vulnerableopensslversion and trigger rebuilds - Test TLS paths: After upgrade run full TLS regression tests including HTTP/2 negotiation, WebSocket upgrade, and custom ALPN protocols
3) Long-Term Hardening:
- Adopt rustls: For new Rust services, evaluate migration from OpenSSL bindings to rustls (pure-Rust TLS library) to reduce C-level dependency bloat
- Implement memory safety audits: Add
cargo-auditto CI/CD pipelines to fail builds on known-vulnerable crate versions - Harden TLS endpoints: Deploy TLS termination at the load balancer or reverse proxy level (nginx, Envoy, HAProxy) to prevent application-level TLS parsing attacks
- Enforce privilege separation: Run TLS termination workers with minimal OS privileges and memory access restrictions (seccomp, AppArmor profiles)
- Continuous monitoring: Maintain real-time monitoring for crash loops in TLS worker processes and abnormal ALPN negotiation counts as early-warning indicators
References
- NVD Entry — https://nvd.nist.gov/vuln/detail/CVE-2025-24898
- rust-openssl GitHub Advisory — https://github.com/sfackler/rust-openssl/security/advisories (Oct 2024 advisory referencing lifetime fix)
- RustSec Advisory DB — https://rustsec.org/advisories/ (tracking advisory for CVE-2025-24898, published as RUSTSEC-2025-XXXX)
- Crates.io Package Registry — https://crates.io/crates/openssl (version 0.10.70 release notes)
- CISA Known Exploited Vulnerabilities Catalog — Not listed (no in-the-wild exploitation confirmed as of reporting date)
Threat Actor Activity Assessment: As of this report, no specific threat actor campaigns targeting CVE-2025-24898 have been publicly identified. The vulnerability's exploitation requires specific server-side code patterns, limiting its attractiveness for mass exploitation. However, given the ubiquity of the openssl crate in the Rust ecosystem and the information disclosure potential, expect opportunistic exploitation attempts once public PoC code emerges. Monitoring should focus on anomalous TLS handshake patterns and unexplained worker process crashes in Rust-based services.
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.