{"id":1031,"cve":"CVE-2024-33664","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2024-33664\/","cwe":"CWE-400","cwe_number":400,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/400","cvss_score":5.3,"published":"2024-04-26","owasp":"A05 Security Misconfiguration","odc":"Algorithm","cdc":"Incorrect Algorithm","category":"Resource Management","subcategory":"Resource Exhaustion","scope":"Remote","impact":"Denial of Service (DoS)","summary":"Denial of service via high compression ratio in JSON Web Encryption tokens.","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2024-33664\/","description":"python-jose through 3.3.0 allows attackers to cause a denial of service (resource consumption) during a decode via a crafted JSON Web Encryption (JWE) token with a high compression ratio, aka a \"JWT bomb.\" This is similar to CVE-2024-21319.","solution":"Upgrade to python-jose version 3.3.1 or later.","affected_component":"python-jose","fixed_by_upgrading":true,"vulnerable_code":"from jose import jwe\n\ndef decode(token):\n    return jwe.decode(token, key='your-256-bit-secret')\n\ntoken = \"your_jwe_token_here\"\ndecoded = decode(token)\nprint(decoded)","patched_code":"from jose import jwe\n\ndef decode(token):\n    max_size = 1024 * 1024\n    if len(token.encode('utf-8')) > max_size:\n        raise ValueError(\"Token size exceeds the maximum allowed limit.\")\n    \n    return jwe.decode(token, key='your-256-bit-secret')\n\ntry:\n    token = \"your_jwe_token_here\"\n    decoded = decode(token)\n    print(decoded)\nexcept Exception as e:\n    print(f\"Error: {e}\")","payload_needed":true,"payload":"```json\n{\n  \"alg\": \"dir\",\n  \"enc\": \"DEF\",\n  \"zip\": \"DEF\",\n  \"payload\": \"A very large payload that compresses to a small size when decoded, potentially causing resource exhaustion.\"\n}\n```","payload_status":"available","published_fix":[{"repository":"mpdavis\/python-jose","commit_url":"https:\/\/github.com\/mpdavis\/python-jose\/pull\/345","commit_subject":"Limit token size to 250 KB","units":[{"file":"jose\/jwe.py","function":"decrypt"}]}],"references":null}