The vulnerability is a Denial of Service (DoS) in the PyJWT library when handling detached JWS tokens with the "b64": false header. The root cause lies in the PyJWS._load function, which was called by PyJWS.decode and PyJWS.decode_complete. Before the patch, _load would unconditionally perform a Base64URL decoding of the payload segment from the JWS compact serialization. However, when b64 is false, the RFC specifies that the payload is detached and the segment in the token itself should be ignored. The library correctly discarded this decoded data later, but not before spending significant CPU and memory resources on the decoding process.
An unauthenticated attacker could exploit this by sending a JWS token with "b64": false in its header and a very large string in the payload segment. The server-side PyJWT library would attempt to decode this large, bogus payload, consuming resources and slowing down the application, which happens before the signature is even verified. Repeated requests could lead to worker thread starvation and a full DoS.
The fix, applied in version 2.13.0, modifies the _load function to first check the value of the b64 header. If it is false, the function now skips the expensive decoding step and instead asserts that the payload segment must be empty, effectively closing the resource consumption vulnerability.