Python/cryptography/3.1
cryptography is a package which provides cryptographic recipes and primitives to Python developers.
https://pypi.org/project/cryptography
Apache-2.0 AND BSD
13 Security Vulnerabilities
Python Cryptography package vulnerable to Bleichenbacher timing oracle attack
A flaw was found in the python-cryptography package. This issue may allow a remote attacker to decrypt captured messages in TLS servers that use RSA key exchanges, which may lead to exposure of confidential or sensitive data.
Vulnerable OpenSSL included in cryptography wheels
pyca/cryptography's wheels include a statically linked copy of OpenSSL. The versions of OpenSSL included in wheels prior to cryptograph 48.01 are vulnerable to a security issue. More details about the vulnerability itself can be found in https://openssl-library.org/news/secadv/20260609.txt.
If you are building cryptography source (sdist
) then you are responsible for upgrading your copy of OpenSSL. Only users installing from wheels built by the cryptography project (i.e., those distributed on PyPI) need to update their cryptography versions.
Vulnerable OpenSSL included in cryptography wheels
pyca/cryptography's wheels include a statically linked copy of OpenSSL. The versions of OpenSSL included in cryptography 0.5-40.0.2 are vulnerable to a security issue. More details about the vulnerability itself can be found in https://www.openssl.org/news/secadv/20230530.txt.
If you are building cryptography source (sdist
) then you are responsible for upgrading your copy of OpenSSL. Only users installing from wheels built by the cryptography project (i.e., those distributed on PyPI) need to update their cryptography versions.
Null pointer dereference in PKCS12 parsing
- https://nvd.nist.gov/vuln/detail/CVE-2024-0727
- https://github.com/openssl/openssl/commit/09df4395b5071217b76dc7d3d2e630eb8c5a79c2
- https://github.com/openssl/openssl/commit/775acfdbd0c6af9ac855f34969cdab0c0c90844a
- https://github.com/openssl/openssl/commit/d135eeab8a5dbf72b3da5240bab9ddb7678dbd2c
- https://github.openssl.org/openssl/extended-releases/commit/03b3941d60c4bce58fab69a0c22377ab439bc0e8
- https://github.openssl.org/openssl/extended-releases/commit/aebaa5883e31122b404e450732dc833dc9dee539
- https://www.openssl.org/news/secadv/20240125.txt
- https://github.com/github/advisory-database/pull/3472
- https://github.com/openssl/openssl/pull/23362
- https://github.com/alexcrichton/openssl-src-rs/commit/add20f73b6b42be7451af2e1044d4e0e778992b2
- https://github.com/pyca/cryptography/commit/3519591d255d4506fbcd0d04037d45271903c64d
- https://security.netapp.com/advisory/ntap-20240208-0006
- https://github.com/advisories/GHSA-9v9h-cgj8-h64p
- http://www.openwall.com/lists/oss-security/2024/03/11/1
- https://lists.debian.org/debian-lts-announce/2024/10/msg00033.html
- https://lists.debian.org/debian-lts-announce/2024/11/msg00000.html
- https://cert-portal.siemens.com/productcert/html/ssa-915275.html
- https://cert-portal.siemens.com/productcert/html/ssa-769027.html
- https://cert-portal.siemens.com/productcert/html/ssa-331112.html
- https://cert-portal.siemens.com/productcert/html/ssa-277137.html
- https://cert-portal.siemens.com/productcert/html/ssa-265688.html
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: PKCS12parse(), PKCS12unpackp7data(), PKCS12unpackp7encdata(), PKCS12unpackauthsafes() and PKCS12newpass().
We have also fixed a similar issue in SMIMEwritePKCS7(). 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.
RSA decryption vulnerable to Bleichenbacher timing vulnerability
- https://github.com/pyca/cryptography/security/advisories/GHSA-hggm-jpg3-v476
- https://nvd.nist.gov/vuln/detail/CVE-2020-25659
- https://github.com/advisories/GHSA-hggm-jpg3-v476
- https://github.com/pyca/cryptography/commit/58494b41d6ecb0f56b7c5f05d5f5e3ca0320d494
- https://pypi.org/project/cryptography/
- https://github.com/pyca/cryptography/pull/5507/commits/ce1bef6f1ee06ac497ca0c837fbd1c7ef6c2472b
- https://www.oracle.com/security-alerts/cpuapr2022.html
- https://www.oracle.com/security-alerts/cpujul2022.html
- https://github.com/pyca/cryptography/pull/5507
- https://github.com/pypa/advisory-database/tree/main/vulns/cryptography/PYSEC-2021-62.yaml
- https://pypi.org/project/cryptography
RSA decryption was vulnerable to Bleichenbacher timing vulnerabilities, which would impact people using RSA decryption in online scenarios. This is fixed in cryptography 3.2.
cryptography vulnerable to NULL-dereference when loading PKCS7 certificates
- https://github.com/pyca/cryptography/security/advisories/GHSA-jfhm-5ghh-2f97
- https://github.com/pyca/cryptography/commit/f09c261ca10a31fe41b1262306db7f8f1da0e48a
- https://github.com/advisories/GHSA-jfhm-5ghh-2f97
- https://nvd.nist.gov/vuln/detail/CVE-2023-49083
- https://github.com/pyca/cryptography/pull/9926
- http://www.openwall.com/lists/oss-security/2023/11/29/2
- https://github.com/pypa/advisory-database/tree/main/vulns/cryptography/PYSEC-2023-254.yaml
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QMNTYMUGFJSDBYBU22FUYBHFRZODRKXV
- https://lists.debian.org/debian-lts-announce/2024/10/msg00012.html
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: ```python from cryptography.hazmat.primitives.serialization.pkcs7 import loadderpkcs7certificates, loadpempkcs7certificates
pem_p7 = b -----BEGIN PKCS7----- MAsGCSqGSIb3DQEHAg== -----END PKCS7-----
der_p7 = b\x30\x0B\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x07\x02
loadpempkcs7certificates(pemp7) loadderpkcs7certificates(derp7) ```
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.
pyca/cryptography's wheels include vulnerable OpenSSL
- https://github.com/pyca/cryptography/security/advisories/GHSA-jm77-qphf-c4w8
- https://github.com/pyca/cryptography/commit/b22271cf3c3dd8dc8978f8f4b00b5c7060b6538d
- https://github.com/pyca/cryptography/commit/bfa4d95f0f356f2d535efd5c775e0fb3efe90ef2
- https://www.openssl.org/news/secadv/20230714.txt
- https://www.openssl.org/news/secadv/20230719.txt
- https://www.openssl.org/news/secadv/20230731.txt
- https://github.com/advisories/GHSA-jm77-qphf-c4w8
pyca/cryptography's wheels include a statically linked copy of OpenSSL. The versions of OpenSSL included in cryptography 0.8-41.0.2 are vulnerable to several security issues. More details about the vulnerabilities themselves can be found in https://www.openssl.org/news/secadv/20230731.txt, https://www.openssl.org/news/secadv/20230719.txt, and https://www.openssl.org/news/secadv/20230714.txt.
If you are building cryptography source (sdist
) then you are responsible for upgrading your copy of OpenSSL. Only users installing from wheels built by the cryptography project (i.e., those distributed on PyPI) need to update their cryptography versions.
cryptography has incomplete DNS name constraint enforcement on peer names
Summary
In versions of cryptography prior to 46.0.5, DNS name constraints were only validated against SANs within child certificates, and not the peer name
presented during each validation. Consequently, cryptography would allow a peer named bar.example.com to validate against a wildcard leaf certificate for *.example.com, even if the leaf's parent certificate (or upwards) contained an excluded subtree constraint for bar.example.com.
This behavior resulted from a gap between RFC 5280 (which defines Name Constraint semantics) and RFC 9525 (which defines service identity semantics): put together, neither states definitively whether Name Constraints should be applied to peer names. To close this gap, cryptography now conservatively rejects any validation where the peer name would be rejected by a name constraint if it were a SAN instead.
In practice, exploitation of this bypass requires an uncommon X.509 topology, one that the Web PKI avoids because it exhibits these kinds of problems. Consequently, we consider this a medium-to-low impact severity.
See CVE-2025-61727 for a similar bypass in Go's crypto/x509.
Remediation
Users should upgrade to 46.0.6 or newer.
Attribution
Reporter: @1seal
cryptography Vulnerable to a Subgroup Attack Due to Missing Subgroup Validation for SECT Curves
- https://github.com/pyca/cryptography/security/advisories/GHSA-r6ph-v2qm-q3c2
- https://github.com/pyca/cryptography/commit/0eebb9dbb6343d9bc1d91e5a2482ed4e054a6d8c
- https://github.com/pyca/cryptography/releases/tag/46.0.5
- https://github.com/advisories/GHSA-r6ph-v2qm-q3c2
- https://nvd.nist.gov/vuln/detail/CVE-2026-26007
- http://www.openwall.com/lists/oss-security/2026/02/10/4
Vulnerability Summary
The public_key_from_numbers (or EllipticCurvePublicNumbers.public_key()), EllipticCurvePublicNumbers.public_key(), load_der_public_key() and load_pem_public_key() functions do not verify that the point belongs to the expected prime-order subgroup of the curve.
This missing validation allows an attacker to provide a public key point P from a small-order subgroup. This can lead to security issues in various situations, such as the most commonly used signature verification (ECDSA) and shared key negotiation (ECDH). When the victim computes the shared secret as S = [victim_private_key]P via ECDH, this leaks information about victim_private_key mod (small_subgroup_order). For curves with cofactor > 1, this reveals the least significant bits of the private key. When these weak public keys are used in ECDSA , it's easy to forge signatures on the small subgroup.
Only SECT curves are impacted by this.
Credit
This vulnerability was discovered by: - XlabAI Team of Tencent Xuanwu Lab - Atuin Automated Vulnerability Discovery Engine
PyCA Cryptography symmetrically encrypting large values can lead to integer overflow
- https://github.com/pyca/cryptography/security/advisories/GHSA-rhm9-p9w5-fwm7
- https://nvd.nist.gov/vuln/detail/CVE-2020-36242
- https://github.com/advisories/GHSA-rhm9-p9w5-fwm7
- https://github.com/pyca/cryptography/issues/5615
- https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst
- https://github.com/pyca/cryptography/compare/3.3.1...3.3.2
- https://pypi.org/project/cryptography
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/L7RGQLK4J5ZQFRLKCHVVG6BKZTUQMG7E/
- https://github.com/pyca/cryptography/commit/82b6ce28389f0a317bc55ba2091a74b346db7cae
- https://www.oracle.com/security-alerts/cpuapr2022.html
- https://www.oracle.com/security-alerts/cpujul2022.html
- https://github.com/pypa/advisory-database/tree/main/vulns/cryptography/PYSEC-2021-63.yaml
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/L7RGQLK4J5ZQFRLKCHVVG6BKZTUQMG7E
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/L7RGQLK4J5ZQFRLKCHVVG6BKZTUQMG7E
cryptography is a package designed to expose cryptographic primitives and recipes to Python developers. When certain sequences of update() calls with large values (multiple GBs) for symetric encryption or decryption occur, it's possible for an integer overflow to happen, leading to mishandling of buffers. This is patched in version 3.3.2 and newer.
Vulnerable OpenSSL included in cryptography wheels
pyca/cryptography's wheels include a statically linked copy of OpenSSL. The versions of OpenSSL included in cryptography 2.5-41.0.3 are vulnerable to several security issues. More details about the vulnerabilities themselves can be found in https://www.openssl.org/news/secadv/20230908.txt.
If you are building cryptography source (sdist
) then you are responsible for upgrading your copy of OpenSSL. Only users installing from wheels built by the cryptography project (i.e., those distributed on PyPI) need to update their cryptography versions.
Cipher.update_into can corrupt memory if passed an immutable python object as the outbuf
- https://github.com/pyca/cryptography/security/advisories/GHSA-w7pp-m8wf-vj6r
- https://github.com/pyca/cryptography/pull/8230/commits/94a50a9731f35405f0357fa5f3b177d46a726ab3
- https://nvd.nist.gov/vuln/detail/CVE-2023-23931
- https://github.com/advisories/GHSA-w7pp-m8wf-vj6r
- https://github.com/pyca/cryptography/commit/d6951dca25de45abd52da51b608055371fbcde4e
- https://github.com/pyca/cryptography/pull/8230
- https://github.com/pypa/advisory-database/tree/main/vulns/cryptography/PYSEC-2023-11.yaml
- https://lists.debian.org/debian-lts-announce/2024/10/msg00012.html
- https://security.netapp.com/advisory/ntap-20230324-0007
Previously, Cipher.update_into would accept Python objects which implement the buffer protocol, but provide only immutable buffers:
>>> outbuf = b"\x00" * 32
>>> c = ciphers.Cipher(AES(b"\x00" * 32), modes.ECB()).encryptor()
>>> c.update_into(b"\x00" * 16, outbuf)
16
>>> outbuf
b'\xdc\x95\xc0x\xa2@\x89\x89\xadH\xa2\x14\x92\x84 \x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
This would allow immutable objects (such as bytes) to be mutated, thus violating fundamental rules of Python. This is a soundness bug -- it allows programmers to misuse an API, it cannot be exploited by attacker controlled data alone.
This now correctly raises an exception.
This issue has been present since update_into was originally introduced in cryptography 1.8.
Vulnerable OpenSSL included in cryptography wheels
- https://github.com/pyca/cryptography/security/advisories/GHSA-x4qr-2fvf-3mr5
- https://nvd.nist.gov/vuln/detail/CVE-2023-0286
- https://rustsec.org/advisories/RUSTSEC-2023-0006.html
- https://www.openssl.org/news/secadv/20230207.txt
- https://github.com/advisories/GHSA-x4qr-2fvf-3mr5
- https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=2c6c9d439b484e1ba9830d8454a34fa4f80fdfe9
- https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=2f7530077e0ef79d98718138716bc51ca0cad658
- https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=fd2af07dc083a350c959147097003a14a5e8ac4d
- https://access.redhat.com/security/cve/cve-2023-0286
- https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.6.2-relnotes.txt
- https://ftp.openbsd.org/pub/OpenBSD/patches/7.2/common/018_x509.patch.sig
- https://security.gentoo.org/glsa/202402-08
- https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2023-0003
pyca/cryptography's wheels include a statically linked copy of OpenSSL. The versions of OpenSSL included in cryptography 0.8.1-39.0.0 are vulnerable to a security issue. More details about the vulnerabilities themselves can be found in https://www.openssl.org/news/secadv/20221213.txt and https://www.openssl.org/news/secadv/20230207.txt.
If you are building cryptography source (sdist
) then you are responsible for upgrading your copy of OpenSSL. Only users installing from wheels built by the cryptography project (i.e., those distributed on PyPI) need to update their cryptography versions.
158 Other Versions
| Version | License | Security | Released | |
|---|---|---|---|---|
| 49.0.0 | UNKNOWN | |||
| 48.0.1 | UNKNOWN | |||
| 48.0.0 | UNKNOWN | 1 | ||
| 47.0.0 | UNKNOWN | 1 | ||
| 46.0.7 | UNKNOWN | 1 | ||
| 46.0.6 | UNKNOWN | 2 | ||
| 46.0.5 | UNKNOWN | 3 | ||
| 46.0.4 | UNKNOWN | 4 | ||
| 46.0.3 | UNKNOWN | 4 | ||
| 46.0.2 | UNKNOWN | 4 | ||
| 46.0.1 | UNKNOWN | 4 | ||
| 46.0.0 | UNKNOWN | 4 | ||
| 45.0.7 | Apache-2.0 | 4 | ||
| 45.0.6 | Apache-2.0 | 4 | ||
| 45.0.5 | Apache-2.0 | 4 | ||
| 45.0.4 | Apache-2.0 | 4 | ||
| 45.0.3 | Apache-2.0 | 4 | ||
| 45.0.2 | Apache-2.0 | 4 | ||
| 45.0.1 | Apache-2.0 | 4 | ||
| 45.0.0 | Apache-2.0 | 4 | ||
| 44.0.3 | Apache-2.0 AND BSD | 3 | 1970-01-01 - 00:00 | over 56 years |
| 44.0.2 | Apache-2.0 AND BSD | 3 | 1970-01-01 - 00:00 | over 56 years |
| 44.0.1 | Apache-2.0 AND BSD | 3 | 1970-01-01 - 00:00 | over 56 years |
| 44.0.0 | Apache-2.0 AND BSD | 4 | 1970-01-01 - 00:00 | over 56 years |
| 43.0.3 | Apache-2.0 AND BSD | 4 | 1970-01-01 - 00:00 | over 56 years |
| 43.0.1 | Apache-2.0 AND BSD | 4 | 1970-01-01 - 00:00 | over 56 years |
| 43.0.0 | Apache-2.0 AND BSD | 5 | 1970-01-01 - 00:00 | over 56 years |
| 43.0.0.dev1 | Apache-2.0 AND BSD | 5 | 1970-01-01 - 00:00 | over 56 years |
| 42.0.8 | Apache-2.0 AND BSD | 5 | 1970-01-01 - 00:00 | over 56 years |
| 42.0.7 | Apache-2.0 AND BSD | 5 | 1970-01-01 - 00:00 | over 56 years |
| 42.0.6 | Apache-2.0 AND BSD | 5 | 1970-01-01 - 00:00 | over 56 years |
| 42.0.5 | Apache-2.0 AND BSD | 5 | 1970-01-01 - 00:00 | over 56 years |
| 42.0.4 | Apache-2.0 AND BSD | 5 | 1970-01-01 - 00:00 | over 56 years |
| 42.0.3 | Apache-2.0 AND BSD | 6 | 1970-01-01 - 00:00 | over 56 years |
| 42.0.2 | Apache-2.0 AND BSD | 6 | 1970-01-01 - 00:00 | over 56 years |
| 42.0.1 | Apache-2.0 AND BSD | 7 | 1970-01-01 - 00:00 | over 56 years |
| 42.0.0 | Apache-2.0 AND BSD | 7 | 1970-01-01 - 00:00 | over 56 years |
| 41.0.7 | Apache-2.0 AND BSD | 7 | 1970-01-01 - 00:00 | over 56 years |
| 41.0.6 | Apache-2.0 AND BSD | 7 | 1970-01-01 - 00:00 | over 56 years |
| 41.0.5 | Apache-2.0 AND BSD | 8 | 1970-01-01 - 00:00 | over 56 years |
| 41.0.4 | Apache-2.0 AND BSD | 8 | 1970-01-01 - 00:00 | over 56 years |
| 41.0.3 | Apache-2.0 AND BSD | 9 | 1970-01-01 - 00:00 | over 56 years |
| 41.0.2 | Apache-2.0 AND BSD | 10 | 1970-01-01 - 00:00 | over 56 years |
| 41.0.1 | Apache-2.0 AND BSD | 11 | 1970-01-01 - 00:00 | over 56 years |
| 41.0.0 | Apache-2.0 AND BSD | 11 | 1970-01-01 - 00:00 | over 56 years |
| 40.0.2 | Apache-2.0 AND BSD | 12 | 1970-01-01 - 00:00 | over 56 years |
| 40.0.1 | Apache-2.0 AND BSD | 12 | 1970-01-01 - 00:00 | over 56 years |
| 40.0.0 | Apache-2.0 AND BSD | 12 | 1970-01-01 - 00:00 | over 56 years |
| 39.0.2 | Apache-2.0 AND BSD | 11 | 1970-01-01 - 00:00 | over 56 years |
| 39.0.1 | Apache-2.0 AND BSD | 11 | 1970-01-01 - 00:00 | over 56 years |
