cryptography@1.0 vulnerabilities

cryptography is a package which provides cryptographic recipes and primitives to Python developers.

Direct Vulnerabilities

Known vulnerabilities in the cryptography package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • L
Uncontrolled Resource Consumption

Affected versions of this package are vulnerable to Uncontrolled Resource Consumption due to improper user input validation in the EVP_PKEY_param_check or EVP_PKEY_public_check functions. An attacker can cause a denial of service by supplying excessively long DSA keys or parameters obtained from an untrusted source.

Note:

OpenSSL does not call these functions on untrusted DSA keys, so only applications that directly call these functions may be vulnerable.

Also vulnerable are the OpenSSL pkey and pkeyparam command line applications when using the "-check" option.

How to fix Uncontrolled Resource Consumption?

Upgrade cryptography to version 42.0.8 or higher.

[0,42.0.8)
  • M
NULL Pointer Dereference

Affected versions of this package are vulnerable to NULL Pointer Dereference when processing a maliciously formatted PKCS12 file. The vulnerability exists due to improper handling of optional ContentInfo fields, which can be set to null. An attacker can cause a denial of service by sending crafted input that leads to applications loading files in PKCS12 format from untrusted sources to terminate abruptly.

How to fix NULL Pointer Dereference?

Upgrade cryptography to version 42.0.2 or higher.

[,42.0.2)
  • H
Observable Timing Discrepancy

Affected versions of this package are vulnerable to Observable Timing Discrepancy. 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 (Marvin).

Note:

This vulnerability exists due to an incomplete fix for CVE-2020-25659.

How to fix Observable Timing Discrepancy?

Upgrade cryptography to version 42.0.0 or higher.

[,42.0.0)
  • M
Denial of Service (DoS)

Affected versions of this package are vulnerable to Denial of Service (DoS) when the DH_generate_key(), DH_check_pub_key(), DH_check_pub_key_ex(), EVP_PKEY_public_check(), and EVP_PKEY_generate() functions are used. An attacker can cause long delays and potentially a Denial of Service by supplying excessively long X9.42 DH keys or parameters obtained from an untrusted source.

Note:

This is only exploitable if the application uses these functions to generate or check an X9.42 DH key or parameters. Also, the OpenSSL pkey command line application, when using the -pubcheck option, as well as the OpenSSL genpkey command line application, are vulnerable to this issue.

How to fix Denial of Service (DoS)?

Upgrade cryptography to version 42.0.0 or higher.

[,42.0.0)
  • M
Missing Cryptographic Step

Affected versions of this package are vulnerable to Missing Cryptographic Step when the EVP_EncryptInit_ex2(), EVP_DecryptInit_ex2() or EVP_CipherInit_ex2() functions are used. An attacker can cause truncation or overreading of key and initialization vector (IV) lengths by altering the "keylen" or "ivlen" parameters within the OSSL_PARAM array after the key and IV have been established. This can lead to potential truncation or overruns during the initialization of some symmetric ciphers, such as RC2, RC4, RC5, CCM, GCM, and OCB. A truncation in the IV can result in non-uniqueness, which could result in loss of confidentiality for some cipher modes.

Both truncations and overruns of the key and the IV will produce incorrect results and could, in some cases, trigger a memory exception.

How to fix Missing Cryptographic Step?

Upgrade cryptography to version 41.0.5 or higher.

[,41.0.5)
  • L
Denial of Service (DoS)

Affected versions of this package are vulnerable to Denial of Service (DoS) when the DH_check(), DH_check_ex(), or EVP_PKEY_param_check() functions are used to check a DH key or DH parameters. An attacker can cause long delays and potentially a Denial of Service (DoS) by providing excessively long DH keys or parameters from an untrusted source. This is only exploitable if the application calls these functions and supplies a key or parameters obtained from an untrusted source.

Note: The OpenSSL SSL/TLS implementation and the OpenSSL 3.0 and 3.1 FIPS providers are not affected by this issue.

How to fix Denial of Service (DoS)?

Upgrade cryptography to version 41.0.3 or higher.

[0.8,41.0.3)
  • M
Denial of Service (DoS)

Affected versions of this package are vulnerable to Denial of Service (DoS) in the DH_check(), DH_check_ex() and EVP_PKEY_param_check() functions, which are used to check a DH key or DH parameters.

When the key or parameters that are being checked contain an excessively large modulus value (the p parameter) this may cause slowness in processing. Some checks use the supplied modulus value even if it has already been found to be too large.

The OpenSSL dhparam and pkeyparam command line applications are also vulnerable, when using the -check option.

NOTE: The OpenSSL SSL/TLS implementation is not affected by this issue.

How to fix Denial of Service (DoS)?

Upgrade cryptography to version 41.0.3 or higher.

[0.8,41.0.3)
  • L
Insufficient Verification of Data Authenticity

Affected versions of this package are vulnerable to Insufficient Verification of Data Authenticity in the AES-SIV cipher implementation in ciphers/cipher_aes_siv.c, which ignores empty associated data entries, making them unauthenticated.

Applications that use the AES-SIV algorithm and want to authenticate empty data entries as associated data can be misled by removing, adding or reordering such empty entries as these are ignored by the OpenSSL implementation.

NOTE: This issue does not affect non-empty associated data authentication and the maintainers are currently unaware of any applications that use empty associated data entries.

How to fix Insufficient Verification of Data Authenticity?

Upgrade cryptography to version 41.0.3 or higher.

[0.8,41.0.3)
  • H
Improper Certificate Validation

Affected versions of this package are vulnerable to Improper Certificate Validation in the SSH certificate decoding process. An attacker can cause the application to accept unauthorized SSH certificates generated by ssh-keygen, or cause certificates generated by SSHCertificateBuilder to fail when read by ssh-keygen.

Note: This is only exploitable if the attacker controls the SSH certificate generation process or can introduce crafted SSH certificates into the system.

How to fix Improper Certificate Validation?

Upgrade cryptography to version 41.0.2 or higher.

[,41.0.2)
  • M
Denial of Service (DoS)

Affected versions of this package are vulnerable to Denial of Service (DoS) when processing specially crafted ASN.1 objects identifiers. Applications that use OBJ_obj2txt() directly, or use any of the OpenSSL subsystems OCSP, PKCS7/SMIME, CMS, CMP/CRMF or TS with no message size limit may experience notable to very long delays when processing those messages, which may lead to a exploitation of this vulnerability.

How to fix Denial of Service (DoS)?

Upgrade cryptography to version 41.0.0 or higher.

[,41.0.0)
  • H
Denial of Service (DoS)

Affected versions of this package are vulnerable to Denial of Service (DoS) due to a null pointer dereference in when signatures are being verified on PKCS7 signed or signedAndEnveloped data in pkcs7/pk7_doit.c. If the hash algorithm used for the signature is known to the OpenSSL library but the implementation of the hash algorithm is not available, the digest initialization will fail.

NOTE: The TLS implementation in OpenSSL does not call these functions.

How to fix Denial of Service (DoS)?

Upgrade cryptography to version 39.0.1 or higher.

[,39.0.1)
  • M
Denial of Service (DoS)

Affected versions of this package are vulnerable to Denial of Service (DoS) due to a null dereference when validating DSA public keys in the EVP_PKEY_public_check() function.

NOTE: The TLS implementation in OpenSSL does not call this function.

How to fix Denial of Service (DoS)?

Upgrade cryptography to version 39.0.1 or higher.

[,39.0.1)
  • M
Use After Free

Affected versions of this package are vulnerable to Use After Free in the BIO_new_NDEF() function. A new filter BIO can be freed, with the function returning a NULL result indicating a failure. But the BIO passed by the caller still holds pointers to the previously freed filter BIO. This could allow an attacker to cause a crash.

How to fix Use After Free?

Upgrade cryptography to version 39.0.1 or higher.

[,39.0.1)
  • H
Access of Resource Using Incompatible Type ('Type Confusion')

Affected versions of this package are vulnerable to Access of Resource Using Incompatible Type ('Type Confusion') in x509/v3_genn.c, when processing X.400 addresses with CRL checking enabled (e.g. when X509_V_FLAG_CRL_CHECK is set). An attacker in possession of both the certificate chain and CRL, of which neither needs a valid signature, can expose memory or cause a denial of service. If the attacker only controls one of these inputs, the other input must already contain an X.400 address as a CRL distribution point, which is uncommon.

How to fix Access of Resource Using Incompatible Type ('Type Confusion')?

Upgrade cryptography to version 39.0.1 or higher.

[,39.0.1)
  • M
Timing Attack

Affected versions of this package are vulnerable to Timing Attack in rsa/rsa_ossl.c. An attacker can recover ciphertext with a Bleichenbacher style attack by sending a large number of trial messages (Marvin). This affects all RSA padding modes: PKCS#1 v1.5, RSA-OEAP, and RSASVE.

How to fix Timing Attack?

Upgrade cryptography to version 39.0.1 or higher.

[,39.0.1)
  • M
Denial of Service (DoS)

Affected versions of this package are vulnerable to Denial of Service (DoS) due to an invalid pointer dereference in the d2i_PKCS7(), d2i_PKCS7_bio() and d2i_PKCS7_fp(). An attacker could trigger a crash by supplying malicious PKCS7 data.

NOTE: The TLS implementation in OpenSSL does not call these functions.

How to fix Denial of Service (DoS)?

Upgrade cryptography to version 39.0.1 or higher.

[,39.0.1)
  • M
Denial of Service (DoS)

Affected versions of this package are vulnerable to Denial of Service (DoS) due to a read buffer overflow in certificate name constraint checking in x509/v3_ncons.c. This occurs after certificate chain signature verification, and requires either a CA to have signed the malicious certificate or for the application to continue certificate verification despite failure to construct a path to a trusted issuer.

How to fix Denial of Service (DoS)?

Upgrade cryptography to version 39.0.1 or higher.

[,39.0.1)
  • M
Denial of Service (DoS)

Affected versions of this package are vulnerable to Denial of Service (DoS) due to a double free after calling the PEM_read_bio_ex() function. An attacker who supplies a malicious PEM file with a 0-length payload can trigger a crash.

How to fix Denial of Service (DoS)?

Upgrade cryptography to version 39.0.1 or higher.

[,39.0.1)
  • M
Denial of Service (DoS)

Affected versions of this package are vulnerable to Denial of Service (DoS). If an X.509 certificate contains a malformed policy constraint and policy processing is enabled, then a write lock will be taken twice recursively. On some operating systems (most widely: Windows), this results in a denial of service when the affected process hangs.

NOTE: Policy processing being enabled on a publicly-facing server is not considered to be a common setup.

How to fix Denial of Service (DoS)?

Upgrade cryptography to version 39.0.1 or higher.

[0,39.0.1)
  • M
Timing Attack

Affected versions of this package are vulnerable to Timing Attack. It is vulnerable to Bleichenbacher timing attacks in the RSA decryption API, via timed processing of valid PKCS#1 v1.5 ciphertext (Marvin).

Notes:

  1. Version 3.2 of this package contains an incomplete fix, which might help reduce the chances of this vulnerability being exploited. We recommend updating to version 42.0.0 for the complete fix, as advised in the advisory for CVE-2023-50782.

  2. This vulnerability presents a moderate severity concern due to its specific impact on applications utilizing RSA decryption with PKCS#1 v1.5 padding. While the vulnerability could potentially lead to leakage in RSA decryption operations, its severity is downgraded to medium by several factors. Firstly, the exploitability of the vulnerability is limited to scenarios where RSA decryption with PKCS#1 v1.5 padding is employed, narrowing the scope of affected systems. Additionally, the implementation of implicit rejection, such as the Marvin workaround, provides a viable mitigation strategy.

How to fix Timing Attack?

Upgrade cryptography to version 3.2 or higher.

[,3.2)
  • M
Denial of Service (DoS)

Affected versions of cryptography are vulnerable to Denial of Service (DoS).

The OpenSSL backend beffore 1.0.2 made use of assertions to check response where the tests could not trigger a failure. If a user ran Python with this -O flag and got an invalid response code this could lead to a crash.

How to fix Denial of Service (DoS)?

Upgrade cryptography to version 1.0.2 or higher.

[,1.0.2)
  • H
Use of a Risky Cryptographic Algorithm

cryptography provides cryptographic recipes and primitives to Python developers.

Affected versions of this package are vulnerable to Use of a Risky Cryptographic Algorithm. HKDF in cryptography before 1.5.2 returns an empty byte-string if used with a length less than algorithm.digest_size.

[,1.5.2)
  • M
TLS Truncation Attack

cryptography provides cryptographic recipes and primitives to Python developers.

Affected versions of this package are vulnerable to TLS Truncation. A malicious user can prevent a user from fetching the parts of a message by inserting TCP code into a message indicating the message has completed.

[,1.1)