Listen to this Post
How CVE-2026-9669 Works
The vulnerability exists in CPython’s `bz2` module, specifically within the `bz2.BZ2Decompressor` object. This object is used to decompress data compressed with the bzip2 algorithm in a streaming fashion. The core issue arises from the object’s internal state management when a decompression error occurs.
Normally, when `decompress()` is called, it processes the provided data. If the data is malformed or corrupted, the underlying bzip2 library (libbz2) signals an error, and `decompress()` raises an `OSError` exception. The problematic behavior is that the `BZ2Decompressor` object does not properly reset or invalidate its internal state after such an error.
If an application catches this `OSError` and incorrectly attempts to reuse the same `BZ2Decompressor` instance for further decompression (for example, by calling `decompress()` again with new data), the decompressor resumes from its invalid internal state. This invalid state can cause the decompressor to misinterpret the new input data, leading to the execution of unintended code paths within the libbz2 library.
Specifically, a remote, unauthenticated attacker can craft malicious bz2-compressed input that, when processed by a vulnerable application, triggers this error condition. If the application then reuses the same decompressor object, the attacker-controlled data can cause the decompressor to perform out-of-bounds writes to a stack buffer. This stack buffer overflow can lead to a process crash (segmentation fault) and is a classic denial-of-service (DoS) vector. The vulnerability is considered High severity.
DailyCVE Form:
Platform: ……. CPython
Version: …….. 3.16.0 and earlier
Vulnerability :…… bz2.BZ2Decompressor Reuse-After-Error
Severity: ……. High (CVSS 8.2)
date: ………. 2026-06-08
Prediction: ……. Patch available in 3.16.0
What Undercode Say
Analytics:
Attack Vector: Network/Remote
Attack Complexity: High
Privileges Required: None
User Interaction: None
Impact: Process crash (DoS)
Confidentiality Impact: None
Integrity Impact: None
Availability Impact: High
Exploit:
Craft a malicious bz2 file that triggers an error during decompression. The exact method to trigger the invalid state is complex and depends on the specifics of the libbz2 error handling. A proof-of-concept is not publicly available. The following is a conceptual example of a vulnerable application pattern. Vulnerable Python code example: import bz2 def vulnerable_decompress(data_chunks): decompressor = bz2.BZ2Decompressor() for chunk in data_chunks: try: This call may raise an OSError for malformed data data = decompressor.decompress(chunk) except OSError: Incorrectly reusing the same decompressor object after an error This is the vulnerable pattern data = decompressor.decompress(chunk) return decompressor.eof An attacker could provide a stream of data that causes the first decompress() to fail and then control the subsequent call.
Protection:
Patch: Upgrade to CPython version 3.16.0 or later, which contains the fix.
Workaround: As a defensive measure, applications should never reuse a `bz2.BZ2Decompressor` object after it has raised an error. Instead, they should discard the errored object and create a new instance for subsequent decompression tasks.
Impact:
CIA Triad: This vulnerability directly impacts the Availability of the system. An attacker can cause the application to crash, leading to a denial of service.
Business Impact: For services that process untrusted bzip2 data (e.g., file upload services, data processing pipelines), this flaw can be exploited to disrupt operations, making the service unavailable to legitimate users.
🎯Let’s Practice Exploiting & Learn Patching For Free:
🎓 Live Courses & Certifications:
Join Undercode Academy for Verified Certifications
🚀 Request a Custom Project:
Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands
Sources:
Reported By: github.com
Extra Source Hub:
Undercode

