high CVSS 7.5

CVE-2024-52804·Python vulnerability

Tornado is a Python web framework and asynchronous networking library. The algorithm used for parsing HTTP cookies in Tornado versions prior to 6.4.2 sometimes has quadratic complexity, leading to excessive CPU consumption when parsing maliciously-crafted cookie headers. This parsing occurs in the event loop thread and may block the processing of other requests. Version 6.4.2 fixes the issue.

Severity
high
Software
Python
Fixed in
6.4.2
Published
2024-11-22

Affected versions

Until: 6.4.2

Fixed in: 6.4.2

How to fix this CVE

Update Python's Tornado web framework to version 6.4.2 or later to remediate a cookie parsing vulnerability that causes excessive CPU consumption. This vulnerability allows unauthenticated attackers to trigger denial-of-service conditions by sending specially crafted HTTP cookie headers that trigger quadratic-time parsing logic. Ensure all systems running Tornado are patched immediately, particularly those exposed to untrusted network traffic.

sudo dnf update python3-tornado

Defensia detects this vulnerability

What an exploitation attempt looks like

Sample log line indicative of exploitation attempts:

POST|GET .* HTTP/1\.[01].*Cookie:.{1000,}|Cookie:.*(?:[a-zA-Z0-9_-]{50,}=){5,}

WAF mitigation (if patching is not yet possible)

Add this rule to your WAF to block exploitation attempts while you schedule the patch.

Implement request-level cookie header size validation: reject HTTP requests with Cookie headers exceeding 4096 bytes. Add rate limiting on the Tornado application level to detect clients sending repeated requests with unusually large or complex cookie structures within short time windows.

How to check if you are affected

  1. Check installed Tornado version: python3 -c "import tornado; print(tornado.version)" and verify it is 6.4.2 or higher
  2. Identify Tornado applications in your environment: grep -r "import tornado" /opt /srv /home --include="*.py" 2>/dev/null | grep -v __pycache__
  3. Review web server access logs for abnormal cookie header sizes or repeated malformed cookie patterns: grep -i 'cookie' /var/log/nginx/access.log | awk -F'Cookie:' '{print $2}' | awk '{print length}' | sort -rn | head -20
  4. Verify the patch was applied by checking Tornado version again and confirming pip list shows tornado>=6.4.2 for Python package managers

FAQ

What is CVE-2024-52804?

CVE-2024-52804 is a denial-of-service vulnerability in Tornado's HTTP cookie parsing mechanism where specially crafted cookies trigger inefficient algorithmic behavior, causing the event loop thread to consume excessive CPU resources and blocking legitimate request processing.

Is CVE-2024-52804 being actively exploited?

No, this vulnerability is not currently listed in the CISA KEV catalog and no public exploits are available, though the attack is trivial to execute and organizations should still patch promptly.

What versions of Python are affected by CVE-2024-52804?

Tornado versions prior to 6.4.2 are affected. The vulnerability exists across all Tornado releases up to and including 6.4.1, regardless of the underlying Python 3 version.

How do I check if my server is vulnerable to CVE-2024-52804?

Run 'python3 -c "import tornado; print(tornado.version)"' and compare the output to 6.4.2. If the version is 6.4.1 or lower, the server is vulnerable.

Does Defensia detect CVE-2024-52804?

Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Tornado is installed on a monitored server, CVE-2024-52804 will appear in your dashboard with remediation steps.

Related Python CVEs

CVE-2026-28505CVSS 10Tautulli is a Python based monitoring and tracking tool for Plex Media Server. Prior to version 2.17.0, the str_eval() function in notification_handler.py implements a sandboxed eval() for notification text templates. The sandbox attempts to restrict callable names by inspecting code.co_names of the compiled code object. However, co_names only contains names from the outer code object. When a lambda expression is used, it creates a nested code object whose attribute accesses are stored in code.co_consts, NOT in code.co_names. The sandbox never inspects nested code objects. This issue has been patched in version 2.17.0.
CVE-2026-25632CVSS 10EPyT-Flow is a Python package designed for the easy generation of hydraulic and water quality scenario data of water distribution networks. Prior to 0.16.1, EPyT-Flow’s REST API parses attacker-controlled JSON request bodies using a custom deserializer (my_load_from_json) that supports a type field. When type is present, the deserializer dynamically imports an attacker-specified module/class and instantiates it with attacker-supplied arguments. This allows invoking dangerous classes such as subprocess.Popen, which can lead to OS command execution during JSON parsing. This also affects the loading of JSON files. This vulnerability is fixed in 0.16.1.
CVE-2026-34938CVSS 10PraisonAI is a multi-agent teams system. Prior to version 1.5.90, execute_code() in praisonai-agents runs attacker-controlled Python inside a three-layer sandbox that can be fully bypassed by passing a str subclass with an overridden startswith() method to the _safe_getattr wrapper, achieving arbitrary OS command execution on the host. This issue has been patched in version 1.5.90.
CVE-2026-33054CVSS 10Mesop is a Python-based UI framework that allows users to build web applications. Versions 1.2.2 and below contain a Path Traversal vulnerability that allows any user supplying an untrusted state_token through the UI stream payload to arbitrarily target files on the disk under the standard file-based runtime backend. This can result in application denial of service (via crash loops when reading non-msgpack target files as configurations), or arbitrary file manipulation. This vulnerability heavily exposes systems hosted utilizing FileStateSessionBackend. Unauthorized malicious actors could interact with arbitrary payloads overwriting or explicitly removing underlying service resources natively outside the application bounds. This issue has been fixed in version 1.2.3.
CVE-2026-25115CVSS 9.9n8n is an open source workflow automation platform. Prior to version 2.4.8, a vulnerability in the Python Code node allows authenticated users to break out of the Python sandbox environment and execute code outside the intended security boundary. This issue has been patched in version 2.4.8.

References

Track CVEs across your fleet automatically

Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2024-52804. Free for 1 server.

Get started free