Opened 4 weeks ago

Closed 4 weeks ago

#5910 closed enhancement (fixed)

python CVE-2026-6100

Reported by: Joe Locash Owned by: SecurityAdvisory
Priority: highest Milestone: 13.1
Component: Book Version: git
Severity: normal Keywords:
Cc:

Description

There is a CRITICAL severity vulnerability affecting CPython.

Use-after-free (UAF) was possible in the lzma.LZMADecompressor,
bz2.BZ2Decompressor, and gzip.GzipFile when a memory allocation fails
with a MemoryError and the decompression instance is re-used. This
scenario can be triggered if the process is under memory pressure. The fix
cleans up the dangling pointer in this specific error condition.

The vulnerability is only present if the program re-uses decompressor
instances across multiple decompression calls even after a MemoryError is
raised during decompression. Using the helper functions to one-shot
decompress data such as lzma.decompress(), bz2.decompress(),
gzip.decompress(), and zlib.decompress() are not affected as a new
decompressor instance is created for each call. If the decompressor
instance is not re-used after an error condition, this usage is similarly
not vulnerable.

Please see the linked CVE ID for the latest information on affected
versions:

    https://www.cve.org/CVERecord?id=CVE-2026-6100
    https://github.com/python/cpython/pull/148396

Source: https://mail.python.org/archives/list/security-announce@python.org/thread/HTWB2Z6KT5QQX4RYEZAFININDHNOSIF3/

Attachments (1)

Python-3.14.4-security_fixes-1.patch (7.7 KB ) - added by Joe Locash 4 weeks ago.
I'm attaching a patch that addresses this, and CVE-2026-1502 which was also fixed after the release of 3.14.4.

Download all attachments as: .zip

Change History (6)

comment:1 by Bruce Dubbs, 4 weeks ago

At first I thought this was for cython, but it is indeed a module in Python-3.14.4 (ticket #5907).

It first looked like the pull request could be implemented with a single sed across three files, but the changes are slightly different for each file. We can use:

sed -i '596 a\    bzs->next_in = NULL;'      Modules/_bz2module.c
sed -i '1122a\    lzs->next_in = NULL;'      Modules/_lzmamodule.c
sed -i '1677a\    self->zst.next_in = NULL;' Modules/zlibmodule.c

We need line numbers since there are multiple instances of '^error:' in the files.

Note that the line numbers are different from the pull request for Python-3.14.4.

Last edited 4 weeks ago by Bruce Dubbs (previous) (diff)

by Joe Locash, 4 weeks ago

I'm attaching a patch that addresses this, and CVE-2026-1502 which was also fixed after the release of 3.14.4.

comment:2 by Bruce Dubbs, 4 weeks ago

Owner: changed from lfs-book to Douglas R. Reno

Fixed at commit b4defc453e. Leaving open for security advisories.

comment:3 by Bruce Dubbs, 4 weeks ago

Owner: changed from Douglas R. Reno to SecurityAdvisory

comment:4 by Joe Locash, 4 weeks ago

I updated the the 3.14.4 patch for CVE-2026-4786 and CVE-2026-5713, and bumped up the version of the patch.

comment:5 by Douglas R. Reno, 4 weeks ago

Resolution: fixed
Status: newclosed

SA-13.0-038 filed. Thank you for your constant work on keeping up with the Python stuff Joe, I really appreciate it!

Note: See TracTickets for help on using tickets.