Prevent shadowing stdlib in gzip/tarfile/zipfile CLI during extraction

State
Published
Severity
5.3 Medium
Published
Nov 10, 2026
Updated
Nov 11, 2026
Reserved
Oct 23, 2026

Read the record on cve.org

Description

When tarfile or zipfile command line interface (CLI) is used to

decompress an archive, a Python script shadowing the stdlib can be

created. Then if an error occurs during decompressing the next file,

the newly created Python script is executed. This is especially true

if the created Python is called traceback.py. The problem is that

Python adds the current directory to sys.path when python -m MODULE is

run, and the archive is also decompressed in the current directory.

The fix removes sys.path[0] in gzip, tarfile and zipfile command line

interface to prevent shadowing standard library modules from extracted

files.

ProductVersions
CPython Python Software Foundationbefore 3.16.0 Affected

Weaknesses

  • CWE-829 Inclusion of Functionality from Untrusted Control Sphere

References

Every record here comes from the CVE Program's CVE List. © 1999-2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.

© 2026 NVIDIA, the NVIDIA logo, and NVIDIA Inception are trademarks and/or registered trademarks of NVIDIA Corporation in the U.S. and other countries.