REDHAT-BUG-2508524: Medium severity pypi/joserfc vulnerability
joserfc is a Python library that provides an implementation of several JSON Object Signing and Encryption (JOSE) standards. in versions 1.7.1 and prior, joserfc accepts JWTs with trailing padding (==) which are not conforming to the JOSE specifications. This leads to malleability of the JWTs when consumed by joserfc. Depending on this application this might or not be an issue. This could lead to bypass of token revocation or anti-replay protection when implemented as a deny list of tokens or a deny list of token hashes. Note that ECDSA JWS are always malleable because of the malleability of ECDSA signatures (first test case in the code bellow). This makes a scheme which assumes that JWTs are not malleable brittle. However for other signatures (or MAC) schemes it might make sense to assume non malleability of the token. This issue has been fixed in version 1.7.2.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
joserfcto a version that resolves this vulnerability.Fixed in 1.7.2
Event History
Frequently Asked Questions
Which applications are most likely to be affected by this behavior?
Applications that consume JWTs with joserfc and implement token revocation or anti-replay controls using a deny list of raw tokens or token hashes may be affected. The impact depends on whether those controls assume that a JWT has only one valid serialized representation.
What does an attacker need to exploit it?
An attacker needs a JWT that is accepted by the application and an application workflow where an equivalent, modified token representation can bypass a token-based or token-hash-based deny list. The issue involves JWTs with trailing "==" padding accepted by affected joserfc versions.
Are all JWT signature schemes equally relevant to this issue?
No. ECDSA JWS are always malleable due to ECDSA signature malleability, so designs relying on JWT non-malleability are already brittle for ECDSA. For other signature or MAC schemes, applications may reasonably have assumed non-malleability, making the trailing-padding acceptance more relevant.
What version addresses the issue?
The issue is fixed in joserfc version 1.7.2. Versions 1.7.1 and earlier are described as accepting non-conforming JWTs with trailing padding.