kafka-python vulnerable to denial of service through an unvalidated protocol frame lengthGHSA-m3px-q5gj-j9x7
HIGHFix: dpkp/kafka-python#3019GHSA-m3px-q5gj-j9x7 is a high-severity (CVSS 7.5) CWE-789 vulnerability in kafka-python. A fix is available for kafka-python — see the affected versions and patch details below.
Exploitation Status
No confirmed exploitation observed yet
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-m3px-q5gj-j9x7.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
kafka-pythonReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
kafka-python prior to 2.3.2 contains a denial-of-service vulnerability in the protocol parser that allows a malicious broker or machine-in-the-middle attacker to exhaust memory or hang connections by sending a crafted 4-byte frame length value without bounds validation. Attackers can send a specially crafted frame length through the receive_bytes() function to trigger either a multi-gigabyte memory allocation or an uncaught ValueError that leaves the connection in a broken state, causing requests to hang and consumers to stop heartbeating until restart.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | kafka-python | all versions | 2.3.2pip install --upgrade 'kafka-python==2.3.2' |
Affected Products
kafka-pythondpkpDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for kafka-python, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update kafka-python to 2.3.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-m3px-q5gj-j9x7 is resolved across your whole dependency graph.
Workarounds
Cap what an attacker can consume: apply request size, rate and timeout limits in front of the affected component, and run it with memory and CPU limits so exhaustion degrades one worker rather than the whole service.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
A flaw was found in kafka-python. The protocol parser does not validate frame length values, allowing a malicious broker or man-in-the-middle attacker to exhaust memory or hang connections by sending a crafted 4-byte frame length. This can cause multi-gigabyte memory allocation or leave connections in a broken state,…
Upgrade to kafka-python 2.3.2 or later. As a workaround, ensure Kafka broker connections use TLS with mutual authentication to prevent man-in-the-middle attacks.Source: Red Hat security advisory for GHSA-m3px-q5gj-j9x7 (CC BY 4.0)
Frequently Asked Questions
Is GHSA-m3px-q5gj-j9x7 in your dependencies?
Find it across PyPI, including transitive dependencies.