CVE-2025-65015

7.5 HIGH

📋 TL;DR

This vulnerability in the joserfc Python library allows attackers to cause denial-of-service through memory exhaustion by sending extremely large JWT tokens. When the library processes oversized tokens, it embeds the full payload in exception messages that get logged, potentially overwhelming logging systems. This affects Python web applications using joserfc versions 1.3.3-1.3.4 or 1.4.0-1.4.1 without proper web server request size limits.

💻 Affected Systems

Products:
  • joserfc Python library
Versions: 1.3.3 to 1.3.4, 1.4.0 to 1.4.1
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Requires Python web application using joserfc for JWT processing without proper web server request size limits.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service outage due to memory exhaustion, log storage overflow, and potential crash of monitoring systems like Sentry.

🟠

Likely Case

Degraded application performance, log storage exhaustion, and monitoring system disruption from oversized log messages.

🟢

If Mitigated

Minimal impact with proper web server request size limits and updated library versions.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Attack requires sending oversized JWT tokens via HTTP headers, which is trivial to automate.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.3.5 or 1.4.2

Vendor Advisory: https://github.com/authlib/joserfc/security/advisories/GHSA-frfh-8v73-gjg4

Restart Required: Yes

Instructions:

1. Update joserfc: pip install --upgrade joserfc>=1.3.5 or joserfc>=1.4.2
2. Restart all Python applications using joserfc
3. Verify no applications are pinned to vulnerable versions

🔧 Temporary Workarounds

Configure web server request size limits

all

Set maximum request header sizes in frontend web servers to prevent oversized JWT tokens from reaching the application.

nginx: client_header_buffer_size 1k; large_client_header_buffers 4 8k;
Apache: LimitRequestFieldSize 8190
uWSGI: buffer-size = 8192

Configure Python logging filters

all

Add logging filters to truncate or drop exception messages containing JWT payloads.

import logging
class JWTSizeFilter(logging.Filter):
    def filter(self, record):
        if 'ExceededSizeError' in str(record.msg):
            record.msg = 'JWT size limit exceeded (payload truncated)'
        return True
logging.getLogger().addFilter(JWTSizeFilter())

🧯 If You Can't Patch

  • Implement strict request size limits at web server level (nginx/Apache) to block oversized headers
  • Monitor and alert on excessive memory usage or log growth from Python applications using joserfc

🔍 How to Verify

Check if Vulnerable:

Check installed joserfc version: pip show joserfc | grep Version

Check Version:

python -c "import joserfc; print(joserfc.__version__)"

Verify Fix Applied:

Confirm version is 1.3.5+ or 1.4.2+: pip list | grep joserfc

📡 Detection & Monitoring

Log Indicators:

  • ExceededSizeError exceptions with large payloads
  • Rapid log file growth
  • Memory exhaustion warnings
  • Sentry/Logging system alerts about oversized messages

Network Indicators:

  • HTTP requests with Authorization headers >8KB
  • Multiple failed JWT validation attempts with large tokens

SIEM Query:

source="application.logs" AND "ExceededSizeError" AND size>10000

🔗 References

📤 Share & Export