VAITP Dataset

← Back to the dataset

CVE-2024-33664

Denial of service via high compression ratio in JSON Web Encryption tokens.

  • CVSS 5.3
  • CWE-400
  • Resource Management
  • Remote

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.

CVSS base score
5.3
Published
2024-04-26
OWASP
A06 Security Misconfiguration
Orthogonal defect classification
Algorithm
Code defect classification
Incorrect Algorithm
Category
Resource Management
Subcategory
Resource Exhaustion
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
python-jose
Fixed by upgrading
Yes

Solution

Upgrade to python-jose version 3.3.1 or later.

Vulnerable code sample

from jose import jwe

def decode(token):
    return jwe.decode(token, key='your-256-bit-secret')

token = "your_jwe_token_here"
decoded = decode(token)
print(decoded)

Patched code sample

from jose import jwe

def decode(token):
    max_size = 1024 * 1024
    if len(token.encode('utf-8')) > max_size:
        raise ValueError("Token size exceeds the maximum allowed limit.")
    
    return jwe.decode(token, key='your-256-bit-secret')

try:
    token = "your_jwe_token_here"
    decoded = decode(token)
    print(decoded)
except Exception as e:
    print(f"Error: {e}")

Payload

{
  "alg": "dir",
  "enc": "DEF",
  "zip": "DEF",
  "payload": "A very large payload that compresses to a small size when decoded, potentially causing resource exhaustion."
}

Cite this entry

@misc{vaitp:cve202433664,
  title        = {{Denial of service via high compression ratio in JSON Web Encryption tokens.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2024},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2024-33664},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2024-33664/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::