[Aikido] Fix 19 security issues in pymongo, cryptography, requests and 1 more#14
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrade dependencies to fix critical security vulnerabilities: PyMongo BSON deserialization memory leak, cryptography NULL-pointer DoS and RSA decryption flaw, and urllib3 decompression DoS. This update includes breaking changes that require manual migration.
The package upgrades contain breaking changes that affect this codebase:
1. Python 3.8 Support Dropped
Where your code is affected:
Dockerfile(line 1) specifiespython:3.8-slim-busterImpact: urllib3 2.3.0+ and pyjwt 2.10.0+ no longer support Python 3.8, which is the version currently used in the Docker container. The application will fail to install or run.
Remediation: Update the Dockerfile to use Python 3.9 or later (e.g.,
FROM python:3.9-slim-busterorFROM python:3.11-slim-buster).2. Deprecated cryptography backend usage
Where your code is affected:
main.py(line 8 and line 15) - imports and usesdefault_backend().load_pem_private_key()Impact: While
default_backend()still works in cryptography 46.0.5, this pattern has been deprecated since cryptography 3.x. The modern API no longer requires the backend parameter, anddefault_backend()may be removed in future versions.Remediation: Replace
from cryptography.hazmat.backends import default_backendwithfrom cryptography.hazmat.primitives import serializationand changedefault_backend().load_pem_private_key(cert_bytes, None)toserialization.load_pem_private_key(cert_bytes, None).All breaking changes by upgrading cryptography from version 39.0.1 to 46.0.5 (CHANGELOG)
CFLAGS,LDFLAGS,INCLUDE,LIB, andCRYPTOGRAPHY_SUPPRESS_LINK_FLAGSenvironment variables are no longer validload_pem_pkcs7_certificatesorload_der_pkcs7_certificateswill now raise aValueErrorrather than return an empty listgenerate_private_keynow enforces a minimum RSA key size of 1024-bitNameAttributenow raises an exception when attempting to create a common name whose length is shorter or longer than RFC 5280 permitsload_ssh_private_keynow raises aTypeErrorif the key is unencrypted but a password is provided (previously no exception was raised), and raises aTypeErrorif the key is encrypted but no password is provided (previously aValueErrorwas raised)VerifiedClient.subjectproperty can now beNonesince a custom extension policy may allow certificates without a Subject Alternative Name extensionget_attribute_for_oidmethod onCertificateSigningRequestCAST5,SEED,IDEA, andBlowfishclasses from the cipher moduleAll breaking changes by upgrading requests from version 2.25.1 to 2.32.4 (CHANGELOG)
All breaking changes by upgrading pyjwt from version 2.5.0 to 2.12.0 (CHANGELOG)
✅ 19 CVEs resolved by this upgrade
This PR will resolve the following CVEs:
load_pem_pkcs7_certificatesandload_der_pkcs7_certificatesfunctions are vulnerable to NULL-pointer dereference when processing malformed PKCS7 blobs, causing application crashes and Denial of Service.pkcs12.serialize_key_and_certificateswhen called with a mismatched certificate/private key pair and PKCS12 encryption with hmac_hash, causing process crash (DoS). This is fixed to properly raise a ValueError instead.verify=False, causing all subsequent requests to ignore certificate verification regardless of parameter changes, enabling man-in-the-middle attacks.encode()function is vulnerable to denial of service through quadratic complexity when processing crafted input strings, causing excessive computational load and processing delays proportional to input size.🔗 Related Tasks