REDHAT-BUG-2588664: Medium severity pypi/jwcrypto vulnerability
A flaw was found in python-jwcrypto. The JWK constructor still honours the deprecated generate keyword, and two code paths build a JWK from untrusted data through that constructor: the ECDH-ES epk header processed during JWE decryption, and individual entries imported through JWKSet. An attacker-supplied epk header or JWK Set entry such as {"generate": "oct", "size": ...} makes jwcrypto generate a key of the attacker's chosen type and unbounded size, for JWE before any authentication tag check and without any key material. A crafted 146-byte token was shown to cause roughly 1.1 GB of memory allocation per decryption attempt, and a large RSA size stalls the worker in key generation for minutes, potentially resulting in a denial of service.
Affected Software
Event History
Frequently Asked Questions
Does an attacker need valid key material or a successfully authenticated JWE to trigger this issue?
No. The ECDH-ES epk header is processed during JWE decryption before authentication-tag verification, and the described payload requires no key material.
Which application flows can be exposed?
Applications are exposed when they decrypt JWE messages using ECDH-ES with attacker-controlled headers, or when they import individual untrusted entries into a JWKSet.
What operational impact can a malicious payload cause?
A 146-byte crafted token was shown to allocate approximately 1.1 GB of memory per decryption attempt. Selecting a large RSA size can also keep a worker busy generating a key for minutes, causing denial of service.