# CVE-2025-24898: rust openssl ssl::select_next_proto use after free

> A use-after-free in rust-openssl allows attackers to crash the server or leak memory contents via improper lifetime handling in ALPN selection.

- **Severity:** Medium 6.3 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 3 Feb 2025
- **Updated:** 12 Feb 2025
- **Also known as:** ALSA-2025:7147, ALSA-2025:7160, ALSA-2025:7241, ALSA-2025:7313, ALSA-2025:7317, AZL-56427, DEBIAN-CVE-2025-24898, DLA-4049-1, GHSA-rpmj-rpgj-qmpm, OESA-2025-1120, OESA-2025-1121, OESA-2026-3710, OESA-2026-3711, OESA-2026-3712, RHSA-2025:7147, RHSA-2025:7160, RHSA-2025:7241, RHSA-2025:7313, RHSA-2025:7317, RLSA-2025:7160, RLSA-2025:7241, RLSA-2025:7313, RLSA-2025:7317, RUSTSEC-2025-0004, UBUNTU-CVE-2025-24898, openSUSE-SU-2025:14814-1

## What is CVE-2025-24898?

CVE-2025-24898 is a medium-severity use after free vulnerability in sfackler rust-openssl, published on 3 Feb 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

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.

Weakness: CWE-416 (Use After Free)

## Which versions are affected by CVE-2025-24898?

3 open source packages ship an affected version, including openssl.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `openssl` | crates.io | From 0.0.0-0 | 0.10.70 |
| `openssl` | crates.io | From 0.10.0 | 0.10.70 |
| `openssl` | crates.io | From 0.10.0 | 0.10.70 |
| `bootc` | AlmaLinux:9 | All versions | 1.1.6-3.el9_6 |
| `bootupd` | AlmaLinux:9 | All versions | 0.2.27-3.el9 |
| `keylime-agent-rust` | AlmaLinux:9 | All versions | 0.2.2-2.el9 |
| `python3.12-cryptography` | AlmaLinux:9 | All versions | 41.0.7-2.el9 |
| `rpm-ostree` | AlmaLinux:9 | All versions | 2025.5-1.el9 |
| `rpm-ostree-libs` | AlmaLinux:9 | All versions | 2025.5-1.el9 |
| `system-reinstall-bootc` | AlmaLinux:9 | All versions | 1.1.6-3.el9_6 |
| `bootc` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.1.6-3.el9_6 |
| `bootc-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.1.6-3.el9_6 |
| `bootc-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.1.6-3.el9_6 |
| `bootupd` | Red Hat:enterprise_linux:9::appstream | All versions | 0:0.2.27-3.el9 |
| `bootupd-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:0.2.27-3.el9 |
| `keylime-agent-rust` | Red Hat:enterprise_linux:9::appstream | All versions | 0:0.2.2-2.el9 |
| `keylime-agent-rust-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:0.2.2-2.el9 |
| `keylime-agent-rust-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 0:0.2.2-2.el9 |
| `python3.12-cryptography` | Red Hat:enterprise_linux:9::appstream | All versions | 0:41.0.7-2.el9 |
| `python3.12-cryptography-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:41.0.7-2.el9 |
| `python3.12-cryptography-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 0:41.0.7-2.el9 |
| `rpm-ostree` | Red Hat:enterprise_linux:9::appstream | All versions | 0:2025.5-1.el9 |
| `rpm-ostree-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:2025.5-1.el9 |
| `rpm-ostree-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 0:2025.5-1.el9 |
| `rpm-ostree-libs` | Red Hat:enterprise_linux:9::appstream | All versions | 0:2025.5-1.el9 |
| `rpm-ostree-libs-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:2025.5-1.el9 |
| `rust-bootupd` | Red Hat:enterprise_linux:9::appstream | All versions | 0:0.2.27-3.el9 |
| `rust-bootupd-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 0:0.2.27-3.el9 |
| `system-reinstall-bootc` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.1.6-3.el9_6 |
| `system-reinstall-bootc-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.1.6-3.el9_6 |
| `bootc` | Rocky Linux:9 | All versions | 0:1.1.6-3.el9_6 |
| `keylime-agent-rust` | Rocky Linux:9 | All versions | 0:0.2.2-2.el9 |
| `python3.12-cryptography` | Rocky Linux:9 | All versions | 0:41.0.7-2.el9 |
| `rust-bootupd` | Rocky Linux:9 | All versions | 0:0.2.27-3.el9 |
| `obs-service-cargo` | openSUSE:Tumbleweed | All versions | 4.5.0-2.1 |

## How do I fix CVE-2025-24898?

Upgrade openssl to 0.10.70 or later.

## Is CVE-2025-24898 being exploited?

There is no known exploitation of CVE-2025-24898 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-24898 and fix it if it is affected.

What it is: CVE-2025-24898 is a medium-severity use after free vulnerability in sfackler rust-openssl, published on 3 Feb 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-24898 in the wild and no public exploit code.

Affected packages and fixed versions:
- openssl (crates.io): affected from 0.0.0-0; fixed in 0.10.70
- openssl (crates.io): affected from 0.10.0; fixed in 0.10.70
- openssl (crates.io): affected from 0.10.0; fixed in 0.10.70

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-24898/ (Markdown: https://insights.sbomify.com/CVE-2025-24898/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-24898
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-24898
- OSV: https://osv.dev/vulnerability/CVE-2025-24898

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-24898/
Summaries are generated and may contain mistakes; the official description above is the record.
