VAITP Dataset

← Back to the dataset

CVE-2024-33663

Algorithm confusion in python-jose with OpenSSH ECDSA keys (CVE-2022-29217).

  • CVSS 6.5
  • CWE-327
  • Cryptographic
  • Remote

python-jose through 3.3.0 has algorithm confusion with OpenSSH ECDSA keys and other key formats. This is similar to CVE-2022-29217.

CVSS base score
6.5
Published
2024-04-26
OWASP
A05 Security Misconfiguration
Orthogonal defect classification
Algorithm
Code defect classification
Incorrect Algorithm
Category
Cryptographic
Subcategory
Cryptographic Implementation Error
Accessibility scope
Remote
Impact
Unauthorized Access
Affected component
python-jose
Fixed by upgrading
Yes

Solution

Upgrade python-jose to version 3.3.1 or later.

Vulnerable code sample

from jose import jwt

def verify_jwt(token, public_key):
    """Vulnerable function that demonstrates the security issue."""
    try:
        payload = jwt.decode(token, public_key)
        return payload
    except jwt.JWTError as e:
        print(f"JWT verification failed: {e}")
        return None

public_key = "-----BEGIN PUBLIC KEY-----\nYOUR_PUBLIC_KEY_HERE\n-----END PUBLIC KEY-----"
token = "YOUR_JWT_HERE"
payload = verify_jwt(token, public_key)

Patched code sample

from jose import jwt

def verify_jwt(token, public_key):
    """Secure function that fixes the vulnerability."""
    try:
        payload = jwt.decode(token, public_key, algorithms=['ES256'])
        return payload
    except jwt.JWTError as e:
        print(f"JWT verification failed: {e}")
        return None

public_key = "-----BEGIN PUBLIC KEY-----\nYOUR_PUBLIC_KEY_HERE\n-----END PUBLIC KEY-----"
token = "YOUR_JWT_HERE"
payload = verify_jwt(token, public_key)

Payload

{
  "alg": "none",
  "sub": "1234567890",
  "name": "John Doe",
  "iat": 1516239022
}

Cite this entry

@misc{vaitp:cve202433663,
  title        = {{Algorithm confusion in python-jose with OpenSSH ECDSA keys (CVE-2022-29217).}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2024},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2024-33663},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2024-33663/}}
}
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 ::