Skip to content
OpenAdvisories
High · 7.5 CVE-2024-26130 EUVD-2024-0031GHSA-6vqw-3v5j-54x4PYSEC-2024-225

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

Published Feb 21, 2024 · Updated Aug 14, 2024 · Assigned by GitHub_M

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 products

VendorProductAffectedFixed
pyca cryptography >= 38.0.0, < 42.0.4 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 python-cryptography 42.0.5-1 —
Debian 13 python-cryptography 42.0.5-1 —
Debian 12 python-cryptography 38.0.4-3+deb12u1 —
ReleasePackageFixed inAdvisory
Ubuntu 24.04 LTS python-cryptography 41.0.7-4ubuntu0.1 USN-6673-3
Ubuntu 22.04 LTS python-cryptography 3.4.8-1ubuntu2.2 USN-6673-1
Ubuntu 20.04 LTS python-cryptography 2.8-3ubuntu0.3 USN-6673-1
Show 1 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 18.04 LTS python-cryptography 2.1.4-1ubuntu1.4+esm1 USN-6673-1
ReleasePackageFixed inAdvisory
RHEL 9 python3.12-cryptography 41.0.7-2.el9_6.1 RHSA-2025:15608
Show 6 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Red Hat Satellite Capsule 6 python-cryptography +1 42.0.8-1.el8pc RHSA-2024:7987
Red Hat Satellite Capsule 6 python-django +1 4.2.15-1.el8pc RHSA-2024:7987
Red Hat Satellite Capsule 6 python-gunicorn +1 22.0.0-1.el8pc RHSA-2024:7987
Red Hat Satellite 6 python-cryptography +1 42.0.8-1.el8pc RHSA-2024:7987
Red Hat Satellite 6 python-django +1 4.2.15-1.el8pc RHSA-2024:7987
Red Hat Satellite 6 python-gunicorn +1 22.0.0-1.el8pc RHSA-2024:7987
Red Hat Satellite 6 rubygem-foreman_theme_satellite 13.3.0-0.1.el8sat RHSA-2024:7987
Red Hat Satellite 6 yggdrasil-worker-forwarder 0.0.3-2.el8sat RHSA-2024:7987
Red Hat Rhui 4 python-aiohttp +1 3.9.4-1.el8ui RHSA-2025:1335
Red Hat Rhui 4 python-cryptography +1 42.0.8-1.el8ui RHSA-2025:1335
Red Hat Rhui 4 python-django +1 4.2.15-1.el8ui RHSA-2025:1335
Red Hat Rhui 4 python-grpcio +1 1.65.4-1.el8ui RHSA-2025:1335
Red Hat Rhui 4 python-gunicorn +1 22.0.0-1.0.1.el8ui RHSA-2025:1335
Red Hat Rhui 4 python-jinja2 +1 3.1.4-1.el8ui RHSA-2025:1335
Red Hat Rhui 4 python-requests +1 2.32.3-2.el8ui RHSA-2025:1335
Red Hat Rhui 4 python-sqlparse +1 0.5.0-1.el8ui RHSA-2025:1335
Red Hat Ansible Automation Platform Inside 2 python-black +1 22.8.0-2.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform Inside 2 python-cryptography +1 42.0.5-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform Inside 2 python-jinja2 +1 3.1.4-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform Inside 2 python39-black +1 22.8.0-2.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform Inside 2 python39-cryptography +1 42.0.5-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform Inside 2 python39-jinja2 +1 3.1.4-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform Inside 2 receptor +1 1.4.8-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform Developer 2 python-black +1 22.8.0-2.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform Developer 2 python-cryptography +1 42.0.5-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform Developer 2 python-idna +1 3.7-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform Developer 2 python-jinja2 +1 3.1.4-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform Developer 2 python-requests +1 2.32.2-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform Developer 2 python39-black +1 22.8.0-2.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform Developer 2 python39-cryptography +1 42.0.5-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform Developer 2 python39-idna +1 3.7-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform Developer 2 python39-jinja2 +1 3.1.4-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform Developer 2 python39-requests +1 2.32.2-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform Developer 2 receptor +1 1.4.8-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 automation-controller-venv-tower 4.5.7-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 automation-hub +2 4.9.2-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python-aiohttp +1 3.9.5-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python-black +1 22.8.0-2.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python-cryptography +1 42.0.5-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python-galaxy-ng +1 4.9.2-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python-gunicorn +1 22.0.0-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python-idna +1 3.7-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python-jinja2 +1 3.1.4-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python-pillow +1 10.3.0-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python-pydantic +1 1.10.15-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python-requests +1 2.32.2-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python-social-auth-app-django +1 5.4.1-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python-sqlparse +1 0.5.0-1.el9ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python39-aiohttp +1 3.9.5-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python39-black +1 22.8.0-2.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python39-cryptography +1 42.0.5-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python39-gunicorn +1 22.0.0-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python39-idna +1 3.7-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python39-jinja2 +1 3.1.4-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python39-pillow +1 10.3.0-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python39-pydantic +1 1.10.15-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python39-requests +1 2.32.2-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python39-social-auth-app-django +1 5.4.1-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 python39-sqlparse +1 0.5.0-1.el8ap RHSA-2024:3781
Red Hat Ansible Automation Platform 2 receptor +1 1.4.8-1.el8ap RHSA-2024:3781

AlmaLinux

Errata ↗
ReleasePackageFixed inAdvisory
AlmaLinux 9 python3.12-cryptography 41.0.7-2.el9_6.1 ALSA-2025:15608

Rocky Linux

Errata ↗
ReleasePackageFixed inAdvisory
Rocky Linux 9 python3.12-cryptography 41.0.7-2.el9_6.1 RLSA-2025:15608
ReleasePackageFixed inAdvisory
SLES 3 python-cryptography 41.0.3-150400.16.15.1 SUSE-SU-2024:2138-1, SUSE-SU-2024:0763-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed python-cryptography 42.0.4-1.1 openSUSE-SU-2026:11468-1, openSUSE-SU-2024:13710-1
openSUSE Leap 15.6 python-cryptography 41.0.3-150600.23.3.1 SUSE-SU-2024:2138-1
openSUSE Leap 15.5 python-cryptography 41.0.3-150400.16.15.1 SUSE-SU-2024:0763-1

Oracle Linux

ReleasePackageFixed inAdvisory
Oracle Linux 9 python3.12-cryptography 41.0.7-2.el9_6.1 ELSA-2025-15608
Oracle Linux 8 python3.12-cryptography 41.0.7-1.0.1.el8 ELSA-2025-20364

Wolfi

ReleasePackageFixed inAdvisory
Wolfi rolling airflow 2.10.5-r44 —
Wolfi rolling az +1 2.58.0-r0 —
Wolfi rolling ggshield 1.25.0-r0 —
Wolfi rolling kubeflow-pipelines 2.0.5-r3 —
Wolfi rolling mitmproxy 12.2.1-r0 —
Wolfi rolling py3-cassandra-medusa +1 0.19.1-r1 —
Wolfi rolling py3-cryptography 42.0.4-r0 —

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI cryptography >= 38.0.0, < 42.0.4 42.0.4 GHSA-6vqw-3v5j-54x4

Advisories 25

References