MEDIUM5.9
PYSEC-2026-3745
Quick fix
PYSEC-2026-3745 — openssl-encrypt: upgrade to the fixed version with the command below.
pip install --upgrade 'openssl-encrypt>=1.4.0'Details
openssl_encrypt before 1.4.0 imports Python's non-cryptographic 'random' module (Mersenne Twister PRNG) at line 15 of openssl_encrypt/modules/pqc.py. No direct calls to random.* were present in the code, so no cryptographic operation is currently affected; however, the import creates a hazard that future code could inadvertently use random.randint() instead of a cryptographically secure alternative (secrets/os.urandom), producing predictable values since the Mersenne Twister state can be recovered from approximately 624 outputs. Fixed by removing the import in 1.4.0.
Are you affected?
Enter the version of the package you're using.
Affected packages
PyPI/openssl-encrypt
Introduced in:
0Fixed in: 1.4.0Fix
pip install --upgrade 'openssl-encrypt>=1.4.0'