Executive brief
A vulnerability exists in Python's bz2 compression library, which is used by many applications to handle compressed data. If an application encounters an error while decompressing a file and attempts to reuse the same decompressor object, it could lead to a system crash. This could allow an attacker to disrupt services or cause applications to fail by providing specially crafted compressed files.
Technical details
A stack-based buffer overflow (CWE-121) exists in the CPython bz2 module. The vulnerability occurs when a bz2.BZ2Decompressor object is reused after it has already raised an OSError during a previous decompression attempt. If an application catches the exception and retries decompression with the same object, crafted input can cause the underlying libbz2 state to become desynchronized, resulting in out-of-bounds writes to a stack buffer. This typically results in a hard crash of the Python interpreter. The issue has been addressed by preventing the reuse of decompressor objects once they have entered an error state.
Affected products
- Python Software Foundation CPython 3.12, 3.13, 3.14, 3.15 (main)
Timeline
- 2026-05-30: disclosed: Issue reported on GitHub
- 2026-06-07: patched: Fix merged into CPython main branch
- 2026-06-08: advisory: CVE published and NVD record created