cryptography@42.0.1 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 ('Resource Exhaustion')

Affected versions of this package are vulnerable to Uncontrolled Resource Consumption ('Resource Exhaustion') due to the session cache entering an incorrect state and failing to flush properly as it fills, leading to uncontrolled memory consumption. This condition is triggered under certain server configurations when processing TLSv1.3 sessions. Specifically, this occurs if the non-default SSL_OP_NO_TICKET option is enabled, but not if early_data support is configured along with the default anti-replay protection. A malicious client could deliberately create this scenario to force a service disruption. It may also occur accidentally in normal operation.

Note:

This issue is only exploitable if the server supports TLSv1.3 and is configured with the SSL_OP_NO_TICKET option enabled.

How to fix Uncontrolled Resource Consumption ('Resource Exhaustion')?

Upgrade cryptography to version 42.0.6 or higher.

[35.0.0,42.0.6)
  • M
NULL Pointer Dereference

Affected versions of this package are vulnerable to NULL Pointer Dereference in the pkcs12.serialize_key_and_certificates function. An attacker can crash the Python process.

Note: This is only exploitable if the vulnerable function is called with both:

  1. A certificate whose public key does not match the provided private key.

  2. An encryption_algorithm with hmac_hash set via PrivateFormat.PKCS12.encryption_builder().hmac_hash(...).

How to fix NULL Pointer Dereference?

Upgrade cryptography to version 42.0.4 or higher.

[38.0.0,42.0.4)
  • 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)
  • M
Resource Exhaustion

Affected versions of this package are vulnerable to Resource Exhaustion via the EVP_PKEY_public_check function. When the function is called in RSA public keys, a computation is done to confirm that the RSA modulus, n, is composite. For valid RSA keys, n is a product of two or more large primes and this computation completes quickly. However, if n is a large prime, this computation takes a long time. An attacker can cause a denial of service by supplying a specially crafted RSA key that triggers extensive computation.

How to fix Resource Exhaustion?

Upgrade cryptography to version 42.0.2 or higher.

[35.0.0,42.0.2)
  • M
Use of a Broken or Risky Cryptographic Algorithm

Affected versions of this package are vulnerable to Use of a Broken or Risky Cryptographic Algorithm due to an issue in the POLY1305 MAC implementation on PowerPC CPUs. An attacker can corrupt the application state and cause incorrect calculations or potential denial of service by influencing the use of the POLY1305 MAC algorithm.

Note:

This is only exploitable if the attacker has the ability to affect the algorithm's usage and the application relies on non-volatile XMM registers.

How to fix Use of a Broken or Risky Cryptographic Algorithm?

Upgrade cryptography to version 42.0.2 or higher.

[35.0.0,42.0.2)