CPython gzip, tarfile, and zipfile CLIs can shadow stdlib (CVE-2026-115791)
Python's security list rates the flaw medium; the excerpt gives no fixed version or exploitation status.
Stdlib module shadowing in CPython tarfile/zipfile CLI
Using Python's tarfile or zipfile CLI to extract an archive can create a script that shadows a standard-library module, such as traceback.py, in the current directory. If the next file fails to decompress, Python may import and run that script because python -m puts the current directory on sys.path. A local attacker who supplies the archive needs the operator to run the CLI and hit that error to execute code as that user. Affected CPython builds are not listed.
What to do: Apply CPython's update for CVE-2026-115791. The fix drops the current directory from sys.path in the gzip, tarfile, and zipfile command-line interfaces.
| Product | Affected |
|---|---|
| Python CPython | — |
Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.
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.
Python's security list rates the flaw medium; the excerpt gives no fixed version or exploitation status.
Today 1.5K readers · 2.4K views · 768 reads · all time 189K views