# CVE-2024-12797: RFC7250 handshakes with unauthenticated servers don't abort as expected

> Attackers can perform man-in-the-middle attacks against TLS clients using Raw Public Keys if server authentication failures are not explicitly checked.

- **Severity:** Medium 6.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 11 Feb 2025
- **Updated:** 18 Feb 2025
- **Also known as:** ALPINE-CVE-2024-12797, ALSA-2025:1330, AZL-56761, AZL-56774, AZL-78591, BELL-CVE-2024-12797, CLEANSTART-2026-CA76022, CLEANSTART-2026-XR87618, CLSA-2025-1750637629, CLSA-2025-1750637631, CLSA-2025-1751550314, CLSA-2025-1752624830, CLSA-2026-1772151044, DEBIAN-CVE-2024-12797, ECHO-6181-2240-677d, GHSA-79v4-65xg-pq4g, MINI-28qj-wm62-7w9w, MINI-j384-f4q6-cfjg, PYSEC-2026-1284, RHBA-2025:6314, RHSA-2025:1330, RLSA-2025:1330, ROOT-APP-PYPI-CVE-2024-12797, ROOT-OS-ALPINE-318-CVE-2024-12797, openSUSE-SU-2025:14802-1

## What is CVE-2024-12797?

CVE-2024-12797 is a medium-severity vulnerability in OpenSSL, published on 11 Feb 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Issue summary: Clients using RFC7250 Raw Public Keys (RPKs) to authenticate a
server may fail to notice that the server was not authenticated, because
handshakes don't abort as expected when the SSL_VERIFY_PEER verification mode
is set.

Impact summary: TLS and DTLS connections using raw public keys may be
vulnerable to man-in-middle attacks when server authentication failure is not
detected by clients.

RPKs are disabled by default in both TLS clients and TLS servers.  The issue
only arises when TLS clients explicitly enable RPK use by the server, and the
server, likewise, enables sending of an RPK instead of an X.509 certificate
chain.  The affected clients are those that then rely on the handshake to
fail when the server's RPK fails to match one of the expected public keys,
by setting the verification mode to SSL_VERIFY_PEER.

Clients that enable server-side raw public keys can still find out that raw
public key verification failed by calling SSL_get_verify_result(), and those
that do, and take appropriate action, are not affected.  This issue was
introduced in the initial implementation of RPK support in OpenSSL 3.2.

The FIPS modules in 3.4, 3.3, 3.2, 3.1 and 3.0 are not affected by this issue.

Weakness: CWE-392 (Missing Report of Error Condition)

## Which versions are affected by CVE-2024-12797?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `cryptography` | PyPI | From 42.0.0 | 44.0.1 |
| `cryptography` | PyPI | From 42.0.0 | 44.0.1 |
| `cryptography` | PyPI | From 42.0.0 | 44.0.1 |
| `openssl` | AlmaLinux:9 | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl-devel` | AlmaLinux:9 | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl-libs` | AlmaLinux:9 | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl-perl` | AlmaLinux:9 | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl` | Red Hat:enterprise_linux:10.0 | All versions | 1:3.2.2-16.el10 |
| `openssl-debuginfo` | Red Hat:enterprise_linux:10.0 | All versions | 1:3.2.2-16.el10 |
| `openssl-debugsource` | Red Hat:enterprise_linux:10.0 | All versions | 1:3.2.2-16.el10 |
| `openssl-devel` | Red Hat:enterprise_linux:10.0 | All versions | 1:3.2.2-16.el10 |
| `openssl-libs` | Red Hat:enterprise_linux:10.0 | All versions | 1:3.2.2-16.el10 |
| `openssl-libs-debuginfo` | Red Hat:enterprise_linux:10.0 | All versions | 1:3.2.2-16.el10 |
| `openssl-perl` | Red Hat:enterprise_linux:10.0 | All versions | 1:3.2.2-16.el10 |
| `openssl-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl-devel` | Red Hat:enterprise_linux:9::appstream | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl-libs-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl-perl` | Red Hat:enterprise_linux:9::appstream | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl` | Red Hat:enterprise_linux:9::baseos | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl-debuginfo` | Red Hat:enterprise_linux:9::baseos | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl-debugsource` | Red Hat:enterprise_linux:9::baseos | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl-libs` | Red Hat:enterprise_linux:9::baseos | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl-libs-debuginfo` | Red Hat:enterprise_linux:9::baseos | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl` | Rocky Linux:9 | All versions | 1:3.2.2-6.el9_5.1 |
| `openssl-3` | openSUSE:Tumbleweed | All versions | 3.2.4-1.1 |

## How do I fix CVE-2024-12797?

Upgrade cryptography to 44.0.1 or later.

## Is CVE-2024-12797 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-12797 and fix it if it is affected.

What it is: CVE-2024-12797 is a medium-severity vulnerability in OpenSSL, published on 11 Feb 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2024-12797 in the wild and no public exploit code.

Affected packages and fixed versions:
- cryptography (PyPI): affected from 42.0.0; fixed in 44.0.1
- cryptography (PyPI): affected from 42.0.0; fixed in 44.0.1
- cryptography (PyPI): affected from 42.0.0; fixed in 44.0.1

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-2024-12797/ (Markdown: https://insights.sbomify.com/CVE-2024-12797/index.md)
```

## Sources

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

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