{"id":"CVE-2026-115791","kind":"vulnerability","aliases":["CVE-2026-115791"],"related":[],"title":"Python: archive CLI can run a planted traceback.py from the current directory","description":"When tarfile or zipfile command line interface (CLI) is used to\n\ndecompress an archive, a Python script shadowing the stdlib can be\n\ncreated. Then if an error occurs during decompressing the next file,\n\nthe newly created Python script is executed. This is especially true\n\nif the created Python is called traceback.py. The problem is that\n\nPython adds the current directory to sys.path when python -m MODULE is\n\nrun, and the archive is also decompressed in the current directory.\n\n\n\nThe fix removes sys.path[0] in gzip, tarfile and zipfile command line\n\ninterface to prevent shadowing standard library modules from extracted\n\nfiles.","summary":"When the tarfile or zipfile command line tool extracts an archive, a file it writes into the current directory can shadow a standard library module such as traceback.py. If a later extraction step fails, Python imports and runs that planted script.","severity":"medium","cvss":5.3,"epss":null,"exploited":false,"exploited_at":null,"products":[],"ecosystems":[],"tags":["archives","cli","python","runtime"],"not_affected_if":["empty-working-directory","library-use-only","trusted-archives"],"how_to_check":"- Run `python3 --version` and compare with the fixed versions in the product ranges, if the sources list them\n- Check whether scripts run `python -m tarfile`, `python -m zipfile` or `python -m gzip` to extract untrusted archives in a working directory","fix":null,"status":"open","published_at":"2026-11-10T17:17:22+00:00","first_seen_at":"2026-11-10T17:22:40+00:00","triaged_at":"2026-11-10T17:24:37+00:00","updated_at":"2026-11-10T17:24:37+00:00","category":"runtime","confidence":0.6,"triage":{"at":"2026-11-10T17:24:37Z","model":"claude-haiku-5-5","output":{"fix":"unknown","reach":"local","title":"Python: archive CLI can run a planted traceback.py from the current directory","impact":"high","summary":"When the tarfile or zipfile command line tool extracts an archive, a file it writes into the current directory can shadow a standard library module such as traceback.py. If a later extraction step fails, Python imports and runs that planted script.","audience":"developers","category":"runtime","nicknames":[],"who_cares":["python","cli","archives"],"confidence":0.6,"fix_status":"unknown","needs_auth":"no","worst_case":"Attacker code runs as the user who extracts the archive","analyst_note":"Confirm the fixed Python versions from the python-announce advisory and the CPython issue for CVE-2026-115791; sources given do not list them.","how_to_check":"- Run `python3 --version` and compare with the fixed versions in the product ranges, if the sources list them\n- Check whether scripts run `python -m tarfile`, `python -m zipfile` or `python -m gzip` to extract untrusted archives in a working directory\n- unknown for other checks the sources do not describe","plain_action":"","product_name":"","needs_analyst":true,"not_affected_if":["library-use-only","trusted-archives","empty-working-directory"],"who_is_affected":"Exposure needs someone to run the tarfile, zipfile or gzip command line interface on an untrusted archive from a directory that holds other files. The Python interpreter's sys.path behavior makes the current directory importable under python -m. Programs that import these modules as a library, or extract archives only from trusted sources in an empty directory, are less exposed.","user_interaction":"yes","product_ecosystem":"","needs_special_setup":"yes","severity_if_unknown":"medium"},"cost_usd":0.000764,"input_tokens":4707,"output_tokens":586,"severity_before":"medium"},"analyst_status":null,"analyst_note":null,"search":"'-115791':15A,18A '-2026':14A,17A '0':146C 'add':120C 'also':136C 'archiv':2A,19B,33B,77C,134C 'call':113C 'cli':3A,20B,71C 'command':28B,68C,152C 'creat':86C,99C,110C 'current':11A,40B,122C,140C 'cve':13A,16A 'decompress':75C,93C,137C 'directori':12A,41B,123C,141C 'error':90C 'especi':106C 'execut':103C 'extract':31B,54B,162C 'fail':56B 'file':35B,96C,163C 'fix':143C 'gzip':148C 'import':58B 'interfac':70C,154C 'later':53B 'librari':46B,159C 'line':29B,69C,153C 'm':128C 'modul':47B,129C,160C 'newli':98C 'next':95C 'occur':91C 'plant':7A,62B 'prevent':156C 'problem':116C 'python':1A,21B,57B,79C,100C,111C,119C,127C 'remov':144C 'run':5A,60B,131C 'runtim':22B 'script':63B,80C,101C 'shadow':43B,81C,157C 'standard':45B,158C 'stdlib':83C 'step':55B 'sys.path':125C,145C 'tarfil':25B,65C,149C 'tool':30B 'traceback.py':8A,50B,114C 'true':107C 'use':73C 'write':37B 'zipfil':27B,67C,151C","nicknames":[],"mitigations":[],"who_affected":"Exposure needs someone to run the tarfile, zipfile or gzip command line interface on an untrusted archive from a directory that holds other files. The Python interpreter's sys.path behavior makes the current directory importable under python -m. Programs that import these modules as a library, or extract archives only from trusted sources in an empty directory, are less exposed.","tier":"C","verified":{},"analyst_revisit_at":null,"fix_status":"unknown","audience":"developers","plain_action":null,"pkeys":[],"ptokens":[],"labels":["archives","cli","medium","python","runtime"],"campaign_type":null,"search_a":"'-115791':15A,18A '-2026':14A,17A 'archiv':2A 'cli':3A 'current':11A 'cve':13A,16A 'directori':12A 'plant':7A 'python':1A 'run':5A 'traceback.py':8A","search_b":"'archiv':19B,33B 'cli':20B 'command':28B 'current':40B 'directori':41B 'extract':31B,54B 'fail':56B 'file':35B 'import':58B 'later':53B 'librari':46B 'line':29B 'modul':47B 'plant':62B 'python':21B,57B 'run':60B 'runtim':22B 'script':63B 'shadow':43B 'standard':45B 'step':55B 'tarfil':25B 'tool':30B 'traceback.py':50B 'write':37B 'zipfil':27B","search_c":"'0':146C 'add':120C 'also':136C 'archiv':77C,134C 'call':113C 'cli':71C 'command':68C,152C 'creat':86C,99C,110C 'current':122C,140C 'decompress':75C,93C,137C 'directori':123C,141C 'error':90C 'especi':106C 'execut':103C 'extract':162C 'file':96C,163C 'fix':143C 'gzip':148C 'interfac':70C,154C 'librari':159C 'line':69C,153C 'm':128C 'modul':129C,160C 'newli':98C 'next':95C 'occur':91C 'prevent':156C 'problem':116C 'python':79C,100C,111C,119C,127C 'remov':144C 'run':131C 'script':80C,101C 'shadow':81C,157C 'standard':158C 'stdlib':83C 'sys.path':125C,145C 'tarfil':65C,149C 'traceback.py':114C 'true':107C 'use':73C 'zipfil':67C,151C","cause_entry":null,"cause_path":null,"disclosures_checked_at":null,"first_public_at":"2026-11-10T16:00:26+00:00","kev":null,"cvss_vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:A/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","cvss_by":"cna@python.org","poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-115791","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-115791","severity":null,"published_at":"2026-11-10T17:17:22+00:00","modified_at":"2026-11-10T17:17:22+00:00","first_seen_at":"2026-11-10T17:22:40+00:00","fetched_at":"2026-11-10T17:22:40+00:00","note":null}],"documents":[{"id":116228,"url":"https://mail.python.org/archives/list/security-announce@python.org/message/ZKKA4Q7B35JEHSDIJNZ6TYKRDQJUHDAG/","title":"Python security-announce: [Security-announce][CVE-2026-115791] Prevent shadowing stdlib in gzip/tarfile/zipfile CLI","kind":"advisory","source":"advisory","publisher":null,"text":"[Security-announce][CVE-2026-115791] Prevent shadowing stdlib in gzip/tarfile/zipfile CLI\n\nThere is a MEDIUM severity vulnerability affecting CPython. 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. Please see the linked CVE ID for the latest information on affected versions: * https://www.cve.org/CVERecord?id=CVE-2026-115791 * https://github.com/python/cpython/issues/161705","published_at":"2026-11-10T16:00:26+00:00","relation":"advisory","confidence":null,"note":null}],"disclosures":[],"exploit_sources":[],"notice":"Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai"}