VYPR
Moderate severityNVD Advisory· Published Nov 29, 2023· Updated Dec 18, 2025

cryptography vulnerable to NULL-dereference when loading PKCS7 certificates

CVE-2023-49083

Description

cryptography is a package designed to expose cryptographic primitives and recipes to Python developers. Calling load_pem_pkcs7_certificates or load_der_pkcs7_certificates could lead to a NULL-pointer dereference and segfault. Exploitation of this vulnerability poses a serious risk of Denial of Service (DoS) for any application attempting to deserialize a PKCS7 blob/certificate. The consequences extend to potential disruptions in system availability and stability. This vulnerability has been patched in version 41.0.6.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Calling load_pem_pkcs7_certificates or load_der_pkcs7_certificates in the Python cryptography library before 41.0.6 can cause a NULL-pointer dereference and segfault, leading to a denial of service.

Vulnerability

Description

The Python cryptography library, which provides cryptographic primitives and recipes, contains a NULL-pointer dereference vulnerability in functions load_pem_pkcs7_certificates and load_der_pkcs7_certificates [1]. These functions are used to deserialize PKCS7 certificate bundles from PEM or DER formats. The flaw occurs when processing a PKCS7 blob that contains no certificates; the underlying OpenSSL code returns a NULL pointer in p7.d.sign, and prior to the fix, the library did not check for this condition before dereferencing the pointer [2][4].

Exploitation and

Attack Surface

An attacker can exploit this vulnerability by providing a specially crafted PKCS7 input (either PEM or DER) that triggers the NULL-pointer dereference. No authentication is required; the attack is entirely remote if an application accepts untrusted PKCS7 data. As demonstrated in the advisory, a minimal payload such as MAsGCSqGSIb3DQEHAg== (PEM) or its DER equivalent is sufficient to cause a crash [4]. Any Python application using these functions to load certificates from untrusted sources is vulnerable.

Impact

Successful exploitation results in a segmentation fault, leading to denial of service (DoS) [1]. This can disrupt system availability and stability, making the application unresponsive or terminating it entirely. The vulnerability is classified with a CVSS score of 7.5 (HIGH) due to its low attack complexity and network-based vector causing complete availability impact.

Mitigation

Status

The vulnerability has been patched in cryptography version 41.0.6, released on 2023-11-27 [1][2][3]. The fix adds a NULL check on p7.d.sign before accessing its cert member, returning an empty list if the pointer is NULL [3]. All users should upgrade to version 41.0.6 or later. There are no known workarounds; applications that cannot upgrade should avoid processing untrusted PKCS7 input.

AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
cryptographyPyPI
>= 3.1, < 41.0.641.0.6

Affected products

26

Patches

1
f09c261ca10a

41.0.6 release (#9927)

https://github.com/pyca/cryptographyAlex GaynorNov 27, 2023via ghsa
9 files changed · +26 5
  • CHANGELOG.rst+9 0 modified
    @@ -1,6 +1,15 @@
     Changelog
     =========
     
    +.. _v41-0-6:
    +
    +41.0.6 - 2023-11-27
    +~~~~~~~~~~~~~~~~~~~
    +
    +* Fixed a null-pointer-dereference and segfault that could occur when loading
    +  certificates from a PKCS#7 bundle.  Credit to **pkuzco** for reporting the
    +  issue. **CVE-2023-49083**
    +
     .. _v41-0-5:
     
     41.0.5 - 2023-10-24
    
  • docs/spelling_wordlist.txt+1 0 modified
    @@ -38,6 +38,7 @@ decrypted
     decrypting
     deprecations
     DER
    +dereference
     deserialize
     deserialized
     Deserialization
    
  • pyproject.toml+1 1 modified
    @@ -11,7 +11,7 @@ build-backend = "setuptools.build_meta"
     
     [project]
     name = "cryptography"
    -version = "41.0.5"
    +version = "41.0.6"
     authors = [
         {name = "The Python Cryptographic Authority and individual contributors", email = "cryptography-dev@python.org"}
     ]
    
  • src/cryptography/__about__.py+1 1 modified
    @@ -10,7 +10,7 @@
         "__copyright__",
     ]
     
    -__version__ = "41.0.5"
    +__version__ = "41.0.6"
     
     
     __author__ = "The Python Cryptographic Authority and individual contributors"
    
  • src/cryptography/hazmat/backends/openssl/backend.py+4 1 modified
    @@ -1890,9 +1890,12 @@ def _load_pkcs7_certificates(self, p7) -> typing.List[x509.Certificate]:
                     _Reasons.UNSUPPORTED_SERIALIZATION,
                 )
     
    +        certs: list[x509.Certificate] = []
    +        if p7.d.sign == self._ffi.NULL:
    +            return certs
    +
             sk_x509 = p7.d.sign.cert
             num = self._lib.sk_X509_num(sk_x509)
    -        certs = []
             for i in range(num):
                 x509 = self._lib.sk_X509_value(sk_x509, i)
                 self.openssl_assert(x509 != self._ffi.NULL)
    
  • src/rust/src/lib.rs+2 0 modified
    @@ -3,6 +3,8 @@
     // for complete details.
     
     #![deny(rust_2018_idioms)]
    +// Work-around for https://github.com/PyO3/pyo3/issues/3561
    +#![allow(unknown_lints, clippy::unnecessary_fallible_conversions)]
     
     mod asn1;
     mod backend;
    
  • tests/hazmat/primitives/test_pkcs7.py+6 0 modified
    @@ -89,6 +89,12 @@ def test_load_pkcs7_unsupported_type(self, backend):
                     mode="rb",
                 )
     
    +    def test_load_pkcs7_empty_certificates(self, backend):
    +        der = b"\x30\x0B\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x07\x02"
    +
    +        certificates = pkcs7.load_der_pkcs7_certificates(der)
    +        assert certificates == []
    +
     
     # We have no public verification API and won't be adding one until we get
     # some requirements from users so this function exists to give us basic
    
  • vectors/cryptography_vectors/__about__.py+1 1 modified
    @@ -6,4 +6,4 @@
         "__version__",
     ]
     
    -__version__ = "41.0.5"
    +__version__ = "41.0.6"
    
  • vectors/pyproject.toml+1 1 modified
    @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
     
     [project]
     name = "cryptography_vectors"
    -version = "41.0.5"
    +version = "41.0.6"
     authors = [
         {name = "The Python Cryptographic Authority and individual contributors", email = "cryptography-dev@python.org"}
     ]
    

Vulnerability mechanics

Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

10

News mentions

0

No linked articles in our index yet.