CVE-2024-26130: Cryptography Cryptography NULL Pointer Dereference With Vulnerability
HIGHCVE-2024-26130 is a HIGH (CVSS 7.5) cryptography null pointer dereference with vulnerability (CWE-476: NULL Pointer Dereference) affecting Cryptography libraries in the PyPI ecosystem. The issue involves cryptography null pointer dereference with pkcs12.serialize_key_and_certificates when called with a non-matching certificate and private key and an hmac_hash override. Remediation is available by upgrading affected packages to version 42.0.4.
CVE-2024-26130 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2024-26130
To remediate this vulnerability, upgrade all affected Cryptography dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install cryptography>=42.0.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show cryptography
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-26130, inspect your installed packages using pip:
pip show cryptography
Analyze the terminal output to locate any version of Cryptography in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 42.0.4), your application is affected.
Note: The pip show cryptography command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-476: NULL Pointer Dereference, where the product dereferences a pointer that it expects to be valid but is null. In Cryptography, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-26130 Affected Cryptography Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
cryptography
|
PyPI |
≥ 38.0.0
< 42.0.4
|
42.0.4
|
References
Frequently Asked Questions
What is CVE-2024-26130?
Which Cryptography versions are affected?
What version fixes CVE-2024-26130?
Is cryptography affected?
What is the CVSS score of CVE-2024-26130?
What CWE is associated with CVE-2024-26130?
How can I check PyPI dependencies for CVE-2024-26130?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-6vqw-3v5j-54x4",
"modified" : "2025-02-06T18:07:25Z",
"published" : "2024-02-21T18:04:40Z",
"aliases" : [ "CVE-2024-26130" ],
"summary" : "cryptography NULL pointer dereference with pkcs12.serialize_key_and_certificates when called with a non-matching certificate and private key and an hmac_hash override",
"details" : "If `pkcs12.serialize_key_and_certificates` is called with both:\n\n1. A certificate whose public key did not match the provided private key\n2. An `encryption_algorithm` with `hmac_hash` set (via `PrivateFormat.PKCS12.encryption_builder().hmac_hash(...)`\n\nThen a NULL pointer dereference would occur, crashing the Python process.\n\nThis has been resolved, and now a `ValueError` is properly raised.\n\nPatched in https://github.com/pyca/cryptography/pull/10423",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "cryptography"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "38.0.0"
}, {
"fixed" : "42.0.4"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/pyca/cryptography/security/advisories/GHSA-6vqw-3v5j-54x4"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-26130"
}, {
"type" : "WEB",
"url" : "https://github.com/pyca/cryptography/pull/10423"
}, {
"type" : "WEB",
"url" : "https://github.com/pyca/cryptography/commit/97d231672763cdb5959a3b191e692a362f1b9e55"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/pyca/cryptography"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/cryptography/PYSEC-2024-225.yaml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-476" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-02-21T18:04:40Z",
"nvd_published_at" : "2024-02-21T17:15:09Z"
}
}