CVE-2024-0727: Cryptography Null Pointer Dereference Vulnerability

MODERATE
Advisory Identifier: GHSA-9v9h-cgj8-h64p
CVSS 5.5
CWE-476
Published
Advisory Summary

CVE-2024-0727 is a MODERATE (CVSS 5.5) null pointer dereference vulnerability (CWE-476: NULL Pointer Dereference) affecting Cryptography libraries in the PyPI ecosystem. The issue involves null pointer dereference in pkcs12 parsing. Remediation is available by upgrading affected packages to version 42.0.2.

CVE-2024-0727 at a Glance

CVE Identifier CVE-2024-0727
GHSA Identifier GHSA-9v9h-cgj8-h64p
Severity MODERATE
CVSS v3.1 Base Score 5.5
CWE Classification CWE-476: NULL Pointer Dereference
Affected Product Cryptography
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2024-0727

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.

cryptography fixed: 42.0.2
pip install cryptography>=42.0.2
Verify Direct and Transitive Dependencies

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-0727, 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.2), 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

Issue summary: Processing a maliciously formatted PKCS12 file may lead OpenSSL to crash leading to a potential Denial of Service attack Impact summary: Applications loading files in the PKCS12 format from untrusted sources might terminate abruptly. A file in PKCS12 format can contain certificates and keys and may come from an untrusted source. The PKCS12 specification allows certain fields to be NULL, but OpenSSL does not correctly check for this case. This can lead to a NULL pointer dereference that results in OpenSSL crashing. If an application processes PKCS12 files from an untrusted source using the OpenSSL APIs then that application will be vulnerable to this issue. OpenSSL APIs that are vulnerable to this are: PKCS12_parse(), PKCS12_unpack_p7data(), PKCS12_unpack_p7encdata(), PKCS12_unpack_authsafes() and PKCS12_newpass(). We have also fixed a similar issue in SMIME_write_PKCS7(). However since this function is related to writing data we do not consider it security significant. The FIPS modules in 3.2, 3.1 and 3.0 are not affected by this issue.

CVE-2024-0727 Affected Cryptography Versions

1 component(s)
Fixed Versions:
42.0.2
Product / Package Ecosystem Affected Versions Fixed Version
cryptography
PyPI
< 42.0.2
42.0.2

References

NVD — CVE-2024-0727 NVD
https://nvd.nist.gov/vuln/detail/CVE-2024-0727
Cryptography Source Repository REPOSITORY
https://github.com/github/advisory-database/pull/3472
Cryptography Source Repository REPOSITORY
https://github.com/openssl/openssl/pull/23362
Security Fix Commit FIX COMMIT
https://github.com/alexcrichton/openssl-src-rs/commit/add20f73b6b42be7451af2e1044d4e0e778992b2
Security Fix Commit FIX COMMIT
https://github.com/openssl/openssl/commit/09df4395b5071217b76dc7d3d2e630eb8c5a79c2
Security Fix Commit FIX COMMIT
https://github.com/openssl/openssl/commit/775acfdbd0c6af9ac855f34969cdab0c0c90844a
Security Fix Commit FIX COMMIT
https://github.com/openssl/openssl/commit/d135eeab8a5dbf72b3da5240bab9ddb7678dbd2c
Security Fix Commit FIX COMMIT
https://github.com/pyca/cryptography/commit/3519591d255d4506fbcd0d04037d45271903c64d
www.openssl.org/news/secadv/2024012... WEB
https://www.openssl.org/news/secadv/20240125.txt
Cryptography Security Information SECURITY
https://security.netapp.com/advisory/ntap-20240208-0006
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2024/11/msg00000.html
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2024/10/msg00033.html
github.openssl.org/openssl/extended-re... WEB
https://github.openssl.org/openssl/extended-releases/commit/aebaa5883e31122b404e450732dc833dc9dee539
github.openssl.org/openssl/extended-re... WEB
https://github.openssl.org/openssl/extended-releases/commit/03b3941d60c4bce58fab69a0c22377ab439bc0e8
cert-portal.siemens.com/productcert/html/ss... WEB
https://cert-portal.siemens.com/productcert/html/ssa-915275.html
cert-portal.siemens.com/productcert/html/ss... WEB
https://cert-portal.siemens.com/productcert/html/ssa-769027.html
cert-portal.siemens.com/productcert/html/ss... WEB
https://cert-portal.siemens.com/productcert/html/ssa-331112.html
cert-portal.siemens.com/productcert/html/ss... WEB
https://cert-portal.siemens.com/productcert/html/ssa-277137.html
cert-portal.siemens.com/productcert/html/ss... WEB
https://cert-portal.siemens.com/productcert/html/ssa-265688.html
Cryptography Security Information SECURITY
http://www.openwall.com/lists/oss-security/2024/03/11/1

Frequently Asked Questions

What is CVE-2024-0727?
CVE-2024-0727 is a security vulnerability in Cryptography involving Null pointer dereference in PKCS12 parsing under CWE-476: NULL Pointer Dereference.
Which Cryptography versions are affected?
Affected versions include releases prior to 42.0.2 across affected packages: cryptography.
What version fixes CVE-2024-0727?
Upgrading to 42.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is cryptography affected?
Yes, cryptography is affected in releases prior to 42.0.2. Upgrade your dependency to 42.0.2 or later.
What is the CVSS score of CVE-2024-0727?
CVE-2024-0727 has a CVSS v3.1 base score of 5.5 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2024-0727?
CVE-2024-0727 is classified under CWE-476: NULL Pointer Dereference (The product dereferences a pointer that it expects to be valid but is NULL.).
How can I check PyPI dependencies for CVE-2024-0727?
Run the dependency tree command: 'pip show cryptography'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9v9h-cgj8-h64p",
  "modified" : "2026-05-13T15:24:21Z",
  "published" : "2024-01-26T09:30:23Z",
  "aliases" : [ "CVE-2024-0727" ],
  "summary" : "Null pointer dereference in PKCS12 parsing",
  "details" : "Issue summary: Processing a maliciously formatted PKCS12 file may lead OpenSSL\nto crash leading to a potential Denial of Service attack\n\nImpact summary: Applications loading files in the PKCS12 format from untrusted\nsources might terminate abruptly.\n\nA file in PKCS12 format can contain certificates and keys and may come from an\nuntrusted source. The PKCS12 specification allows certain fields to be NULL, but\nOpenSSL does not correctly check for this case. This can lead to a NULL pointer\ndereference that results in OpenSSL crashing. If an application processes PKCS12\nfiles from an untrusted source using the OpenSSL APIs then that application will\nbe vulnerable to this issue.\n\nOpenSSL APIs that are vulnerable to this are: PKCS12_parse(),\nPKCS12_unpack_p7data(), PKCS12_unpack_p7encdata(), PKCS12_unpack_authsafes()\nand PKCS12_newpass().\n\nWe have also fixed a similar issue in SMIME_write_PKCS7(). However since this\nfunction is related to writing data we do not consider it security significant.\n\nThe FIPS modules in 3.2, 3.1 and 3.0 are not affected by this issue.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "cryptography"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "42.0.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-0727"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/github/advisory-database/pull/3472"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openssl/openssl/pull/23362"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/alexcrichton/openssl-src-rs/commit/add20f73b6b42be7451af2e1044d4e0e778992b2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openssl/openssl/commit/09df4395b5071217b76dc7d3d2e630eb8c5a79c2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openssl/openssl/commit/775acfdbd0c6af9ac855f34969cdab0c0c90844a"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openssl/openssl/commit/d135eeab8a5dbf72b3da5240bab9ddb7678dbd2c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pyca/cryptography/commit/3519591d255d4506fbcd0d04037d45271903c64d"
  }, {
    "type" : "WEB",
    "url" : "https://www.openssl.org/news/secadv/20240125.txt"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20240208-0006"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2024/11/msg00000.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2024/10/msg00033.html"
  }, {
    "type" : "WEB",
    "url" : "https://github.openssl.org/openssl/extended-releases/commit/aebaa5883e31122b404e450732dc833dc9dee539"
  }, {
    "type" : "WEB",
    "url" : "https://github.openssl.org/openssl/extended-releases/commit/03b3941d60c4bce58fab69a0c22377ab439bc0e8"
  }, {
    "type" : "WEB",
    "url" : "https://cert-portal.siemens.com/productcert/html/ssa-915275.html"
  }, {
    "type" : "WEB",
    "url" : "https://cert-portal.siemens.com/productcert/html/ssa-769027.html"
  }, {
    "type" : "WEB",
    "url" : "https://cert-portal.siemens.com/productcert/html/ssa-331112.html"
  }, {
    "type" : "WEB",
    "url" : "https://cert-portal.siemens.com/productcert/html/ssa-277137.html"
  }, {
    "type" : "WEB",
    "url" : "https://cert-portal.siemens.com/productcert/html/ssa-265688.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2024/03/11/1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-476" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-02-16T20:48:36Z",
    "nvd_published_at" : "2024-01-26T09:15:07Z"
  }
}