# CVE-2024-26130: 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

- Severity: High 7.5 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.83%, higher than 58% of CVEs (2026-12-01)
- Published: 2024-02-21T16:28:18.632Z
- Modified: 2026-09-10T03:50:09.815Z
- Also known as: GHSA-6vqw-3v5j-54x4, PYSEC-2024-225
- Weaknesses: CWE-476
- SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial
- 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.

(As written by CVE List.)

## Affected

- pyca cryptography: >= 38.0.0, < 42.0.4
- cryptography_project cryptography: from 38.0.0 before 42.04
- cryptography (PyPI): from 38.0.0 before 42.0.4; before 97d231672763cdb5959a3b191e692a362f1b9e55
- cryptography.io cryptography: from 38.0.0 before 42.0.4

## Every score

- GitHub_M: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- GitHub: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- NVD: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- PyPA Advisory Database: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`

## References

- <https://github.com/pyca/cryptography/security/advisories/GHSA-6vqw-3v5j-54x4> (advisory, vendor-advisory, web)
- <https://github.com/pyca/cryptography/pull/10423> (fix, issue-tracking, patch, report, web)
- <https://github.com/pyca/cryptography/commit/97d231672763cdb5959a3b191e692a362f1b9e55> (fix, patch, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2024-26130> (advisory)
- <https://github.com/pyca/cryptography> (package)
- <https://github.com/pypa/advisory-database/tree/main/vulns/cryptography/PYSEC-2024-225.yaml> (web)
- <https://github.com/advisories/GHSA-6vqw-3v5j-54x4> (advisory)

## Sources

- CVE List: [CVE-2024-26130](https://www.cve.org/CVERecord?id=CVE-2024-26130), CVE Terms of Use, modified 2024-08-14
- GitHub Advisory Database: [GHSA-6vqw-3v5j-54x4](https://github.com/advisories/GHSA-6vqw-3v5j-54x4), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2024-26130](https://nvd.nist.gov/vuln/detail/CVE-2024-26130), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2024-225](https://osv.dev/vulnerability/PYSEC-2024-225), CC-BY-4.0, modified 2026-06-10

---

Page: https://cve.day/CVE-2024-26130 · Whole record: https://cve.day/CVE-2024-26130.json · Rebuilt by cve.day 2026-11-25T22:58:36.967Z
