Vulnerability · Published Feb 21, 2024 · Assigned by GitHub_M

CVE-2024-26130cryptography NULL pointer deference with pkcs12.serialize_key_and_certificates when called with a non-matching certificate and private key and an hmac_hash override

High 7.5

In plain English

A high-severity null pointer dereference in cryptography from pyca. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.8% (higher than 58% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.5High
Exploit odds (30 days)0.8%top 42.3% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official description

cryptography is a package designed to expose cryptographic primitives and recipes to Python developers. Starting in version 38.0.0 and prior to version 42.0.4, if `pkcs12.serialize_key_and_certificates` is called with both a certificate whose public key did not match the provided private key and an `encryption_algorithm` with `hmac_hash` set (via `PrivateFormat.PKCS12.encryption_builder().hmac_hash(...)`, then a NULL pointer dereference would occur, crashing the Python process. This has been resolved in version 42.0.4, the first version in which a `ValueError` is properly raised.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
AlmaLinux:9python3.12-cryptography41.0.7-2.el9_6.1ALSA-2025:15608
Debian:12python-cryptography38.0.4-3+deb12u1DEBIAN-CVE-2024-26130
Debian:13python-cryptography42.0.5-1DEBIAN-CVE-2024-26130
Debian:14python-cryptography42.0.5-1DEBIAN-CVE-2024-26130
PyPIcryptography42.0.4PYSEC-2024-225
PyPIcryptography42.0.4GHSA-6vqw-3v5j-54x4
Rocky Linux:9python3.12-cryptography0:41.0.7-2.el9_6.1RLSA-2025:15608
Ubuntu:22.04:LTSpython-cryptography3.4.8-1ubuntu2.2USN-6673-1
Ubuntu:24.04:LTSpython-cryptography41.0.7-4ubuntu0.1USN-6673-3
Ubuntu:24.04:LTSpython-cryptography41.0.7-4ubuntu0.1UBUNTU-CVE-2024-26130

Affected products (as reported)

VendorProductVersions
pyca cryptography >= 38.0.0, < 42.0.4

Weakness: CWE-476 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

References