-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Vuln] JWT bomb Attack in decode function #344
Comments
Hello @P3ngu1nW I'm fairly new to this field, so please bear with me. I've been trying to understand this issue and have read up on the JWT bomb attack. To tackle it, do we simply need to cap the token size at 250K? If so, I've made the necessary changes in the decrypt function of my forked repository. Could you please review it and let me know if there's anything else required? Thank You, |
Hi! |
Hello, Thanks for the confirmation!. |
Following up on this. |
I've created a more comprehensive pull request which includes tests: #352 |
This is CVE-2024-33664 |
@P3ngu1nW or @alistairwatts, thanks for reporting this CVE. It seems to be specific to tokens with compression. I also don't quite understand which functions of the library are affected:
Your description has a section "Who is impacted?", which is a good idea, but unfortunately does not contain enough information for non-crypto-experts to determine if their library usage is safe regarding this CVE or not. |
@heidemn-faro, if your application is not supporting encrypted tokens, then it doesn't look like the vulnerability affects you. You should be fine if you're not using If import jose.constants
jose.constants.ZIPS.SUPPORTED.discard('DEF') |
There are patch files that need to be added into this repo: https://build.opensuse.org/projects/openSUSE:Factory/packages/python-python-jose/files/CVE-2024-33663.patch and https://build.opensuse.org/projects/openSUSE:Factory/packages/python-python-jose/files/CVE-2024-33664.patch |
@P3ngu1nW please help me understand why you've closed the ticket? I don't see any related commit on the master branch. |
I saw @gitjkesslergs mentioned a fix for this |
JWT bomb Attack in decode function
0x01 Affected version
vendor: https://github.com/mpdavis/python-jose
version: 3.3.0
0x02 What kind of vulnerability is it? Who is impacted?
This vulnerability allows an attacker to cause a Denial-of-Service (DoS) condition by crafting a malicious JSON Web Encryption (JWE) token with an exceptionally high compression ratio. When this token is processed by the server, it results in significant memory allocation and processing time during decompression.
0x03 Vulnerability details
The Proof of Concept (PoC) below demonstrates how this vulnerability can lead to a DoS attack:
This vulnerability is demonstrated by comparing the processing times of a compressed token to an uncompressed token of the same length. The compressed token's processing time is significantly higher, showcasing the vulnerability's potential impact.
0x04 Mitigation
To mitigate this vulnerability, it is recommended to limit the maximum token length to 250K. This approach has also
been adopted by the JWT library System.IdentityModel.Tokens.Jwt used in Microsoft Azure [1], effectively preventing
attackers from exploiting this vulnerability with high compression ratio tokens.
0x05 References
[1] CVE-2024-21319
The text was updated successfully, but these errors were encountered: